Routing — Hop by Hop
A packet from a Delhi player's laptop to the Mumbai match server may pass through a dozen machines on the way. Not one of them knows the whole route. Each makes one small decision and hands the packet on.
The rule
Each router reads only the destination and picks the next hop.
First, how the packet is built. The game's bytes get the game header and a UDP header, and then IP wraps the lot in a header of its own:
| IPv4 header (20+) | UDP header (8) | game header (10) | messages ... |The IPv4 header's most important fields:
- Source and destination address — where the packet came from and where it is going.
- Protocol — what is inside: 6 means TCP, 17 means UDP, 1 means ICMP, the protocol routers use to report problems.
- TTL (time to live) — a counter, often starting at 64, that every router lowers by one. When it reaches 0, the router drops the packet and usually sends an ICMP "time exceeded" message back to the sender. This stops packets from looping forever, and it is how
traceroutemaps a path: it sends packets with a TTL of 1, 2, 3 and so on, and lists which router replies each time. - Total length, a header checksum and fragment fields — the next two lessons cover these.
IPv6 uses a fixed 40-byte header with the same ideas under new names: next header instead of protocol, and hop limit instead of TTL.
Each router holds a routing table of address prefixes. For every packet it finds all the entries that match the destination and uses the most specific one, the longest prefix match. 0.0.0.0/0 matches every address, so it serves as the default route.
Routers keep no memory of earlier packets. If routes change, two packets from the same match can travel different paths and wait in different queues, which is one reason packets arrive out of order and delays wobble.
The shortcut
For a lookup, list the entries that match, then take the one with the longest prefix. A /24 fixes the first 24 bits (the first three numbers); a /28 fixes 28 bits, which leaves a block of 16 addresses.
The table
0.0.0.0/0goes upstream.203.0.113.0/24goes out on port 2.203.0.113.0/28, which covers .0 to .15, goes out on port 3.
Drills
Answer fast — trust the rule.
What value does the IPv4 protocol field hold for a packet carrying UDP?
A packet leaves a player's laptop with a TTL of 64 and passes through 9 routers. What is its TTL when it arrives?
Using the table in the walk-through, where does a packet to 203.0.113.5 go?
Why can two packets from the same Manja Arena match arrive in a different order from the one they were sent in?
A router lowers a packet's TTL to 0. What does it do next?
Remember
- Each router reads only the destination and picks the next hop.
- Longest prefix match: list the matching entries, then take the most specific.
- Trap: expecting one fixed path. Every packet is routed on its own.
