๐ฏ Meet the Network's Mail Sorter
If switches are like smart bus drivers who know all the local neighborhoods, then routers are like postal workers who connect different cities. They read IP addresses like postal codes and make intelligent decisions about the best path to deliver your data packages to distant networks.
๐ฏ Chapter Goals: Understand router operation, master routing tables, configure static routes, learn inter-VLAN routing, and connect different networks like a professional mail sorter!
๐ฌ Router vs Switch: The Key Differences
Understanding the difference between routers and switches is crucial for network design:
๐ Switch (Layer 2 - Local Bus Driver)
- Operates at: Layer 2 (Data Link)
- Reads: MAC addresses (hardware addresses)
- Scope: Single broadcast domain/VLAN
- Function: Forward frames within same network
- Learning: MAC address table from source addresses
- Analogy: Bus driver in one city
๐ฎ Router (Layer 3 - Postal Worker)
- Operates at: Layer 3 (Network)
- Reads: IP addresses (logical addresses)
- Scope: Multiple networks/subnets
- Function: Route packets between different networks
- Learning: Routing table with network destinations
- Analogy: Postal worker connecting cities
Why We Need Both
SwitchesHandle local delivery within the same network segment
RoutersHandle delivery between different network segments
Working TogetherSwitches connect devices locally, routers connect networks globally
Internet ConnectionYour router connects your local network to the internet
๐ง Memory Trick: Switches = Same neighborhood, Routers = Remote destinations!
๐ IP Address Review: The Postal System
Before diving into routing, let's quickly review IP addresses using our postal analogy:
IP Address Structure
192.168.1.100 / 24
192
.
168
.
1
.
100
Network: 192.168.1.0/24 | Host: .100
Postal Analogy Breakdown
Network PortionLike the city and state (192.168.1.0) - tells router which neighborhood
Host PortionLike the house number (.100) - identifies specific device
Subnet MaskLike postal zone boundaries - defines network vs host portions
Default GatewayLike the local post office - router that handles "out of town" mail
Different Networks Example
Sales Network
192.168.10.0/24
Devices: .1 to .254
Engineering Network
192.168.20.0/24
Devices: .1 to .254
Server Network
192.168.100.0/24
Devices: .1 to .254
๐ฎ Key Point: Devices in different networks (192.168.10.x vs 192.168.20.x) need a router to communicate!
๐บ๏ธ The Routing Table: Router's Address Book
The routing table is like a postal worker's address book - it tells the router where to send packets for different destination networks:
Routing Table Components
Destination NetworkThe network address and subnet mask (where mail is going)
Next HopThe IP address of the next router in the path
Outgoing InterfaceWhich router interface to use for this destination
Administrative DistanceTrustworthiness of the route source (lower = better)
MetricCost of the route (lower = preferred path)
Types of Routes
C
Connected Routes
Networks directly attached to router interfaces (automatic)
S
Static Routes
Manually configured routes (admin defines the path)
D
Dynamic Routes
Learned from routing protocols (OSPF, EIGRP, RIP)
*
Default Route
Catch-all route for unknown destinations (usually to internet)
Sample Routing Table
Router# show ip route
C 192.168.10.0/24 is directly connected, Fa0/0
C 192.168.20.0/24 is directly connected, Fa0/1
S 192.168.100.0/24 [1/0] via 10.1.1.2
S* 0.0.0.0/0 [1/0] via 203.0.113.1
Legend:
C = Connected, S = Static, * = Default Route
[1/0] = [Administrative Distance/Metric]
โ๏ธ Basic Router Configuration
Initial Router Setup
Router>
enable
Router#
configure terminal
Router(config)#
hostname Gateway-Router
Gateway-Router(config)#
enable secret cisco123
Gateway-Router(config)#
line console 0
Gateway-Router(config-line)#
password console123
Gateway-Router(config-line)#
login
Gateway-Router(config-line)#
exit
Interface Configuration
Gateway-Router(config)#
interface fastethernet 0/0
Gateway-Router(config-if)#
description LAN-Sales-Network
Gateway-Router(config-if)#
ip address 192.168.10.1 255.255.255.0
Gateway-Router(config-if)#
no shutdown
Gateway-Router(config-if)#
exit
Gateway-Router(config)#
interface fastethernet 0/1
Gateway-Router(config-if)#
description LAN-Engineering-Network
Gateway-Router(config-if)#
ip address 192.168.20.1 255.255.255.0
Gateway-Router(config-if)#
no shutdown
Gateway-Router(config-if)#
exit
Gateway-Router(config)#
interface serial 0/0/0
Gateway-Router(config-if)#
description WAN-Link-to-ISP
Gateway-Router(config-if)#
ip address 203.0.113.2 255.255.255.252
Gateway-Router(config-if)#
no shutdown
Gateway-Router(config-if)#
exit
Static Route Configuration
Gateway-Router(config)#
ip route 192.168.100.0 255.255.255.0 10.1.1.2
# Route to server network via next-hop 10.1.1.2
Gateway-Router(config)#
ip route 0.0.0.0 0.0.0.0 203.0.113.1
# Default route - send all unknown traffic to ISP
Gateway-Router(config)#
ip route 172.16.0.0 255.255.0.0 serial 0/0/1
# Route via outgoing interface instead of next-hop IP
๐ง Router Interfaces: Unlike switches, router interfaces are shutdown by default - always use "no shutdown" to activate them!
๐ Router Verification Commands
Routing Table Commands
Router#
show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 203.0.113.1 to network 0.0.0.0
C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, FastEthernet0/1
S 192.168.100.0/24 [1/0] via 10.1.1.2
C 203.0.113.0/30 is directly connected, Serial0/0/0
S* 0.0.0.0/0 [1/0] via 203.0.113.1
Router#
show ip route connected
C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, FastEthernet0/1
C 203.0.113.0/30 is directly connected, Serial0/0/0
Router#
show ip route static
S 192.168.100.0/24 [1/0] via 10.1.1.2
S* 0.0.0.0/0 [1/0] via 203.0.113.1
Interface Status Commands
Router#
show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.10.1 YES manual up up
FastEthernet0/1 192.168.20.1 YES manual up up
Serial0/0/0 203.0.113.2 YES manual up up
Serial0/0/1 unassigned YES unset administratively down down
Router#
show interfaces fastethernet 0/0
FastEthernet0/0 is up, line protocol is up
Hardware is AmdFE, address is 0013.197b.5004 (bia 0013.197b.5004)
Description: LAN-Sales-Network
Internet address is 192.168.10.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, media type is RJ45
Connectivity Testing
Router#
ping 192.168.20.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Router#
traceroute 8.8.8.8
Type escape sequence to abort.
Tracing the route to 8.8.8.8
1 203.0.113.1 12 msec 8 msec 12 msec
2 10.1.1.1 16 msec 16 msec 16 msec
3 8.8.8.8 24 msec * 28 msec
๐ Inter-VLAN Routing
Remember our separate VLAN rooms from Chapter 6? By default, devices in different VLANs can't communicate. Inter-VLAN routing is like hiring a translator who can move between rooms and deliver messages:
The Problem
VLAN IsolationDevices in VLAN 10 cannot communicate with devices in VLAN 20
Layer 2 LimitationSwitches operate at Layer 2 and respect VLAN boundaries
Need Layer 3Routing between VLANs requires Layer 3 processing
Inter-VLAN Routing Methods
๐ Router-on-a-Stick
- Setup: Single router interface connects to switch
- Trunk Link: Carries multiple VLANs using 802.1Q tags
- Subinterfaces: Logical interfaces for each VLAN
- Cost: Single router interface used
- Limitation: Bandwidth shared among all VLANs
๐ฅ๏ธ Layer 3 Switch (SVI)
- Setup: Switch with routing capabilities
- Switch Virtual Interfaces: VLAN interfaces on switch
- Performance: Hardware-based routing
- Cost: More expensive than basic switch
- Benefit: High-speed inter-VLAN routing
Router-on-a-Stick Configuration
Router(config)#
interface fastethernet 0/0
Router(config-if)#
description Trunk-to-Switch
Router(config-if)#
no shutdown
Router(config-if)#
exit
Router(config)#
interface fastethernet 0/0.10
Router(config-subif)#
description Sales-VLAN-Gateway
Router(config-subif)#
encapsulation dot1Q 10
Router(config-subif)#
ip address 192.168.10.1 255.255.255.0
Router(config-subif)#
exit
Router(config)#
interface fastethernet 0/0.20
Router(config-subif)#
description Engineering-VLAN-Gateway
Router(config-subif)#
encapsulation dot1Q 20
Router(config-subif)#
ip address 192.168.20.1 255.255.255.0
Router(config-subif)#
exit
Layer 3 Switch (SVI) Configuration
L3-Switch(config)#
ip routing
# Enable routing functionality on the switch
L3-Switch(config)#
interface vlan 10
L3-Switch(config-if)#
ip address 192.168.10.1 255.255.255.0
L3-Switch(config-if)#
no shutdown
L3-Switch(config-if)#
exit
L3-Switch(config)#
interface vlan 20
L3-Switch(config-if)#
description Engineering-SVI
L3-Switch(config-if)#
ip address 192.168.20.1 255.255.255.0
L3-Switch(config-if)#
no shutdown
L3-Switch(config-if)#
exit
๐ Key Point: Each VLAN needs its own gateway IP address for inter-VLAN routing to work!
๐ฃ๏ธ The Routing Process Step-by-Step
Let's follow a packet's journey from one network to another, like tracking a package through the postal system:
Routing Decision Process
Scenario: PC in 192.168.10.0/24 sends to 192.168.20.100
๐ฅ๏ธ
PC checks: "Is 192.168.20.100 in my local subnet?" No! Need default gateway.
๐ฆ
PC sends frame to router MAC address but with destination IP 192.168.20.100
๐
Router receives frame, strips Layer 2 header, examines destination IP
๐
Router checks routing table: "192.168.20.0/24 is directly connected!"
๐ฏ
Router forwards packet out Fa0/1 interface to destination network
โ
Packet reaches 192.168.20.100 successfully!
Longest Prefix Match
When multiple routes could match a destination, routers use the most specific (longest prefix) route:
Routing Table Example:
192.168.0.0/16 via 10.1.1.1 (less specific)
192.168.10.0/24 via 10.1.1.2 (more specific)
0.0.0.0/0 via 203.0.113.1 (default route)
Destination: 192.168.10.50
โ Matches all three routes
โ Router chooses 192.168.10.0/24 (longest prefix)
โ Forwards via 10.1.1.2
Administrative Distance
When multiple routing sources provide the same destination, administrative distance determines trustworthiness:
Connected - 0
Most trusted (directly attached)
Static - 1
Admin-configured routes
EIGRP - 90
Cisco proprietary protocol
OSPF - 110
Open standard protocol
RIP - 120
Least trusted (legacy protocol)
๐ ๏ธ Hands-On Router Labs
Lab 1: Basic Router Configuration
- Topology Setup:
- Add router with two FastEthernet interfaces
- Connect two switches to router interfaces
- Add PCs to each switch in different subnets
- Configure Router:
- Set hostname and passwords
- Configure Fa0/0 for 192.168.10.1/24
- Configure Fa0/1 for 192.168.20.1/24
- Enable both interfaces with "no shutdown"
- Test Connectivity:
- Ping from router to PCs in both networks
- Set PC default gateways to router IPs
- Test inter-network communication
Lab 2: Static Routing
- Extended Topology:
- Add second router connected via serial link
- Create third network (192.168.30.0/24) behind second router
- Document all network addresses and connections
- Configure Static Routes:
- Router1: Route to 192.168.30.0/24 via Router2
- Router2: Route to 192.168.10.0/24 and 192.168.20.0/24 via Router1
- Configure default routes pointing to ISP
- Verification:
- Use "show ip route" to verify routing table
- Test end-to-end connectivity with ping
- Use traceroute to verify path taken
Lab 3: Inter-VLAN Routing
- VLAN Setup:
- Configure switch with VLAN 10 and VLAN 20
- Assign switch ports to different VLANs
- Configure trunk port to router
- Router-on-a-Stick:
- Configure subinterfaces on router
- Set up 802.1Q encapsulation for each VLAN
- Assign IP addresses to subinterfaces
- Test Inter-VLAN Communication:
- Verify devices in same VLAN can communicate
- Test routing between different VLANs
- Confirm VLAN isolation is maintained
Lab 4: Troubleshooting Routing Issues
- Create Problems:
- Misconfigure static routes
- Use wrong subnet masks
- Forget to enable interfaces
- Configure duplicate IP addresses
- Practice Troubleshooting:
- Use systematic approach with show commands
- Check physical layer first
- Verify IP addressing and routing
- Test connectivity methodically
๐ฏ Challenge Lab: Build a network with 4 routers in different cities, each with local LANs, and configure static routing so all networks can communicate.
๐จ Router Troubleshooting Guide
Common Router Problems and Solutions
Problem: Can't reach remote network
Local network works fine, but can't ping remote destinations
Check These:
โ Routing table has route to destination
โ Next-hop router is reachable
โ Return path exists (routing is bidirectional)
โ Default route configured for unknown destinations
Problem: Interface shows up/down
Physical layer up but data link layer down
Investigate:
โ Layer 2 protocol mismatch (PPP vs HDLC)
โ Authentication failures on WAN links
โ Keepalive mismatches
โ Clock rate issues on serial links
Problem: Inter-VLAN routing not working
Devices in different VLANs can't communicate
Verify:
โ Switch trunk configuration allows VLANs
โ Router subinterface encapsulation matches VLAN
โ PC default gateways point to router
โ VLANs exist on switch
Router Troubleshooting Command Sequence
Step 1: Check physical interfaces
show ip interface brief
Step 2: Examine routing table
show ip route
Step 3: Test connectivity
ping [destination]
traceroute [destination]
Step 4: Check specific interface
show interfaces [interface]
Step 5: Verify ARP table
show arp
Interface Status Meanings
up/up
Interface working perfectly
up/down
Physical OK, data link problem
down/down
No physical connection
admin down
Interface disabled (shutdown)
Routing Table Troubleshooting
Missing RoutesCheck if static routes are configured or routing protocol is working
Wrong Next HopVerify next-hop IP address is reachable and correct
Conflicting RoutesCheck administrative distance - lower wins
No Default RouteConfigure default route for internet/unknown destinations
โก Router Best Practices
Network Design Principles
Hierarchical DesignUse core, distribution, and access layers for scalability
RedundancyProvide multiple paths for critical connections
SecurityPlace routers at network boundaries for access control
DocumentationMaintain current network diagrams and addressing schemes
IP Addressing Best Practices
Consistent SchemesUse logical, predictable IP addressing plans
VLSMVariable Length Subnet Masking for efficient address utilization
Reserved AddressesDocument and reserve addresses for infrastructure
Private AddressingUse RFC 1918 addresses internally (10.x, 172.16-31.x, 192.168.x)
Configuration Management
Consistent NamingUse descriptive hostnames and interface descriptions
Configuration BackupRegularly save and backup device configurations
Change ControlDocument all network changes with rollback plans
MonitoringImplement network monitoring for proactive management
Security Considerations
Access ControlUse ACLs to control traffic flow between networks
Strong PasswordsUse complex passwords and enable password encryption
Remote AccessSecure remote management with SSH instead of Telnet
Firmware UpdatesKeep IOS versions current for security patches
๐ Chapter Summary
- Router Function: Layer 3 devices that route packets between different networks
- Routing Table: Contains network destinations, next hops, and outgoing interfaces
- Route Types: Connected (automatic), Static (manual), Dynamic (protocol-learned)
- Default Route: Catch-all route for unknown destinations (usually internet)
- Inter-VLAN Routing: Router-on-stick or Layer 3 switch methods
- Longest Prefix Match: Most specific route wins when multiple routes match
- Administrative Distance: Trustworthiness ranking for route sources
- Configuration: Interface IPs, static routes, subinterfaces for VLANs
๐ฏ Routing Mastery Achieved! You now understand how routers connect the world's networks. From local VLANs to the global internet, you've got the postal system of networking!
๐ Router Mastery Quiz
1. What's the main difference between switches and routers? Switches operate at Layer 2 with MAC addresses for local delivery; routers operate at Layer 3 with IP addresses for inter-network routing
2. What information does a routing table contain? Destination networks, next-hop IP addresses, outgoing interfaces, administrative distance, and metrics
3. What is a default route and when is it used? A catch-all route (0.0.0.0/0) used when no specific route exists for a destination, typically pointing to the internet
4. How does longest prefix match work? When multiple routes match a destination, the router chooses the route with the longest subnet mask (most specific)
5. What's the purpose of administrative distance? It ranks the trustworthiness of route sources - lower values are preferred (Connected=0, Static=1, OSPF=110)
6. What are the two main methods for inter-VLAN routing? Router-on-a-stick (subinterfaces with 802.1Q) and Layer 3 switch with SVIs (Switch Virtual Interfaces)
7. Why must router interfaces be manually enabled? Unlike switch ports, router interfaces are administratively shutdown by default and require "no shutdown" command
8. What happens when a router receives a packet for an unknown destination? If a default route exists, the packet is forwarded there; otherwise, it's dropped and an ICMP unreachable message is sent
๐ Fantastic! You've mastered the fundamentals of routing and inter-network communication. Ready to learn how routing protocols automate the process?
Comments