Old-School Networking / 2026 ・ No.05

Old-School Networking

Part 5: Routers — routing tables, TTL, traceroute, and what your “home router” really is

Published

The Wireshark window showing a traceroute: UDP packets from the PC to 203.0.113.20 alternate with ICMP Time-to-live exceeded messages from 192.168.1.1, 198.51.100.1, 198.51.100.6 and 198.51.100.10, then Destination unreachable (Port unreachable) from the server. Packet 6 is selected; the details show Type: 11 (Time-to-live exceeded) and, inside it, the original IPv4 and UDP headers
A traceroute recording. Packet 6 is the time-exceeded notice from the second router, r2 (198.51.100.1), and it carries the headers of the packet that expired (from 192.168.1.10 to 203.0.113.20, port 33435) (Recorded on 25 October 2026 on a practice network the author built in the cloud and opened in Wireshark 4.2.2. The bar across the top of the window and the headings were added for the illustration.)

In part 4 we got as far as: if the destination is on another network, hand it to the router. This time: what does that router do with it?
We build a practice network with four routers, read routing tables, trace the path with traceroute, and send a packet round in circles on purpose.
The second half is about the box at home called a “router” (it's mostly NAT), and how the world's networks tell each other the way (BGP).

1

The direction-giving layer

AraiA router's the white box at home with the antennas, right? The one with the blinking lights.

FuruiThat's a router too, but that box has about seven jobs crammed into it. Only one of them is actually routing.

AraiWait, what are the other six doing?

FuruiSecond half. First, the real job: giving directions. I've lined up four routers.

The 12-part route map (you are here: part 5)

1 Big picture 2 Physical 3 Data link 4 IP addresses 5 Routers 6 TCP 7 UDP, sockets 8 TLS 9 DNS 10 HTTP 11 Dev networks 12 Troubleshoot You are here Overview Layer 1 Layer 2 Layer 3 Layer 4 Layers 5-6 Layer 7 Practice
  • What a router does — receive, look up, decrement the TTL, pass it on
  • Routing tables and traceroute — the longest match, the TTL, and mapping a path (measured)
  • ICMP — notices like “time exceeded” and “no route to that network”
  • The home router — NAT rewrites addresses. What happens without it, and from outside (measured)
  • The internet — ASes, BGP, and about 1.07 million routes

This part's practice network is a single road: from the home (Arai's PC and the home router r1), through the provider's r2, a transit network's r3 and the data centre's r4, to the server that receives the submission. Addresses have changed from part 4's 10.0.x.x to a more home-like 192.168.1.10.

The practice road: four routers, five networks

home provider transit data centre pc Arai's PC r1 router 1 r2 2 r3 3 r4 4 srv server 5 192.168.1.0/24 198.51.100.0/30 198.51.100.4/30 198.51.100.8/30 203.0.113.0/24 Numbers = hops from the PC (four routers; the server is 5) Each link (dotted line) is its own network; a router stands on two All addresses are from ranges reserved for documentation
2

What a router does

A router is a machine standing on two or more networks. Take r2 in the figure: on the left network (198.51.100.0/30) it is 198.51.100.1, and on the right (198.51.100.4/30) it is 198.51.100.5. Two addresses. Every time a packet arrives, a router does the same things.

  1. Receive a frame addressed to its own MAC and open the layer-2 envelope (part 3).
  2. Look at only the destination address in the IP header. Not the source.
  3. Look up the routing table to choose the next hop and which interface to leave by.
  4. Decrement the TTL in the header. If it hits 0, drop the packet and tell the sender.
  5. Find the next hop's MAC with ARP, put the packet in a new envelope and send it.
POINT

The envelope (MAC) is replaced on every leg; the destination inside (IP) stays the same to the end. That's why part 3 said “MAC gets you next door, IP gets you all the way”: routers are doing this.

A router doesn't care where a packet came from. It reads the destination and passes it on. That will matter when we get to the home router.

3

Routing tables

AraiIs a routing table like a phone book, with every address in the world in it?

FuruiThe home router's has three lines. Have a look.

