How Routers Forward Packets
A router examines the destination IP address of each incoming packet and consults its routing table to determine the best path. The routing table contains network prefixes, the next-hop address or exit interface, and the metric (cost) of each route.
Routing Table Sources
- Directly connected routes: Added automatically when an interface is configured with an IP address and is in an up/up state.
- Static routes: Manually configured by an administrator using the
ip routecommand. A default static route (0.0.0.0/0) forwards packets with no more specific match. - Dynamic routes: Learned automatically via routing protocols such as OSPF (Open Shortest Path First), EIGRP, or RIP.
Administrative Distance (AD)
When a router learns about the same destination from multiple sources, it uses Administrative Distance to select the most trusted source. Lower AD is preferred.
- Directly connected: AD 0
- Static route: AD 1
- OSPF: AD 110
- EIGRP: AD 90
- RIP: AD 120
Longest Prefix Match
When multiple routes match a destination, the router selects the route with the longest (most specific) prefix. For example, a /28 route is preferred over a /24 route for the same destination address.
OSPFv2 Basics (Single Area)
OSPF is a link-state routing protocol that uses cost (based on interface bandwidth) as its metric. Key points for CCNA:
- Router ID is the highest loopback IP or highest active interface IP if no loopback exists, or manually configured.
- Neighbors form adjacencies by exchanging Hello packets on the same subnet with matching Hello/Dead timers, area ID, and subnet mask.
- The
networkcommand with wildcard mask, orip ospfinterface command, enables OSPF on interfaces. - Default reference bandwidth is 100 Mbps; FastEthernet and higher interfaces may share the same cost unless the reference bandwidth is adjusted.
Verifying IP Connectivity
show ip route— displays the routing table.show ip ospf neighbor— verifies OSPF adjacencies.pingandtraceroute— test reachability and identify hops.
Understanding how these components interact allows you to configure and troubleshoot routed networks, which is a core skill tested on the CCNA exam.