IP routing is the process of sending data packets from one device to another across different networks. Routers use routing tables to guide packets toward their destination based on network addresses, neighboring routers, possible paths, and route metrics.
Routers build routing tables through two methods:
Router_A#show ip route
Gateway of last resort is not set
C 10.10.10.0/24 is directly connected, FastEthernet0/0
C 10.10.20.0/24 is directly connected, FastEthernet0/1
C 10.10.30.0/24 is directly connected, FastEthernet0/2
C 10.10.40.0/24 is directly connected, Serial 0/0
Example: Host_A (172.16.10.2) pings Host_B (172.16.20.2)
- ICMP Echo Request is formed
- IP header created with source/destination IP
- Packet is checked: remote or local network
- Gateway address is looked up
- MAC address resolution via ARP
- ARP command example:
arp -a
Interface: 172.16.10.2 --- 0x3
Internet Address Physical Address Type
172.16.10.1 00-15-05-06-31-b0 dynamic
Frame is built with destination MAC and transmitted physically.
- Collision domain receives frame
- CRC and MAC are checked
- IP extracts the packet
- Routing table is searched:
Lab_A#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.10.0 is directly connected, Ethernet0
C 172.16.20.0 is directly connected, Ethernet1
- Best route via Ethernet1 is selected
- MAC address of Host_B is resolved:
Lab_A#show ip arp
Protocol Address Age(min) Hardware Addr Type Interface
Internet 172.16.20.2 3 0030.9492.a5dd ARPA Ethernet1
New frame is created and sent out.
Packet flows back from Host_B to Host_A, repeating ARP and routing steps in reverse.
Command Example:
Router_A(config)#ip route 172.16.30.0 255.255.255.0 172.16.40.2
Popular protocols: RIP, OSPF, EIGRP
Dynamic protocols are split into:
| Protocol | Type | Scalability | Complexity | Use Case |
|---|---|---|---|---|
| RIP | Distance-Vector | Low | Simple | Small networks |
| OSPF | Link-State | High | Complex | Enterprise networks |
| EIGRP | Hybrid | High | Moderate | Cisco environments |
Routing Table:
C 10.10.10.0/24 → FastEthernet0/0
C 10.10.20.0/24 → FastEthernet0/1
Destination 10.10.10.14 → sent via FastEthernet0/0
Routing Table:
C 10.10.10.16/28 → FastEthernet0/0
C 10.10.10.8/29 → FastEthernet0/1
C 10.10.10.4/30 → FastEthernet0/2
Destination 10.10.10.14 → sent via FastEthernet0/1
Note: Switches operate at Layer 2 and don't affect routing decisions.