# Home router r1: anything unknown goes to the provider (198.51.100.1)
r1$ ip route
    default via 198.51.100.1 dev wan0
    192.168.1.0/24 dev lan0
    198.51.100.0/30 dev wan0
# Provider's r2: no default, only the three it knows
r2$ ip route
    198.51.100.0/30 dev e0
    198.51.100.4/30 dev e1
    203.0.113.0/24 via 198.51.100.6 dev e1
# Data-centre r4: everything not on its LAN goes to r3
r4$ ip route
    default via 198.51.100.9 dev e0
    198.51.100.8/30 dev e0
    203.0.113.0/24 dev e1

Each line is one direction. There are only three ways to read them.

FormMeaningExample
… dev ifaceA network we're directly on. Find the target with ARP and deliver directly192.168.1.0/24 dev lan0
… via addressFor this network, hand it to the router at this address203.0.113.0/24 via 198.51.100.6
default via addressIf no line matches, send it here (0.0.0.0/0)default via 198.51.100.1

The home router r1 knows only the home network (192.168.1.0/24) and the little network between it and the provider. Everything else is default: “if in doubt, ask the provider”. It's the same idea as the PC's “default gateway” in part 4, and for most machines it's all they need.

The provider's r2 has no default. A provider's core routers hold a separate route to every network in the world, and there's nobody to hand “I don't know” to (section 8). Our practice r2 knows three lines.

The longest match wins

What if a destination matches more than one line? Let's add a rough line, 203.0.0.0/8, to r2.

Which line sends 203.0.113.20?

Which row for 203.0.113.20? Destination network Next hop Matching bits Result 198.51.100.0/30 e0 no 198.51.100.4/30 e1 no 203.0.0.0/8 198.51.100.6 match 203.0.113.0/24 198.51.100.6 longest When several rows match, use the one with the longest match If nothing matches and there's no default: can't send
# Add a rough route, 203.0.0.0/8, to r2
r2$ ip route add 203.0.0.0/8 via 198.51.100.6
# 203.0.113.20 matches both /8 and /24 → the longer /24 wins (same next hop here)
r2$ ip route get 203.0.113.20
    203.0.113.20 via 198.51.100.6 dev e1 src 198.51.100.5 uid 0
r2$ ip route get 203.0.9.9
    203.0.9.9 via 198.51.100.6 dev e1 src 198.51.100.5 uid 0
# 8.8.8.8 matches nothing and there's no default → can't send
r2$ ip route get 8.8.8.8
    RTNETLINK answers: Network is unreachable

203.0.113.20 matches whether you look at the first 8 bits or the first 24. In that case a router picks the longest matching line (longest prefix match): the longer the match, the more specific the directions. A default is a line of length 0: it matches everything, but it's the weakest. 8.8.8.8 matches nothing, so it couldn't be sent: Network is unreachable.

In this practice network the author wrote the routing tables by hand (static routes). Company and provider routers swap routes with their neighbours and build their tables automatically (routing protocols: BGP between networks, from section 8, and things like OSPF inside them).

4

traceroute and TTL

The IP header has an 8-bit number called the TTL (Time To Live). It starts at something like 64, goes down by one at every router, and the packet is dropped when it reaches 0. When the server received our ping, the TTL was 60: it started at 64 and lost four at four routers.

traceroute turns that lifetime into a way of mapping the path.

Send with the TTL one higher each time

pc r1 r2 r3 r4 srv TTL 1 Time exceeded TTL 2 Time exceeded TTL 3 Time exceeded TTL 4 Time exceeded TTL 5 arrived: Port unreachable Send with TTL 1, 2, 3… and collect the notices of where it ran out The senders of those notices, in order, are what traceroute prints
# The path from Arai's PC to the server in the data centre
$ traceroute -n -q 1 203.0.113.20
    traceroute to 203.0.113.20 (203.0.113.20), 30 hops max, 60 byte packets
     1  192.168.1.1  0.070 ms
     2  198.51.100.1  0.046 ms
     3  198.51.100.6  0.042 ms
     4  198.51.100.10  0.038 ms
     5  203.0.113.20  0.040 ms
