Chapter 8

๐Ÿ“ฎ Router Basics - The Post Office Worker

By Sys-Metricsยท ยท 60 min chapter

๐ŸŽฏ 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

Switches

Handle local delivery within the same network segment

Routers

Handle delivery between different network segments

Working Together

Switches connect devices locally, routers connect networks globally

Internet Connection

Your 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 Portion

Like the city and state (192.168.1.0) - tells router which neighborhood

Host Portion

Like the house number (.100) - identifies specific device

Subnet Mask

Like postal zone boundaries - defines network vs host portions

Default Gateway

Like 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 Network

The network address and subnet mask (where mail is going)

Next Hop

The IP address of the next router in the path

Outgoing Interface

Which router interface to use for this destination

Administrative Distance

Trustworthiness of the route source (lower = better)

Metric

Cost 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 Isolation

Devices in VLAN 10 cannot communicate with devices in VLAN 20

Layer 2 Limitation

Switches operate at Layer 2 and respect VLAN boundaries

Need Layer 3

Routing 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

  1. Topology Setup:
    • Add router with two FastEthernet interfaces
    • Connect two switches to router interfaces
    • Add PCs to each switch in different subnets
  2. 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"
  3. 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

  1. 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
  2. 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
  3. 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

  1. VLAN Setup:
    • Configure switch with VLAN 10 and VLAN 20
    • Assign switch ports to different VLANs
    • Configure trunk port to router
  2. Router-on-a-Stick:
    • Configure subinterfaces on router
    • Set up 802.1Q encapsulation for each VLAN
    • Assign IP addresses to subinterfaces
  3. 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

  1. Create Problems:
    • Misconfigure static routes
    • Use wrong subnet masks
    • Forget to enable interfaces
    • Configure duplicate IP addresses
  2. 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 Routes

Check if static routes are configured or routing protocol is working

Wrong Next Hop

Verify next-hop IP address is reachable and correct

Conflicting Routes

Check administrative distance - lower wins

No Default Route

Configure default route for internet/unknown destinations

โšก Router Best Practices

Network Design Principles

Hierarchical Design

Use core, distribution, and access layers for scalability

Redundancy

Provide multiple paths for critical connections

Security

Place routers at network boundaries for access control

Documentation

Maintain current network diagrams and addressing schemes

IP Addressing Best Practices

Consistent Schemes

Use logical, predictable IP addressing plans

VLSM

Variable Length Subnet Masking for efficient address utilization

Reserved Addresses

Document and reserve addresses for infrastructure

Private Addressing

Use RFC 1918 addresses internally (10.x, 172.16-31.x, 192.168.x)

Configuration Management

Consistent Naming

Use descriptive hostnames and interface descriptions

Configuration Backup

Regularly save and backup device configurations

Change Control

Document all network changes with rollback plans

Monitoring

Implement network monitoring for proactive management

Security Considerations

Access Control

Use ACLs to control traffic flow between networks

Strong Passwords

Use complex passwords and enable password encryption

Remote Access

Secure remote management with SSH instead of Telnet

Firmware Updates

Keep 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

Comments