Day 11: Routing Fundamentals
Routing Fundamentals & Static Routing
Overview
What is Routing?
Routing is the process that routers use to determine the path that IP packets should take over a network to reach their destination.
Core Concept:
-
Routers forward packets between different networks (across network boundaries)
-
Switches forward frames within the same LAN (within a network)
-
A router reads the destination IP address and determines where to send the packet next
Key Difference from Switching:
Switches (Layer 2):
- Examine destination MAC address
- Forward within the same LAN
- Fast forwarding to connected devices
Routers (Layer 3):
- Examine destination IP address
- Forward between different networks
- Use routing tables to determine best path
Routing Tables
What is a Routing Table?
A routing table is a database of routes that tells the router where to send packets destined for specific networks or IP addresses.
Stored on: Every router in the network
Content: Network destinations and how to reach them
Route Components
Each route entry contains:
Destination Network → Next-Hop Router (or directly connected)
Example:
Destination: 192.168.2.0/24 → Send to next-hop router: 10.0.0.2
Destination: 10.1.1.0/24 → Send directly out interface G0/1
Destination: 172.16.0.0/16 → Send to next-hop router: 10.0.0.3
Route Types
When a router receives a packet, it can take one of three actions:
1. Forward to Next-Hop Router
Route: "To reach 192.168.1.0/24, send to router 10.0.0.2"
Router receives packet destined for 192.168.1.50
↓
Looks in routing table: "I have a route to 192.168.1.0/24"
↓
Action: Forward packet to 10.0.0.2 (next-hop IP)
↓
Router 10.0.0.2 receives and continues forwarding
2. Forward Directly to Destination (Directly Connected)
Route: "192.168.1.0/24 is directly connected to my G0/1 interface"
Router receives packet destined for 192.168.1.100
↓
Looks in routing table: "192.168.1.0/24 is on my G0/1 interface"
↓
Action: Send packet directly out G0/1 to destination
3. Receive for Itself
Route: "10.0.0.0/24 is my own interface"
Router receives packet destined for 10.0.0.1 (its own IP)
↓
Looks in routing table: "This is MY IP address"
↓
Action: Don't forward, receive packet and process it
Viewing the Routing Table
Router# show ip route
This displays all routes the router knows about.
Output includes:
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.0.0/24 is directly connected, GigabitEthernet0/0
L 10.0.0.1/32 is directly connected, GigabitEthernet0/0
192.168.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/1
L 192.168.1.254/32 is directly connected, GigabitEthernet0/1
S 192.168.2.0/24 [1/0] via 10.0.0.2
Legend:
C = Connected (directly connected)
L = Local (router's own IP)
S = Static (manually configured)
D = Dynamic (learned from routing protocol)
R = RIP, O = OSPF, B = BGP (dynamic protocols)
Routing Methods
There are two main ways routers learn routes and populate their routing tables:
1. Static Routing
What it is:
-
Network engineer/administrator manually configures routes
-
Routes do NOT change automatically
-
Engineer must manually update routes if network changes
Advantages:
-
Simple to understand and implement
-
No overhead (no routing protocol traffic)
-
Secure (no routing information shared automatically)
-
Good for small networks
Disadvantages:
-
Must manually configure every route
-
Doesn't adapt if network fails or changes
-
Not scalable for large networks
-
Time-consuming to maintain
When to use:
-
Small networks (< 10 routers)
-
Point-to-point links (few destinations)
-
Labs and testing
-
When security requires manual control
2. Dynamic Routing
What it is:
-
Routers automatically share routing information with each other
-
Routers learn and update routes automatically
-
Routes adapt when network conditions change
Advantages:
-
Automatic route discovery and updates
-
Adapts to network failures
-
Scalable for large networks
-
Less manual configuration
-
Load balancing across multiple paths
Disadvantages:
-
More complex to configure and understand
-
Uses network bandwidth and CPU (routing protocol overhead)
-
Slower initial convergence
-
Security concerns (routing information shared)
Common Dynamic Routing Protocols:
|
Protocol |
Type |
Purpose |
|
RIP (Routing Information Protocol) |
Distance Vector |
Simple, outdated |
|
OSPF (Open Shortest Path First) |
Link State |
Industry standard, widely used |
|
EIGRP (Enhanced Interior Gateway Routing Protocol) |
Hybrid |
Cisco proprietary, powerful |
|
BGP (Border Gateway Protocol) |
Path Vector |
Internet routing |
When to use:
-
Medium to large networks
-
Complex topologies
-
Multiple paths to destinations
-
Networks with redundancy
-
When automatic failover is needed
WANs (Wide Area Networks)
What is a WAN?
A Wide Area Network (WAN) is a network that extends over a large geographic area — typically connecting multiple locations (cities, countries, or across the Internet).
Characteristics:
-
Connects different LANs together
-
Uses routers to connect
-
Often uses leased lines or Internet as backbone
-
Lower bandwidth and higher latency than LANs
-
Can span great distances
Example WAN Architecture:
[LAN A]
|
Router A ←→ Router B ← WAN Link (Internet or Leased Line)
| |
[LAN B] [LAN C]
Routers A and B are connected via WAN
Each router serves its local LAN
Users in LAN A can reach LAN B/C through routers
LAN vs WAN
|
Feature |
LAN |
WAN |
|
Size |
Single building/floor |
Multiple locations |
|
Speed |
Fast (100 Mbps - 10 Gbps) |
Slower (1-100 Mbps) |
|
Devices |
Switches, local routers |
Routers, modems, firewalls |
|
Latency |
Low (< 1ms) |
Higher (10-100+ ms) |
|
Ownership |
Single organization |
Often shared/rented |
|
Cost |
Lower per Mbps |
Higher per Mbps |
Static Routing Configuration
Basic Static Route Syntax
Router(config)# ip route <destination-network> <subnet-mask> <next-hop-ip>
Components:
-
destination-network — The network you want to reach (e.g., 192.168.2.0)
-
subnet-mask — Netmask of that network (e.g., 255.255.255.0)
-
next-hop-ip — IP address of the next router (e.g., 10.0.0.2)
Example 1: Basic Static Route
Scenario:
-
Router A at 10.0.0.1 needs to reach network 192.168.2.0/24
-
Router B (next-hop) is at 10.0.0.2 on a shared link with Router A
Configuration:
RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
Translation: "To reach 192.168.2.0/24, send packets to my neighbor at 10.0.0.2"
Result in routing table:
S 192.168.2.0/24 [1/0] via 10.0.0.2
Example 2: Multiple Static Routes
Scenario:
Router A needs to reach two different networks:
RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
RouterA(config)# ip route 172.16.0.0 255.255.0.0 10.0.0.3
Result:
-
Packets destined for 192.168.2.x go to 10.0.0.2
-
Packets destined for 172.16.x.x go to 10.0.0.3
Static Route Configuration with Exit Interface
Alternative Syntax (for point-to-point links):
Router(config)# ip route <destination-network> <subnet-mask> <exit-interface>
Example:
RouterA(config)# ip route 192.168.2.0 255.255.255.0 Serial0/0/0
Translation: "To reach 192.168.2.0/24, send out my Serial0/0/0 interface"
When to use:
-
Point-to-point WAN links (Serial, PPP)
-
When only one neighbor on the link
-
More efficient on point-to-point connections
Difference:
|
Method |
Use Case |
|
Next-Hop IP |
Multi-access networks (Ethernet, Frame Relay with many neighbors) |
|
Exit Interface |
Point-to-point links (Serial, PPP) |
Example 3: Next-Hop vs Exit Interface
Next-Hop (for Ethernet):
RouterA(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
↑
specific neighbor IP
Exit Interface (for Serial):
RouterA(config)# ip route 192.168.2.0 255.255.255.0 Serial0/0/0
↑
output interface
Default Route
What is a Default Route?
A default route is a "catch-all" route that handles packets destined for networks the router doesn't have specific routes for.
Use: Send unknown destinations to a central router or ISP gateway
Default Route Configuration
Syntax:
Router(config)# ip route 0.0.0.0 0.0.0.0 <next-hop-ip>
Or in CIDR notation:
Router(config)# ip route 0.0.0.0/0 <next-hop-ip>
Translation: "For any destination I don't have a more specific route for, send to this router"
Common notation: The default route is often written as 0.0.0.0/0 (the "default route")
Example: Setting a Default Route
Scenario:
Small office network with single ISP connection
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
Translation: "For any destination not in my routing table, send to the ISP gateway at 203.0.113.1"
Result:
S* 0.0.0.0/0 [1/0] via 203.0.113.1
* indicates this is the default route
Route Precedence (Most Specific Wins)
When multiple routes match a destination, the router uses the most specific route:
Routing table:
0.0.0.0/0 → 203.0.113.1 (default route)
192.168.2.0/24 → 10.0.0.2 (specific route)
192.168.2.0/25 → 10.0.0.3 (more specific)
Packet destined for:
192.168.2.10 → Uses 192.168.2.0/25 (longest prefix match — /25 most specific)
192.168.3.10 → Uses 0.0.0.0/0 (default — no other match)
172.16.0.1 → Uses 0.0.0.0/0 (default — no other match)
Static Routing Configuration Example
Complete Scenario
Network setup:
[PC A]
|
[Switch]
|
Router A ────WAN Link──── Router B ────[Switch]──── [PC B]
10.0.0.1 (Serial) 10.0.0.2 192.168.1.0/24
Router A is in: 10.0.0.0/24
Router B is in: 10.0.0.0/24 and 192.168.1.0/24
Requirements:
-
PC A (in 10.0.0.0 LAN) needs to reach PC B (in 192.168.1.0 LAN)
-
Need static routes on both routers
Configuration on Router A:
RouterA(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.2
RouterA(config)# end
RouterA# show ip route
S 192.168.1.0/24 [1/0] via 10.0.0.2
Configuration on Router B:
RouterB(config)# ip route 10.0.0.0 255.255.255.0 10.0.0.1
RouterB(config)# end
RouterB# show ip route
S 10.0.0.0/24 [1/0] via 10.0.0.1
Result:
-
Router A knows how to reach 192.168.1.0/24 (sends to Router B)
-
Router B knows how to reach 10.0.0.0/24 (sends to Router A)
-
PC A can now ping and communicate with PC B
Verifying Routes
Check routing table:
Router# show ip route
Test connectivity:
Router# ping 192.168.1.100
Trace packet path:
Router# traceroute 192.168.1.100
Comparison: Static vs Dynamic Routing
When to Use Static Routing
✅ Good for:
-
Small networks (< 10 routers)
-
Simple, stable topologies
-
Point-to-point links
-
High security requirements
-
Lab/testing environments
-
When you want complete control
❌ Not good for:
-
Large networks
-
Complex topologies
-
Frequent topology changes
-
Networks requiring redundancy
-
Automatic failover
When to Use Dynamic Routing
✅ Good for:
-
Large networks (> 10 routers)
-
Complex topologies
-
Multiple paths to destinations
-
Automatic redundancy/failover
-
Networks that change frequently
-
Production enterprise networks
❌ Not good for:
-
Very small networks (overhead not worth it)
-
When bandwidth is extremely limited
-
When security isolation is critical
-
Simple point-to-point links
Static Route Commands Reference
Configuration
|
Command |
Purpose |
|
ip route <dest> <mask> <next-hop> |
Add static route |
|
ip route <dest> <mask> <exit-int> |
Add route via interface |
|
ip route 0.0.0.0 0.0.0.0 <next-hop> |
Configure default route |
|
no ip route <dest> <mask> <next-hop> |
Delete static route |
Verification
|
Command |
Purpose |
|
show ip route |
Display entire routing table |
|
show ip route static |
Show only static routes |
|
show ip route 192.168.1.0 |
Show route for specific destination |
|
ping <ip> |
Test connectivity |
|
traceroute <ip> |
Trace path to destination |
Example Session
Router# configure terminal
Router(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2
Router(config)# ip route 192.168.3.0 255.255.255.0 10.0.0.2
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
Router(config)# exit
Router# show ip route
10.0.0.0/24 is directly connected, GigabitEthernet0/0
S 192.168.2.0/24 [1/0] via 10.0.0.2
S 192.168.3.0/24 [1/0] via 10.0.0.2
S* 0.0.0.0/0 [1/0] via 203.0.113.1
Router# ping 192.168.2.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echoes to 192.168.2.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/5 ms
Key Differences: Switches vs Routers in Network
|
Feature |
Switch |
Router |
|
Layer |
Layer 2 (Data Link) |
Layer 3 (Network) |
|
Forwards within/between |
Within LANs |
Between LANs/Networks |
|
Uses |
MAC addresses |
IP addresses |
|
Table |
MAC address table |
Routing table |
|
Decision |
Destination MAC |
Destination IP |
|
Broadcasts |
Floods to all ports |
Blocks/filters |
|
Default behavior |
Active |
Interfaces down by default |
Key Takeaways for CCNA
✅ Routing is how packets move between different networks using destination IP addresses
✅ Routing table stores all known routes; router uses it for forwarding decisions
✅ Static routing = manual configuration; good for small, stable networks
✅ Dynamic routing = automatic discovery; good for large, complex networks
✅ WAN connects separate LANs over large geographic distances
✅ Default route (0.0.0.0/0) catches packets with no other matching route
✅ Static route syntax: ip route <destination> <mask> <next-hop-ip>
✅ Exit interface method used for point-to-point links; next-hop method for multi-access
✅ Routes point to next-hop IP or exit interface — tells router where to send packets
✅ Most specific route wins when multiple routes match a destination (longest prefix match)
✅ Router must have routes in both directions for bidirectional communication
✅ Directly connected routes appear as 'C' in routing table; don't need to be configured
✅ Local routes (L) are the router's own IP addresses; handled automatically
✅ show ip route displays routing table; includes source and metric information
✅ Routers separate broadcast domains — broadcasts don't cross router interfaces