Study reference

Routing Cheat Sheet

How routers choose routes, administrative distance, static routes and how to read the routing table.

1. How a router chooses a route

  1. Longest prefix match first. The most specific matching route wins (a /26 beats a /24 beats 0.0.0.0/0).
  2. Lowest administrative distance (AD) decides between routes to the same prefix from different sources.
  3. Lowest metric decides between routes from the same routing protocol.
  4. If routes tie, the router may load-balance across them (equal-cost paths).

2. Default administrative distance (Cisco)

Route sourceDefault AD
Connected interface0
Static route1
EIGRP summary route5
External BGP (eBGP)20
EIGRP (internal)90
OSPF110
IS-IS115
RIP120
EIGRP (external)170
Internal BGP (iBGP)200
Unknown or unreachable255 (not used)

A lower number is more trusted. A floating static route is a static route given a higher AD than the dynamic protocol (for example 150), so it is used only when the dynamic route disappears.

3. Routing protocol families

ProtocolTypeMetricNotes
RIP (v2)Distance vectorHop count (15 max, 16 = unreachable)UDP port 520. Simple, slow to converge. Small labs only.
EIGRPAdvanced distance vector (DUAL)Composite; bandwidth and delay by defaultCisco-developed; informational RFC 7868. Multicast 224.0.0.10.
OSPFLink stateCost (based on bandwidth)Open standard, areas, IP protocol 89. See the OSPF sheet.
IS-ISLink stateMetric per linkCommon in service-provider networks.
BGPPath vectorPath attributes (not a single metric)Between organisations, TCP port 179. See the BGP sheet.

IGP = routing inside one organisation (RIP, EIGRP, OSPF, IS-IS). EGP = routing between organisations (BGP today).

4. Static routes

! Route to a remote network through a next-hop address
ip route 10.2.0.0 255.255.0.0 192.168.1.2

! Default route (everything else)
ip route 0.0.0.0 0.0.0.0 192.168.1.1

! Floating static route: backup, used only if AD 110 route is lost
ip route 10.2.0.0 255.255.0.0 192.168.2.2 150

! A multilayer switch must have routing switched on
ip routing

5. Reading show ip route

Codes: C - connected, L - local, S - static, R - RIP, D - EIGRP,
       O - OSPF, B - BGP, * - candidate default

O    10.2.0.0/16 [110/20] via 192.168.1.2, 00:05:12, GigabitEthernet0/1
                  ^   ^
                  |   metric
                  administrative distance

Useful variations: show ip route 10.2.0.5 (the route used for one address), show ip route ospf, show ip route static, show ip protocols.

6. When a route is missing: check in this order

  1. Is the interface up/up and does it have the right address and mask? (show ip interface brief)
  2. Does the router have a route to the destination, and is it the one you expect? (show ip route <address>)
  3. Is the next hop reachable? (ping the next hop first)
  4. For dynamic routing: is the neighbour up and are the networks advertised? (show ip protocols, the protocol's neighbour command)
  5. Is an access list, firewall or NAT rule blocking the traffic? Does the return path exist too?

More cheat sheets

Sources

This page is for study. Please confirm important details against the original standards and vendor documents.