21 November 2026

Packets: How Does Your Data Actually Cross a Network?

 


Packets: How Does Your Data Actually Cross a Network?

Imagine I take a photograph of Champagne, our Thames A-Rater, and send it to someone at the sailing club. On my screen there is one photograph. On theirs, a few seconds later, there is one photograph. Somewhere between those two screens, which piece of equipment knew it was looking at a boat?

The camera did its job and the recipient’s software can display the picture. But the routers in between can do their job without knowing a mainsail from a patch of blue sky. Give a router a packet and its destination IP address, and it can decide where to send it next.

In the last computing practical, last Saturday, we used DNS to connect a name to an IP address. This week we can put the name to one side and investigate the journey itself. A Windows PC or Linux machine, four short messages and one rather interesting row of asterisks are enough to get started.

Why split a photograph into packets?

Picture two people sharing an internet connection. I’m uploading the sailing photograph while a student is asking me a question on a video call. If the photograph monopolised the connection until the whole file had gone through, the student’s voice would have to wait behind it.

With packet switching, a link carries small units of data from different conversations in turn. A packet carrying part of the photograph can be followed by one carrying a fragment of speech. At a busy router, packets may wait in a queue. If the queue fills, some may be dropped. This gives us two things we can investigate directly: how long a reply takes and whether a reply arrives at all.

Each IP packet has a header, including its destination IP address, and a payload, the data carried inside. A router checks its forwarding table, selects a next hop and forwards the packet. Successive packets often follow the same route, though routing changes or load balancing can produce different paths. Compare that with circuit switching, where capacity is reserved along a path for the duration of a connection. A quiet moment in a packet-switched conversation leaves room for somebody else to use the link.

Practical 1 — How far can four pings take us?

Start with a prediction. Which should usually reply fastest: your own computer, your router, or a computer beyond your home network? Write down a reason before opening the terminal. We’ll use numerical IPv4 addresses so a DNS lookup is one fewer variable.

Find your router’s local address. On Windows, run ipconfig and look for the IPv4 Default Gateway on your active Wi-Fi or Ethernet adapter. On Linux, run ip route and look for the address after default via. Substitute that address for the example 192.168.1.1 below.

DestinationWindows Command PromptLinux terminalWhat a reply demonstrates
Your own computerping -n 4 127.0.0.1ping -c 4 127.0.0.1Your local IP stack can answer. The traffic stays on the computer.
Your default gatewayping -n 4 192.168.1.1ping -c 4 192.168.1.1A request and reply have crossed your local network.
An external addressping -n 4 1.1.1.1ping -c 4 1.1.1.1A device at that address answered across the wider network.

For each target, record how many replies arrived and the minimum, average and maximum time. Ping measures round-trip time: the request travels out, the destination produces a reply, and that reply travels back. The outward and return paths can differ.

Suppose the four external replies took 18, 19, 18 and 21 milliseconds. These are illustrative readings. The calculation uses ordinary keyboard characters:

Mean round-trip time = (18 + 19 + 18 + 21) / 4 = 19 ms

Could you now predict how long it would take to upload the photograph? You still need to know how much data must be sent and the transfer rate you can sustain. A tiny message can get a quick reply over a link that takes minutes to carry a large file. That distinction between latency and throughput matters whenever someone says, “The internet feels slow.”

If an address times out, record exactly what you observed: no echo reply arrived before the timeout. Some devices filter or give low priority to these diagnostic messages. Try opening a familiar web page. A working web page alongside an unanswered ping gives you two observations about two different kinds of traffic.



Practical 2 — The missing router that still forwards traffic

Ping gives us two endpoints. To investigate what lies between them, use the same external address in a route trace. The options below keep the output numerical and avoid delays from looking up names.

WindowsLinux with traceroute installed
tracert -d 1.1.1.1traceroute -n 1.1.1.1

The trick is a field in the IPv4 header called Time to Live, or TTL. Think of it here as a hop budget. The tool begins with a probe whose TTL is 1. The first router reduces it to zero, discards the probe and may send back an ICMP Time Exceeded message. A fresh probe with TTL 2 can reach the next router. Increasing the budget builds up a picture of the path. Windows normally sends ICMP Echo probes. Traditional Linux traceroute normally sends UDP probes. Both can learn about intermediate hops from the ICMP replies.

Here is a shortened, invented Windows-style trace. The addresses in the middle are reserved for documentation.

1     1 ms     1 ms     2 ms    192.168.1.1
2     9 ms     8 ms     9 ms    192.0.2.1
3       *        *        *     Request timed out.
4    15 ms    14 ms    15 ms    198.51.100.9
5    19 ms    18 ms    20 ms    1.1.1.1

Cover rows 4 and 5. What would you predict happened at row 3? Now uncover them. Probes with larger hop budgets reached a later router and the destination. All we can say about row 3 is that none of those three probes produced a reply in time. A router can forward traffic while staying silent about itself.