# four routers, and the server at hop 5

A packet with TTL 1 expires at the first router, which sends back a “time exceeded” message. Its sender is the first router's address. TTL 2 finds the second, and so on, until the packet reaches the far end. Linux traceroute sends to UDP ports that are probably unused (from 33434), so the target replies “port unreachable”, and that's how traceroute knows it has arrived.

The cover photo is that recording. The time-exceeded notice carries the headers of the packet that expired, so the sender can match each notice to the packet it sent.

NOTE

What you see is the address of the router's interface facing you: r2 shows as 198.51.100.1, not 198.51.100.5. Routers set not to send notices show up as * * *, which doesn't necessarily mean the road ends there. Windows tracert uses ping (ICMP) instead of UDP.

5

When the road loops

AraiWhat's the lifetime for, anyway? If the directions are right, you wouldn't need it.

FuruiDirections are sometimes wrong. Let's make them wrong.

r2 hands 203.0.113.0/24 to r3. We point r3's line for it back at r2, on purpose. Now a packet bounces between r2 and r3.

# Deliberately point r3's 203.0.113.0/24 at r2 (r2 still points at r3), making a loop
r3$ ip route replace 203.0.113.0/24 via 198.51.100.5
pc$ ping -c 1 203.0.113.20
    From 198.51.100.1 icmp_seq=1 Time to live exceeded
# Counting on the r2–r3 link: one ping went across 31 times each way
    r2 e1  tx 31  rx 31  (tcpdump 62)
The top and bottom of a Wireshark packet list. Every row is the same ping (seq=1) from 198.51.100.2 to 203.0.113.20, with ttl going 62, 61, 60 and so on, reaching ttl=1 at packet 62
A deliberate routing loop and a single ping. Each trip between r2 and r3 knocks one off the TTL, until it runs out at packet 62 (0.085 ms later) and is dropped (Recorded on 25 October 2026 on a practice network the author built in the cloud and opened in Wireshark 4.2.2. The bar across the top of the window and the headings were added for the illustration.)

The PC's ping lost one TTL at r1 and one at r2, entering the r2–r3 link at 62. From there each round trip took two more, and at packet 62 the TTL was 1; it was dropped and r2 sent back “time exceeded”. All in 0.085 milliseconds. Without a TTL, that packet would circle on the wire forever, and every new packet caught in the loop would fill it further.

It's like the switch loop (broadcast storm) in part 3. But layer-2 frames have no lifetime, so there we used STP to break the loop itself. Layer 3 has the TTL, so even when a loop forms, packets eventually die.

6

ICMP notices

“Time exceeded” and “port unreachable” are ICMP (Internet Control Message Protocol) messages: notices that serve IP. ping is one of them too, a pair of “please reply” (Echo request) and “here I am” (Echo reply). Here are the notices we collected when things went wrong on the practice network.

# To a destination with no route: the provider's r2 replies “no route to that network”
pc$ ping -c 1 8.8.8.8
    From 198.51.100.1 icmp_seq=1 Destination Net Unreachable
# From outside (the server) to 192.168.1.10 inside the home: stopped at r3 on the way
srv$ ping -c 1 192.168.1.10
    From 198.51.100.9 icmp_seq=1 Destination Net Unreachable
# From outside to the home router's address 198.51.100.2: nothing is listening
srv$ curl http://198.51.100.2:3000/
    Failed to connect to 198.51.100.2 port 3000 after 0 ms: Couldn't connect to server
TypeMeaningWhen
Echo request / replyplease reply / here I amping
Time exceededthe lifetime ran outtraceroute, routing loops
Net unreachableno route to that networkno matching line in the table
Port unreachablenobody on that portnothing listening on a UDP port (part 7)
Fragmentation neededtoo big to passa smaller MTU on the way (part 2)

Company and cloud firewalls often block ICMP. ping failing while the web works is nothing unusual. Don't conclude “it's not connected” from ping alone (part 12).

7

What the home router really is

What's inside the box called a “home router”

