Article
IP packets
You send a photo to a friend on the other side of the world. The photo is millions of bytes long. Does the Internet push the whole photo down one cable in a single piece? No. The photo is cut into many small pieces first, and each piece travels on its own.
A message becomes packets
A packet is one small piece of a message, sent together with some labels. The Internet does not send "a photo" or "an email". It only sends packets.
A message becomes packets and is rebuilt
Message
One photo, millions of bytes
cut upPackets
Small pieces, each with a header
sent separatelyInternet
Packets may take different routes
arriveRebuilt
The receiver uses the packet numbers
Every packet has two parts:
- The data: a small piece of the real message, such as a part of your photo.
- The header: labels that help the Internet deliver the packet.
Here is what one packet could look like:
One packet
Header
source address 203.0.113.7destination address 198.51.100.20packet number 2labels that help the Internet deliver the packet
Data
part of the photoone piece of the real message
The header uses IP addresses, the addresses you met in the last lesson. The source address says where the packet came from. The destination address says where it is going. Most packets also carry a packet number, which says which piece of the message this is. That number matters later, when the pieces must be put back together.
The rules for how packets are built and addressed are called IP, the Internet Protocol. A protocol is a set of rules that everyone agrees to follow, so that different devices can understand each other.
Check your understanding
Which part of a packet tells the Internet where the packet is going?
Why use small pieces?
Cutting a message into packets looks like extra work, but it has three big advantages:
- Sharing. Many people can use the same cable at the same time, because their packets take turns. One huge file cannot block everyone else.
- Fixing problems. If one packet is lost, only that small piece needs to be sent again, not the whole message.
- Flexibility. Each packet can use a different path if one path is busy or broken. You will see this in the next article.
Worked example: counting packets
Suppose a message is 2,500 bytes long, and one packet can carry at most 1,000 bytes of message data.
- Packet 1 carries 1,000 bytes.
- Packet 2 carries 1,000 bytes.
- 500 bytes are left over, so packet 3 carries those 500 bytes.
2,500 divided by 1,000 is 2.5, but you cannot send half a packet. The last, smaller piece still needs its own packet, so you round up: 3 packets.
Check your understanding
A message is 6,200 bytes long. Each packet can carry at most 2,000 bytes of message data. How many packets are needed?
Common mistakes
- "A packet is the whole message." No. A message is usually many packets.
- "A packet only holds data." No. The header is part of every packet, and the Internet cannot deliver a packet without it.
- "The packet number is the same as the address." No. Addresses say where a packet goes. The number says which piece it is.
- Rounding down. If a division leaves a remainder, you still need one more packet for it.
On the exam
You may be asked what a packet contains, or why data is sent in packets. Remember: a packet has a header (addresses and other labels) and data (a piece of the message), and small packets make it possible to share cables and to resend only what was lost.
Key words
Packet: a small piece of a message, sent with a header.
Header: the labels at the front of a packet, such as the source address, the destination address and the packet number.
Data: the part of a packet that carries a piece of the real message.
Source address: the IP address of the device that sent the packet.
Destination address: the IP address of the device the packet is going to.
Protocol: a set of agreed rules for how devices communicate.
IP (Internet Protocol): the protocol that gives packets their addresses and moves them across the Internet.