Each timing is for a trip from your computer to the responding hop and back. Adding the rows together would count parts of the journey repeatedly. And because each row uses fresh probes, the trace is a sample of routes taken during the test. It cannot establish the exact path taken by yesterday’s photograph.

Practical 3 — Catch one request and find its reply

If Wireshark is available, I’d finish by looking closely at just two packets. For this exercise, use your own computer and ping the local gateway so the traffic crosses the adapter you’re watching.

  1. Open Wireshark and start a capture on the Wi-Fi or Ethernet interface your computer is using.

  2. Run the four-ping gateway command from Practical 1. When it finishes, stop the capture.

  3. Enter icmp in the display filter box and press Enter. This narrows the view to IPv4 ICMP messages.

  4. Select an Echo request. Expand Internet Protocol Version 4 and find the source and destination addresses. Then expand Internet Control Message Protocol and find the identifier and sequence number.

  5. Find the Echo reply with the matching identifier and sequence number. Check the IP addresses. The computer that was the destination of the request is now the source of the reply.

With four successful pings, look for four matching pairs. If the list is empty, check the interface and the target. A ping to 127.0.0.1 stays on the loopback interface, which explains why a perfectly successful test can leave your Wi-Fi capture empty.

Try taking the reply timestamp away from the request timestamp on paper. Which way round gives a positive elapsed time? The calculation you want is:

Observed round-trip time in ms = (reply time in seconds - request time in seconds) * 1000

Here is what I like about this exercise as a tutor. A student can point to two rows, explain why they belong together and show where the time went. That gives me a much better question to ask than “What does ICMP stand for?”

Where does TCP fit if ping uses ICMP?

The TCP/IP stack is a family of protocols arranged in layers. A protocol is an agreed set of rules for exchanging data. Different jobs call for different rules. To see how the layers cooperate, imagine uploading the photograph over an HTTPS connection using HTTP/1.1 and TCP.

LayerIts job in this upload
ApplicationHTTP describes the upload request. HTTPS uses TLS to protect the HTTP exchange.
TransportTCP provides a reliable, ordered byte stream. Sequence numbers identify positions in the stream, acknowledgements report progress, and missing data can be retransmitted. Ports identify the communicating endpoints within each host.
InternetIP carries the TCP segments in packets. Routers use destination IP addresses to select the next hop. IP alone gives no guarantee of arrival or order.
LinkWi-Fi or Ethernet carries the IP packet in a frame across a local link. When a router forwards the packet, it prepares it for the next link in a new frame.

Now go back to Wireshark. In your ping capture, expand the IPv4 header and find its Protocol field. It identifies ICMP. There are no TCP ports or TCP acknowledgements to find in this exchange. The echo reply is generated by ICMP itself. This is a neat way to discover why the name “TCP/IP” can mislead a student into expecting TCP inside every packet.

A five-minute challenge for the classroom

Write THE, BLUE, BOAT and WON on four slips of paper. Include a trailing space on each of the first three slips, shown as an empty box. Give each the same destination and mark the four starting byte positions: 1, 5, 10 and 15, counting the spaces in “THE BLUE BOAT WON”. Hand them to a receiver in the order 10, 1, 15. Keep the slip marked 5.

The receiver can see later material has arrived, yet still has a gap after “THE ”. Ask: What is the next byte position you need? Once the missing slip arrives, the receiver can reconstruct the sentence. The slips simplify TCP, but their labels capture an important detail: TCP counts positions in a stream of bytes. The router’s job was to forward each piece towards its destination. The receiving endpoint restores the order.

For OCR A Level Computer Science H446, section 1.3.3, try this exam-style question: A student uploads a photograph using TCP/IP. Explain how the network forwards the data and how the receiving computer can recover the original byte stream if some data arrives out of order.

A strong answer links actions to the responsible protocol. IP packets carry destination addresses. Each router uses its forwarding table to choose a next hop. Packets may arrive out of order or go missing. The receiving TCP implementation uses sequence numbers to put the bytes in order, and TCP’s acknowledgement and retransmission mechanisms allow missing data to be sent again.

What the photograph leaves out

When the photograph opens at the sailing club, the join between two pieces of data is invisible. Every pixel of the mainsail is back where it belongs. The most revealing moment in this practical, though, is that blank third line in the trace. Leave it on the board and ask a student to finish this sentence: “I know the destination was reachable because…”

“Because row 5 contains a reply” is a small answer with a lot behind it. The student has distinguished forwarding a packet from answering a probe, read the evidence and resisted filling a gap with a guess. That is a worthwhile result from typing a single command.

Further reading

No comments:

Post a Comment

Packets: How Does Your Data Actually Cross a Network?

  Packets: How Does Your Data Actually Cross a Network? Imagine I take a photograph of Champagne , our Thames A-Rater, and send it to someon...