Inside a “home router” Router (routes) No. 5 NAT (rewriting) No. 5 Firewall No. 5 DHCP (hands out) No. 4 DNS relay No. 9 Switch (ports) No. 3 Wi-Fi access point No. 2 Home PCs, phones To fibre provider Only one of these is the actual “router”; the rest came along for the ride

The box at home is a real router with a switch (part 3), a Wi-Fi access point (part 2), DHCP (part 4), a DNS relay (part 9) and more packed in. What lets the machines inside reach the outside, though, is NAT (Network Address Translation).

Rewriting the source address on the way out

inside (192.168.1.0/24) outside (internet side) home router translation table 192.168.1.10:40418 ↕ 198.51.100.2:40418 out: source 192.168.1.10:40418 → 203.0.113.20:3000 out: source 198.51.100.2:40418 → 203.0.113.20:3000 back: destination 203.0.113.20:3000 → 192.168.1.10:40418 back: destination 203.0.113.20:3000 → 198.51.100.2:40418 Rewrite the source on the way out, look it up on the way back: NAT Port 40418 was kept here. If ports clash, the router changes the port too Outsiders see only the router's address; 192.168 never leaves home
Two Wireshark packet lists stacked. Top, recorded inside the home: nine packets from 192.168.1.10 to port 3000 on 203.0.113.20, including POST /api/expenses and HTTP/1.1 201 Created. Bottom, the same exchange recorded outside: every 192.168.1.10 has become 198.51.100.2. Port 40418 is unchanged
The same submission recorded on both sides of the home router at once. The contents and port 40418 are identical; only the address has been swapped (Recorded on 25 October 2026 on a practice network the author built in the cloud and opened in Wireshark 4.2.2. The bar across the top of the window and the headings were added for the illustration.)

The PC's address, 192.168.1.10, is a private address (part 4). Homes all over the world use the same 192.168.1.10, so routers outside have no route to it. So the home router rewrites the source of outgoing packets to its own outside address, 198.51.100.2, and remembers the mapping in a table. The reply arrives at 198.51.100.2, and the table turns it back into 192.168.1.10. The submission got through and came back 201.

# The “translation table” the home router remembers (conntrack)
r1$ conntrack -L -p tcp
    tcp      6 119 TIME_WAIT src=192.168.1.10 dst=203.0.113.20 sport=40418 dport=3000
      src=203.0.113.20 dst=198.51.100.2 sport=3000 dport=40418 [ASSURED]
# out: 192.168.1.10 → 203.0.113.20 / back: 203.0.113.20 → 198.51.100.2 (turned back into 192.168.1.10)

The table holds not just addresses but numbers (ports) such as 40418 and 3000. Even with several machines at home talking to the outside at once, the numbers tell them apart so replies go back to the right one. (Here the port was kept; if two clash, the router changes the port as well.) What those numbers really are is next time's topic: TCP.

Without NAT

# Remove NAT from the home router and ping again
pc$ ping -c 3 203.0.113.20
    3 packets transmitted, 0 received, 100% packet loss
# Server-side capture: the request arrived and was answered, but r3 (198.51.100.9) stopped the reply: “no route to that destination”
    192.168.1.10   -> 203.0.113.20   Echo (ping) request seq=1/256, ttl=60
    203.0.113.20   -> 192.168.1.10   Echo (ping) reply seq=1/256, ttl=64
    198.51.100.9   -> 203.0.113.20   Destination unreachable (Network unreachable)

Without NAT, every ping failed. Surprisingly, the server-side capture shows the request (ping) did arrive, and the server replied. Routers only look at the destination, so the outbound packet was delivered even with a 192.168 source. But the reply was addressed to 192.168.1.10, and r3 had no route there, so it dropped it with “no route to that network”. Out it goes, and the reply gets lost: that's a home without NAT.

No way in from outside

The second and third entries in the previous section's ICMP recording were attempts from outside (the server) to get into the home. To 192.168.1.10: r3 has no route. To the home router's address, 198.51.100.2: it reaches only the router itself, which has no table entry saying which machine inside should get it. Nobody outside can start a conversation with a NATed home. That's handy for security, and most home routers add a firewall that blocks incoming connections too.

