Networking Tutorials

The Routing Table Explained: How Routers Decide

The routing table is the router's decision map: every known destination network, how it was learned, and where to forward matching packets. Understanding how entries get in — and the exact order used to pick between them — is the very core of routing.

How routes enter the table

  • Connected (C) — networks on the router's own up interfaces, automatic
  • Static (S) — manually configured by an admin
  • Dynamic (O, D, B…) — learned via OSPF, EIGRP, BGP from neighbours

Each candidate route carries an administrative distance (trust ranking of its source) and a metric (the protocol's cost measure).

The selection order — get this exact

  1. Longest prefix match — the most specific matching network wins (a /28 beats a /24 beats a /16 for an address they all contain)
  2. Administrative distance — among equal prefixes from different sources, lowest AD wins (static 1 beats OSPF 110)
  3. Metric — among equal prefixes within one protocol, best metric wins

This ordering — match length first, then trust, then cost — is the most misunderstood point and a guaranteed exam trap.

Reading it in practice

show ip route shows the table: codes (C/S/O/D), [AD/metric] pairs, next hops and exit interfaces. If no entry matches a destination and no default route exists, the packet is dropped with an ICMP unreachable — "not in the table" is the first thing to rule out in any reachability troubleshoot.

Frequently asked questions

How does a router choose between multiple matching routes?

Longest prefix match first (most specific network), then lowest administrative distance among equal prefixes, then best metric within the winning protocol.

What do the codes in a routing table mean?

How each route was learned: C connected, L local, S static, O OSPF, D EIGRP, B BGP — with S* marking a static default route.

What happens if no route matches a packet's destination?

Without a default route, the router drops the packet and typically sends an ICMP destination-unreachable back to the source.

What do the numbers in brackets like [110/2] mean?

[Administrative distance / metric] — the trust ranking of the route's source and the protocol's cost for that path.

VS
Vipul Sir — Lead Instructor, Attila Technologies20+ years in Cisco networking. Teaching CCNA, CCNP, CCIE & CyberOps in Ahmedabad since 2004.

Want hands-on training?

Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.

Start your networking career with Attila Technologies

Hands-on Cisco training, real lab devices and placement support in Ahmedabad.