Your internet plan says “500 Mb/s”. So why does a video call to a friend on the other side of the world still feel laggy, while a download from a nearby server flies?
Because “fast” means two different things on a network, and your plan only tells you about one of them. To see both, you first need to know how data really travels.
Data travels in packets
When your laptop sends a photo, it does not push the whole file down the cable in one go. It cuts the file into small pieces called packets, each with the addresses of the sender and the receiver written on it, and sends them one after another.
Watch a 6,000-byte photo go from one laptop to another over a single cable. (The command nc simply sends a file to another computer. You do not need to remember it.)
A 6,000-byte photo crosses one cable
-
laptop-a: nc -N 192.168.1.11 9000 < photo.jpg
First, three short messages set up the conversation. You will learn what they say in Module 5. Watch what comes after them.
- Time
- 0 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- SYN
- seq / ack
- 0 / – (relative)
- On the wire
- 70 bytes
- laptop-a TCP
- SYN-SENT → SYN-SENT
-
laptop-b: TCP SYN-ACK seq=0 ack=1
laptop-b agrees: SYN-ACK. It acknowledges the SYN and picks its own starting number. laptop-b's connection is now SYN-RECEIVED.
- Time
- 100.56 µs
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- SYN ACK
- seq / ack
- 0 / 1 (relative)
- On the wire
- 70 bytes
- laptop-b TCP
- LISTEN → SYN-RECEIVED
-
laptop-a: TCP ACK seq=1 ack=1
laptop-a acknowledges what it has received. laptop-a's connection is now ESTABLISHED. laptop-a's connection is now FIN-WAIT-1.
- Time
- 201.12 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 64 bytes
- laptop-a TCP
- SYN-SENT → ESTABLISHED
- laptop-a TCP
- ESTABLISHED → FIN-WAIT-1
-
laptop-a: photo.jpg (part)
The first piece of the photo: 1,460 bytes of it. Notice the size in brackets on the arrow.
- Time
- 201.632 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 213.776 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1461 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 225.92 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 2921 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 238.064 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 4381 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
The last piece is smaller: only 160 bytes were left.
- Time
- 250.208 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- PSH ACK
- seq / ack
- 5841 / 1 (relative)
- On the wire
- 218 bytes
-
laptop-a: TCP FIN-ACK seq=6001 ack=1
laptop-a has nothing more to send: FIN.
- Time
- 251.952 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- FIN ACK
- seq / ack
- 6001 / 1 (relative)
- On the wire
- 64 bytes
-
laptop-b receives TCP ACK seq=1 ack=1
laptop-b gets the frame. laptop-b's connection is now ESTABLISHED.
- Time
- 301.632 µs
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- SYN-RECEIVED → ESTABLISHED
-
laptop-b: TCP ACK seq=1 ack=2921
laptop-b confirms what it has received so far: "I have everything up to byte 2,920". It does not answer every single piece.
- Time
- 325.92 µs
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- ACK
- seq / ack
- 1 / 2921 (relative)
- On the wire
- 64 bytes
-
laptop-b: TCP ACK seq=1 ack=5841
laptop-b acknowledges what it has received.
- Time
- 350.208 µs
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- ACK
- seq / ack
- 1 / 5841 (relative)
- On the wire
- 64 bytes
-
laptop-b receives TCP ACK seq=5841 ack=1 (160 bytes of data)
laptop-b gets the frame.
- Time
- 351.952 µs
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- PSH ACK
- seq / ack
- 5841 / 1 (relative)
- On the wire
- 218 bytes
- laptop-b app
- received 6000 bytes so far
-
laptop-b: TCP FIN-ACK seq=1 ack=6002
laptop-b has nothing more to send: FIN. laptop-b's connection is now CLOSE-WAIT. laptop-b's connection is now LAST-ACK.
- Time
- 352.464 µs
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- FIN ACK
- seq / ack
- 1 / 6002 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- ESTABLISHED → CLOSE-WAIT
- laptop-b TCP
- CLOSE-WAIT → LAST-ACK
-
laptop-a: TCP ACK seq=6002 ack=2
laptop-a acknowledges what it has received. laptop-a's connection is now FIN-WAIT-2. laptop-a's connection is now TIME-WAIT.
- Time
- 452.976 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 6002 / 2 (relative)
- On the wire
- 64 bytes
- laptop-a TCP
- FIN-WAIT-1 → FIN-WAIT-2
- laptop-a TCP
- FIN-WAIT-2 → TIME-WAIT
-
laptop-b receives TCP ACK seq=6002 ack=2
laptop-b gets the frame. laptop-b's connection is now CLOSED.
- Time
- 553.488 µs
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 6002 / 2 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- LAST-ACK → CLOSED
Five packets carried the photo: four full ones of 1,460 bytes and a last one with the 160 bytes left over. Why not one big packet?
- Sharing. A cable, a Wi-Fi channel or a link across the sea is shared by many people. Small packets from everyone can take turns, so nobody’s huge download blocks everybody else for minutes.
- Mistakes are cheap. If one packet is damaged or lost, only that small piece has to be sent again, not the whole file.
- Every link has a size limit. On an ordinary Ethernet cable, a packet can carry at most about 1,500 bytes. You will meet that limit again near the end of the course.
Two kinds of fast
The cable in that lab was fast and short, so the whole thing was over in less than half a millisecond. Real links are not all like that. Every link has two numbers:
- Latency is how long one bit takes to travel from one end to the other. It depends mostly on distance: light in a fibre covers about 200 km every millisecond, so crossing an ocean takes tens of milliseconds, whatever you pay.
- Bandwidth is how many bits per second the link can push onto the wire. It decides how long it takes to send a big packet, or a big file. This is the “500 Mb/s” in your plan.
A useful picture: latency is the length of a motorway, bandwidth is the number of lanes. More lanes let more cars through per minute, but they do not make the trip shorter.
Here is the same pair of laptops joined by a much worse link: 40 milliseconds each way (like a long-distance connection) and only 2 Mb/s. First a ping, which sends one small message and times the reply.
One ping over a slow, long link
-
laptop-a: ping -c 1 192.168.1.11
laptop-a runs ping -c 1 192.168.1.11. laptop-a sends an ICMP echo request ("are you there?") to 192.168.1.11, in a frame addressed to laptop-b.
- Time
- 0 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- ICMP
- echo request, seq 1
- On the wire
- 102 bytes
-
laptop-b: ICMP echo reply seq=1 192.168.1.11 → 192.168.1.10
laptop-b answers with an echo reply.
- Time
- 40.408 ms
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- ICMP
- echo reply, seq 1
- On the wire
- 102 bytes
-
laptop-a receives ICMP echo reply seq=1 192.168.1.11 → 192.168.1.10
laptop-a gets the frame. The reply arrived 80.8 ms after the request left: that is the round-trip time. laptop-a prints: rtt min/avg/max/mdev = 80.816/80.816/80.816/0.000 ms
- Time
- 80.816 ms
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- ICMP
- echo reply, seq 1
- On the wire
- 102 bytes
The ping’s answer, time=80.8 ms, is the round-trip time (RTT): out and back. The extra 0.8 ms on top of the 80 is the time it took to push the ping’s 102 bytes onto a 2 Mb/s link, once in each direction.
Now the photo, over the same slow link.
The same photo over the slow, long link
-
laptop-a: nc -N 192.168.1.11 9000 < photo.jpg
The same three set-up messages. Each one now has to cross the 40 ms link.
- Time
- 0 µs
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- SYN
- seq / ack
- 0 / – (relative)
- On the wire
- 70 bytes
- laptop-a TCP
- SYN-SENT → SYN-SENT
-
laptop-b: TCP SYN-ACK seq=0 ack=1
laptop-b agrees: SYN-ACK. It acknowledges the SYN and picks its own starting number. laptop-b's connection is now SYN-RECEIVED.
- Time
- 40.28 ms
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- SYN ACK
- seq / ack
- 0 / 1 (relative)
- On the wire
- 70 bytes
- laptop-b TCP
- LISTEN → SYN-RECEIVED
-
laptop-a: TCP ACK seq=1 ack=1
laptop-a acknowledges what it has received. laptop-a's connection is now ESTABLISHED. laptop-a's connection is now FIN-WAIT-1.
- Time
- 80.56 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 64 bytes
- laptop-a TCP
- SYN-SENT → ESTABLISHED
- laptop-a TCP
- ESTABLISHED → FIN-WAIT-1
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 80.816 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 86.888 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1461 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 92.96 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 2921 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 1460 bytes of data.
- Time
- 99.032 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 4381 / 1 (relative)
- On the wire
- 1518 bytes
-
laptop-a: photo.jpg (part)
laptop-a sends 160 bytes of data.
- Time
- 105.104 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- PSH ACK
- seq / ack
- 5841 / 1 (relative)
- On the wire
- 218 bytes
-
laptop-a: TCP FIN-ACK seq=6001 ack=1
laptop-a has nothing more to send: FIN.
- Time
- 105.976 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- FIN ACK
- seq / ack
- 6001 / 1 (relative)
- On the wire
- 64 bytes
-
laptop-b receives TCP ACK seq=1 ack=1
laptop-b gets the frame. laptop-b's connection is now ESTABLISHED.
- Time
- 120.816 ms
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 1 / 1 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- SYN-RECEIVED → ESTABLISHED
-
laptop-b: TCP ACK seq=1 ack=2921
laptop-b acknowledges what it has received.
- Time
- 132.96 ms
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- ACK
- seq / ack
- 1 / 2921 (relative)
- On the wire
- 64 bytes
-
laptop-b: TCP ACK seq=1 ack=5841
laptop-b acknowledges what it has received.
- Time
- 145.104 ms
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- ACK
- seq / ack
- 1 / 5841 (relative)
- On the wire
- 64 bytes
-
laptop-b receives TCP ACK seq=5841 ack=1 (160 bytes of data)
laptop-b gets the frame.
- Time
- 145.976 ms
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- PSH ACK
- seq / ack
- 5841 / 1 (relative)
- On the wire
- 218 bytes
- laptop-b app
- received 6000 bytes so far
-
laptop-b: TCP FIN-ACK seq=1 ack=6002
laptop-b has nothing more to send: FIN. laptop-b's connection is now CLOSE-WAIT. laptop-b's connection is now LAST-ACK.
- Time
- 146.232 ms
- Cable
- laptop-b eth0 → laptop-a eth0
- Ethernet
- 02:00:00:00:00:0b → 02:00:00:00:00:0a
- IP
- 192.168.1.11 → 192.168.1.10
- TTL
- 64
- TCP ports
- 9000 → 47658
- TCP flags
- FIN ACK
- seq / ack
- 1 / 6002 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- ESTABLISHED → CLOSE-WAIT
- laptop-b TCP
- CLOSE-WAIT → LAST-ACK
-
laptop-a: TCP ACK seq=6002 ack=2
laptop-a acknowledges what it has received. laptop-a's connection is now FIN-WAIT-2. laptop-a's connection is now TIME-WAIT.
- Time
- 186.488 ms
- Cable
- laptop-a eth0 → laptop-b eth0
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 6002 / 2 (relative)
- On the wire
- 64 bytes
- laptop-a TCP
- FIN-WAIT-1 → FIN-WAIT-2
- laptop-a TCP
- FIN-WAIT-2 → TIME-WAIT
-
laptop-b receives TCP ACK seq=6002 ack=2
laptop-b gets the frame. laptop-b's connection is now CLOSED.
- Time
- 226.744 ms
- Ethernet
- 02:00:00:00:00:0a → 02:00:00:00:00:0b
- IP
- 192.168.1.10 → 192.168.1.11
- TTL
- 64
- TCP ports
- 47658 → 9000
- TCP flags
- ACK
- seq / ack
- 6002 / 2 (relative)
- On the wire
- 64 bytes
- laptop-b TCP
- LAST-ACK → CLOSED
The photo took about 146 milliseconds instead of less than half a millisecond. Most of that is not the bandwidth. Count the round trips: setting up the conversation took a full one (80 ms) before any data moved, then the data needed half of one (40 ms) to arrive, and pushing the five packets onto the slow wire added the rest. Every round trip costs 80 milliseconds, however many lanes the motorway has.
Press Try it and change the latency and the bandwidth of that cable. Make the bandwidth ten times bigger and run the photo again: it gets faster, but not ten times faster. Then make the latency smaller instead.
In the real world
A video call needs very little bandwidth, a few megabits per second, but it needs low latency: if your voice takes 300 ms to arrive, people start talking over each other. That is why a call to another continent can feel bad on a “fast” connection, and why online games care about ping much more than about download speed. Bandwidth is something you can buy more of. Latency is mostly set by distance, and the speed of light does not go up.
Recap
- Data is cut into packets, each carrying addresses, and sent one after another.
- Packets let many people share a link and make a lost piece cheap to resend.
- Latency is the travel time across a link; bandwidth is how many bits per second it carries.
- The round-trip time (RTT) is there and back; ping measures it.
- Many network delays are round trips, which more bandwidth does not shorten.
Quick check
-
Ping time is mostly latency, which depends on distance. Bandwidth only changes how fast bits are pushed onto the wire.
-
Small packets take turns on shared links, and only a lost packet needs sending again.
-
RTT is there and back. ping prints it as time= for every reply.
Join the discussion