To show a development server at home to the outside world, you either set up port forwarding, which points a fixed port at a machine inside, or use a tunnel service that keeps a connection open from inside and lends you an entrance outside (part 11). If your provider adds another layer of NAT (CGNAT, part 4's 100.64.0.0/10), even port forwarding won't work.

8

How the internet hangs together

Arair2 only knows three lines because it's practice, right? How many does a real provider know?

FuruiAt the end of July 2026: 1,065,956.

Arai...So it is a phone book.

The internet is a collection of networks (providers, clouds, universities, large companies) each run under its own policy. Each one is an AS (Autonomous System) with a number of its own. ASes tell each other “this block of addresses is beyond us” using BGP (Border Gateway Protocol).

ASes telling each other the way (numbers reserved for documentation)

home r1, default only provider AS64500, r2 transit AS64501, r3 data centre AS64502, r4 BGP BGP announces “it's here” 203.0.113.0/24 AS path: 64502 203.0.113.0/24 AS path: 64501 64502 An AS is a set of networks under one policy; ASes swap routes over BGP Each AS adds its number in front; seeing its own, it rejects (no loops)

When the data centre announces “203.0.113.0/24 is here”, the transit network adds its own AS number in front and passes it to the provider. From the routes it receives, the provider picks one by policy (cost, contracts) and by how many ASes it passes through, and puts it in its table. An AS that finds its own number in the list rejects the route, which keeps loops between ASes rare.

Figure (as of 31 July 2026)Value
Lines in the global BGP table (IPv4)1,065,956
ASes present in the table78,975
Lines in our practice r23

ASes connect by running cables directly to each other, or at an IX (Internet Exchange), a place where many ASes gather and plug into each other. BGP trusts what neighbours announce, so one wrong announcement can travel far. When Facebook went dark for several hours in October 2021, a maintenance command cut its own backbone; its DNS servers noticed and withdrew their routes over BGP, and the whole world lost the ability to look up Facebook's names.

9

Checking your own PC

To seeMacWindowsLinux
The pathtraceroute hosttracert hosttraceroute host
Your routing tablenetstat -rnroute printip route
Which line a destination usesroute get hostFind-NetRoute -RemoteIPAddress hostip route get host
Reachabilityping hostping hostping host

Run traceroute from home and hop 1 should be your home router (an address starting 192.168), with your provider's routers from around hop 2. A few * * * lines along the way are fine as long as it gets to the end. Your PC's routing table will have a default line and one for the home network, plus extra lines if you run a VPN or Docker (part 11).

§ — On one page, and next time

  1. A router reads only the destination address, picks the next hop from its table, and sends the packet on in a new envelope (MAC).
  2. Routing table lines come in three kinds: directly connected, via an address, and default. If several match, the longest match wins.
  3. The TTL drops by one per router. traceroute raises it one at a time and collects who sent “time exceeded”.
  4. With a routing loop, one ping crossed between r2 and r3 62 times before its TTL ran out.
  5. ICMP carries IP's notices. Firewalls often block it, so the web may work even when ping doesn't.
  6. A home router is mostly NAT: rewrite the source, map it back from a table. Without it, requests arrive but replies get lost. Nothing gets in from outside.
  7. The internet is about 79,000 ASes telling each other about 1.07 million routes over BGP.

AraiSo what are those numbers in the NAT table, 40418 and 3000?

FuruiIf an address is a building, the number is a room. And packets get lost on the way or arrive out of order. How do you put that right? Next time: TCP.

References

The recordings were made on 25 October 2026 on a practice network the author built with network namespaces on Linux (Ubuntu 24.04) in the cloud. The routers are Linux forwarding, the routes are hand-written static routes, NAT is iptables MASQUERADE, the table was read with conntrack 1.4.8, and traceroute is version 2.1.5. Every number in the text is a real value read from those recordings and the commands' output. All addresses and AS numbers come from ranges reserved for documentation. The global routing-table figures are from the Weekly Global IPv4 Routing Table Report posted to the AFNOG mailing list (31 July 2026). The characters are fictional.

Old-School Networking, part 5 — Routers / 2026.10

← Back to all posts