Card 04/ 09
Bits, Frames, Packets and Segments: What Each Layer Calls Its Data
A frame and a packet are different things at different layers, though people say packet for both.
Each layer of the network stack has its own name for the unit of data it handles: bits at the physical layer, a frame at the data link layer, a packet at the network layer, and a segment or a datagram at the transport layer. The names matter because each one tells you which header is on the outside, and so which device or tool can read it.
In conversation people say "packet" for all of them, and most of the time nothing goes wrong. It goes wrong when the difference is the point. "The switch dropped the packet" sends someone to look at IP routes, when a switch only ever reads frames and the fault is in its table of MAC addresses. "The packet was too big" could mean a frame over the link's limit or a segment over the receiver's window, and those have different fixes.
- Bit
- A single one or zero, sent as voltage, light or radio at the physical layer, layer 1.
- Frame
- The unit at the data link layer, layer 2, with a header holding MAC addresses and a trailer for error checking. It crosses one link only.
- Packet
- The unit at the network layer, layer 3, with a header holding the source and destination IP addresses. It crosses many networks.
- Segment
- The unit TCP sends at the transport layer, layer 4, with a header holding ports and sequence numbers.
- Datagram
- The unit UDP sends at the transport layer, a self-contained message with ports but no sequence numbers.
- Message
- What the application layer sends, such as one HTTP request or one DNS query, before any transport header is added.
The layer numbers and the units go together, so one can be read from the other. A "layer 2 problem" is a problem with frames: a cable, a switch, a Wi-Fi association. A "layer 3 problem" is a problem with packets: an address, a route, a firewall rule on IP addresses.
One packet travels inside many frames during its trip. Each link wraps the same packet in a new frame, so the frame on the first link and the frame on the last share nothing but the packet inside them.
So use the precise word whenever a fault is being described, because it tells the person reading which device to look at and which header to inspect.
← → move through sections and cards