The Internet is a highway. How do packets find their way?
Imagine a highway. A gigantic one. So huge that it connects cities, countries, continents, and even islands you would normally need a boat to reach.
Billions of cars travel along this highway every day. Each carries a piece of information. One has a bit of a YouTube video, another a message for a friend, the third a picture of a cat, and the fourth the news that you've just lost an auction after bidding for three hours.
They all have a destination address. They all want to get there.
There's just one tiny detail.
On this highway, drivers are not allowed to choose their own route. 🤣
Welcome to the Packet Highway, commonly known as the Internet!
— Wait a minute. What do you mean I can't choose my route? I know I'm going to Kraków!
— Excellent. Now take the exit on your right.
— But Kraków is straight ahead!
— Take the exit on your right.
— But WHY?!
— That's what the little table says.
— WHAT little table?!
— Ours. NEXT!
And that's life on a highway where every junction has its own traffic manager. Each knows certain roads and makes its own decisions, but none needs to know what the entire journey will look like.
The driver knows the destination. The junction manager chooses the next stretch of road.
In computing, that manager is a router, its little table is a routing table, and the process of directing cars toward the appropriate exits is called routing.
Sounds serious? Don't worry. Let's see what happens when the managers start helping each other.
Now imagine one of the managers has an outdated map
— Kraków? Turn left!
Twenty kilometres later:
— Kraków? Turn right!
Another twenty kilometres later:
— YOU AGAIN?!
— THEY SENT ME BACK HERE!
— Then turn left.
— I'VE ALREADY BEEN THERE!
— Do not argue with the table! 🤣
And so you can drive from one junction to another without ever getting closer to your destination.
In networking, this is a routing loop: forwarding decisions send information back through places it has already visited.
Sometimes outdated route information is to blame. Sometimes a bad configuration. And sometimes two managers are absolutely convinced that the other one knows better.
— I'm sending him there because he knows the way!
— And I'm sending him back because HE knows the way!
— THEN WHO ACTUALLY KNOWS THE WAY?!
— Please refrain from difficult questions during rush hour.
How many times can you drive around the same junction?
On our highway every car gets a special counter limiting how many junctions it may pass.
Let's say it starts at 64.
After the first junction it's 63. After the next, 62. And so on.
— And when it reaches zero?
— End of the journey.
— But I've still got half a tank!
— We don't care about fuel. Your allowance has run out.
— Can I pay extra?
— NOT AN OPTION. PLEASE LEAVE THE HIGHWAY.
In IPv4 this counter is called TTL (Time To Live). Its IPv6 counterpart is the Hop Limit.
Each router along the way reduces it by one. Once the limit is exhausted, the packet is discarded.
Why? Among other things, to stop cars caught in routing loops from circling until the end of time.
When a packet is discarded because its limit has expired, a router may send back an ICMP Time Exceeded message.
“Your vehicle has exceeded the permitted number of junctions. Your journey has been terminated. Please direct complaints to the route operator.”
Toll booths, queues and enormous traffic jams
Imagine a toll booth capable of handling a thousand cars per second.
Everything runs beautifully. Cars arrive, pass through, and nobody even honks.
Then suddenly five thousand cars arrive every second.
— Boss, we've got a traffic jam!
— Let them wait!
— But the queue has reached the previous junction!
— Let them wait some more!
— BOSS, THERE'S NOWHERE LEFT TO PUT THEM!
— THEN STOP LETTING THE NEXT ONES IN!
And some cars simply disappear from our highway.
That is packet loss.
— WHAT DO YOU MEAN DISAPPEAR?! I was carrying an important message!
— Then send it again.
— And who is responsible for THAT?!
— Depends on which transport service you're using. 🤣
Meet two very different delivery companies.
TCP — the carrier who loves receipts
— Good morning. Package number 153 delivered.
— Receipt confirmed.
— What about package 154?
— Didn't get it.
— WHAT DO YOU MEAN YOU DIDN'T GET IT?!
— I didn't get it.
— I'M SENDING IT AGAIN!
TCP provides reliable delivery of an ordered stream of data. It tracks acknowledgements, detects missing data and retransmits when needed.
It also has mechanisms to adjust the sending rate so it doesn't keep pouring cars onto an already jammed highway.
UDP — the carrier who doesn't wait for a signature
— Package 153 dispatched!
— Did it arrive?
— No idea.
— Can't you check?!
— Not in my contract.
— And package 154?
— Already on its way!
UDP does not itself provide acknowledgements, retransmissions, or a guarantee of delivery order.
That doesn't make it worse. Just different.
During a live conversation, the newest sound often matters more than recovering a syllable from five seconds ago.
An application using UDP can, of course, build its own delivery-control mechanisms. UDP itself doesn't provide them.
Now imagine three cars
They leave one after another. Along the same road.
The first arrives after 30 milliseconds.
The second after 80.
The third after 35.
— WHAT?! We left almost together!
— The first avoided the queue. The second got stuck at the toll booth. The third was luckier.
— Then why does my video keep stuttering when I've got fast Internet?!
— Because a fast highway doesn't mean every car takes exactly the same time to get through.
That is jitter — variation in delay.
The delay itself is often called latency. One tool used to check it is ping, which measures how long a message takes to travel there and back.
Now imagine a video call.
One word arrives after 30 milliseconds, the next after 80, and the next after 35.
— Goo... d mor... ning... can... you... he...
— WHAT?!
— ...ar me?
And now you know why a great bandwidth test doesn't guarantee a perfect conversation.
Special attractions along the highway
Our highway also has places that ordinary drivers would rather avoid.
The licence plate exchange booth — NAT and masquerade
— WHY ARE YOU CHANGING MY NUMBER PLATES?!
— Because outside this gate you all share one address.
— THEN HOW WILL I GET MY REPLY?!
— Relax. We wrote you down in the notebook.
This is how a common form of NAT (Network Address Translation) works, often referred to as masquerading.
When multiple devices share one public address, the system usually changes not just the sender's address but also a port number, so different connections can be told apart.
Our gate manager keeps the appropriate records and knows where to send each returning reply.
Provided, of course, the notebook hasn't ended up in the shredder.
The special transport terminal — VPN
— Please drive your car onto the truck.
— But I can drive perfectly well myself!
— Wonderful. On this stretch, you'll travel as cargo.
— Does the truck driver know what's inside?
— Not necessarily. And that's rather the point.
This is tunnelling and encapsulation.
In simple terms, one packet is wrapped inside another, which carries it across a selected part of the network.
VPN tunnels can work this way, although VPNs don't all encrypt data in the same fashion, and some tunnelling mechanisms provide no encryption at all.
At the end of the tunnel, the car leaves the truck and continues on its own.
— Do I pay extra for the ride?
— No, but you may lose a little luggage space.
— WHAT?!
— The truck has its own paperwork too.
And that's our next topic: header overhead.
The low bridge — MTU and fragmentation
— Vehicle height?
— Four metres eighty.
— Bridge clearance?
— Four twenty.
— So what do we do?
— We certainly don't force the truck under the bridge.
Roads have vehicle height and weight limits. Networks have MTU (Maximum Transmission Unit), which defines the maximum size of a packet that can travel over a given stretch at a particular transmission layer.
When a packet is too large, it may sometimes be split into smaller pieces.
This is packet fragmentation.
But beware! It isn't always allowed, and it isn't always done.
In IPv4 a router can fragment packets under certain conditions. In IPv6 routers do not fragment packets in transit, so the sender must adjust the size of what it sends.
— So I unload this truck and send the cargo in three vans?
— Sometimes, yes.
— And if I'm not allowed?
— Go back to the sender and ask for a smaller truck.
MTU, MSS and fragmentation deserve their own stretch of highway. One badly chosen vehicle size can ruin somebody's entire day.
The priority lane — QoS and traffic management
— WHY IS THAT CAR OVERTAKING ME?!
— It has a higher priority.
— AND ME?!
— You've got a cat picture.
— THIS IS A VERY IMPORTANT CAT!
— To you, certainly. To our queueing system, not necessarily.
But here's the thing: QoS (Quality of Service) is more than a single priority lane.
Different traffic rules can apply on our highway.
One manager lets vehicles through in arrival order.
Another gives ambulances priority.
A third provides separate lanes for trucks, cars and buses.
A fourth makes sure one carrier doesn't take over the entire road.
These represent different mechanisms for queueing, prioritisation and traffic management, including traffic shaping and traffic policing.
— So can I buy a VIP lane?
— Depends on the manager.
— How much?
— Whatever the network administration considers appropriate.
— THEN I'LL TAKE AN AMBULANCE!
— Sir, your cat picture is still not a medical emergency.
And what if the highway leads into space?
— Hello, I'd like to reach the Internet by satellite.
— Certainly. The space ferry leaves shortly.
— Where's the highway?
— First, we go up.
— How far up?
— A few hundred kilometres.
— AND THAT'S SUPPOSED TO WORK?!
— It does. Please don't open the windows. 🤣
And so Starlink joins our story — Internet access using satellites in low Earth orbit.
Unlike traditional geostationary satellites, these fly much closer to Earth, allowing significantly lower latency.
But travelling through space does not guarantee that the rest of the route is free of traffic jams.
To explore more of our Packet Highway, take a look at IP addresses, DHCP, TCP and UDP.
What's really happening under the bonnet?
This entire highway is, of course, an analogy.
The cars are data packets. Junctions are routers. Their little tables are routing tables. The licence-plate notebook represents a simplified version of NAT. Trucks represent encapsulation, and toll-booth queues stand for real traffic-handling problems.
Real routers don't read road maps, charge tolls or issue traffic tickets.
Nor do they need to know the entire route to the destination. They choose the next leg based on the route information available to them.
And congestion, limits, queues, route changes and lost deliveries?
Those are very real indeed.
Which is why the Internet, despite connecting computers thousands of kilometres apart, can sometimes fail to play a cat video without stuttering.
Next time: the licence-plate inspection booth, otherwise known as NAT. The gate manager assures us that the address notebook has never once gone missing.
The notebook is currently missing. 🤣❤️
