Module 057 min

Crossing the world

No router knows the way to the destination. Each one knows one thing: which neighbour is closer. That is enough to cross the planet.

After this module
  • You can read a routing table and predict which of two routes a router will choose.
  • You can explain why a leftover static route beats a working dynamic protocol without any error.

A packet leaves your laptop addressed to a server 6,000 km away. Your router does not have a map of the world. It has a table with a few dozen entries, most of them starting with "if it is not mine, send it to the provider".

The journey works because every router makes one small decision, repeatedly, and because 80,000 independent networks have agreed to forward each other's traffic.

5.1Three columns and one rule

A routing table entry has a destination prefix, a next hop, and an interface. The lookup rule is longest prefix match: among all entries that match, the most specific one wins — before any metric, cost or preference.

MOST SPECIFIC WINS router two routes isp A default 0.0.0.0/0 isp B 203.0.113.0/24 the destination 203.0.113.7 matches matches chosen both routes match the destination
Both routes match 203.0.113.7. The /24 wins because it is more specific, even if the other path is faster, cheaper, or the one you designed.
A small table. The destination column is what matters, not the order.
DestinationNext hopNotes
192.168.1.0/24directly connectedLocal delivery, no router
10.20.0.0/1610.0.0.2Site-to-site link
203.0.113.0/24198.51.100.9A partner network, specific
0.0.0.0/0198.51.100.1Default: everything else
Try it · which route wins?four destinations

5.2What a hop actually does

The router receives a frame, discards the link header, reads the destination IP, looks it up, finds the next hop, resolves the next hop's hardware address, builds a new frame, and transmits. TTL decreases by one at each hop; at zero the packet is dropped and an ICMP "time exceeded" comes back.

That TTL behavior is the entire mechanism behind traceroute: send a packet with TTL 1, the first router drops it and reports itself; send with TTL 2, the second router reports; repeat. The path you see is a list of routers that were willing to talk.

traceroute example.com      # macOS/Linux; use tracert on Windows
mtr -rw example.com         # repeated probes, with loss per hop
ip route get 203.0.113.7    # which route this host would use

A star (* * *) in traceroute is not a broken hop. It is a router configured not to answer — common, and usually harmless. Loss that appears at one hop and continues to every later hop is real; loss at one hop that does not continue is the router rate-limiting its own error replies.

5.3Providers, autonomous systems, and trust

Inside one organization, routers share routes with an interior protocol — OSPF or IS-IS — which floods a map of the network and computes shortest paths. Between organizations, they use BGP, and BGP works on policy rather than distance.

An autonomous system is a network under one administration with a number (an ASN). It announces the address ranges it can reach, and each neighbour decides whether to believe it, and whether to prefer it over another path. The path itself is carried as a list of AS numbers, so a router can spot its own number in a route and reject the loop.

The trap · one bad announcement

BGP has no built-in proof of ownership. If a network announces an address range it does not own, the rest of the internet may simply believe it — and traffic for those addresses travels to the wrong place and disappears. This is a prefix hijack, and it has caused national outages. A related mistake is a route leak: a customer re-announces a provider's routes, pulling a large share of global traffic through a network that cannot carry it. Cryptographic signing of announcements (RPKI) exists, and deployment is incomplete.

5.4The leftover route

Routers prefer the most trustworthy source when two protocols know the same prefix: connected first, then static, then learned protocols. On most vendors a static route has administrative distance 1 and OSPF has 110, so a static route wins silently.

That is how a decommissioned link keeps taking traffic: a static route added for a migration stays in the configuration for years, and the only evidence is a route that does not match the diagram. When traffic goes the wrong way and every protocol is "up", read the routing table before the topology.

Check yourselfQuestion 1 of 1

A router has 0.0.0.0/0 via ISP A (static) and 203.0.113.0/24 via ISP B (OSPF). Where does traffic for 203.0.113.55 go?

60-second recap

  • Longest prefix wins first. Metric and preference only break ties between identical prefixes.
  • Each router knows one hop. TTL and traceroute turn that into a visible path.
  • BGP runs on policy and trust. A wrong announcement can take down someone else's network.