Network Bytes · Episode 41 · CCNA 3.1
What a router actually does
A router reads a packet's destination IP address, looks it up in its routing table and sends the packet to the next hop. Router by router, hop by hop, the packet reaches its destination's network.
A post office sorting room
Think of a router as a post office sorting room. A letter comes in, and the clerk doesn't care where it came from, only where it's going. A router works the same way: normal IP forwarding is destination-based. The source address rides along in the packet, but the forwarding decision is made from the destination address.
Destination IP, then the routing table
When a packet arrives, the router reads its destination IP address, say 10.2.0.5. Then it checks its routing table: a list of networks it knows about, and for each one, which way to send traffic (an exit interface and, usually, the address of the next router). A tiny table might say 10.1.0.0 goes out the left interface and 10.2.0.0 goes out the right one. Our packet for 10.2.0.5 belongs to 10.2.0.0, so it goes right.
If more than one route fits, the router picks the most specific one, the longest prefix match. That's a whole episode of its own.
The next hop, hop by hop
The router sends the packet out that interface to the next router along the way. That one step is called the next hop. The next router repeats the whole process with its own routing table, and so does the one after it, until the packet reaches a router connected to the destination's network, which delivers it locally. Because each router only has to know the next step, no single router needs a map of the whole internet.
No match: dropped
If the destination doesn't match any route, and there's no default route to catch everything else, the router can't forward the packet, so it drops it. It may also send an ICMP "destination unreachable" message back to the sender.
Try it yourself
Watch the hops for yourself. On Windows, open Command Prompt and run tracert example.com; on macOS or Linux, open a terminal and run traceroute example.com. Each numbered line is a router that handled your packet on the way. Try a website hosted in another country and compare how many lines you get.
Good to know
- Normal IP forwarding is destination-based: each router looks up the destination address in its own routing table and forwards independently. Policy-based routing and ACLs can also consider the source, but that's beyond this short.
- "Best match" means the longest prefix match (EP43). A default route, if present, catches anything that matches nothing else (EP45).
- Simplified in the video: each router also decrements the IP TTL and builds a new Layer 2 frame (new source and destination MAC addresses) for the next link.
- With no matching route and no default route, the packet is dropped, and an ICMP unreachable message may be sent back.
For CCNA learners
This lines up with CCNA 200-301 exam topic 3.1, interpret the components of a routing table: know that the router matches the destination IP against its routing table and forwards to the next hop shown for the best-matching route.
Answer to the comment question
4. Every router on the path looks up the destination in its own routing table and picks the next hop on its own, so a packet that crosses four routers gets four next-hop decisions, one per router.
Test your knowledge
Quick quiz: What a router actually does
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- IETF, RFC 1812, "Requirements for IP Version 4 Routers": the forwarding algorithm: find the outgoing interface and next hop, decrement TTL, re-encapsulate for the next link
- Cisco Press, "Routing Concepts: Router Operation (1.3)": routers use the routing table to pick the best path and forward out an exit interface
- Cisco, "Configure Route Selection for Routers": the router forwards using the longest matching route in its routing table
- IETF, RFC 4632, "Classless Inter-domain Routing (CIDR)": forwarding in the Internet is done on a longest-match basis, hop by hop
- Cisco, CCNA 200-301 v1.1 exam topics: 3.1 interpret the components of a routing table (next hop)
Video transcript
What does a router actually do with your packet?
Think of a router as a post office sorting room. A letter comes in. The clerk doesn't care where it came from, only where it's going.
The router reads the destination IP address, then checks its routing table: a list of networks it knows, and which way to send each one.
It finds the best match and sends the packet out that door, to the next router along the way. That one step is called the next hop.
The next router does the same, and the next, hop by hop, until the packet reaches its destination's network. No router needs the whole map. No match at all? The packet is dropped.
Your packet crosses four routers to reach a website. How many next-hop decisions is that? Comment your answer below!
That's your byte.
More from Network Bytes
- EP39Autonomous vs controller-based APs
- EP40WPA2 vs WPA3
- EP42Reading a routing table
- EP43Longest prefix match