Packets and layers
Networks split the job of sending a message into layers, and each layer wraps the message in its own envelope. Follow one 38-byte web request as TCP, IP and Ethernet each add a header on the way down, it crosses the cable as bits, and the receiver unwraps it layer by layer.
5 quick questions
Pick an answer to see why. Your score saves with your progress.
01In what order are the headers added as a message goes down the sender's stack?
The transport layer (TCP) wraps the data first, IP wraps that segment, and Ethernet wraps the packet last. So the Ethernet header is the outermost one and is the first part of the frame on the wire.
02The data is 38 bytes. How big is the Ethernet frame with minimum TCP and IPv4 headers?
38 + 20 (TCP) + 20 (IPv4) + 14 (Ethernet header) + 4 (FCS) = 96 bytes, which is 768 bits.
03What do we call the data plus a TCP header?
Transport layer: segment. Internet layer: packet. Link layer: frame. On the cable: bits.
04Which header holds the MAC addresses?
MAC addresses name network cards on the same local link, so they belong to the link layer (Ethernet). IP addresses are in the IPv4 header; port numbers are in the TCP header.
05In the OSI model, which layer number is the network layer, where IP lives?
OSI layer 3 (network) matches the TCP/IP internet layer. Layer 2 is data link (Ethernet), layer 4 is transport (TCP), layer 7 is application.
Glossary
- Layer
- One part of the networking job, done by its own piece of software or hardware. Each layer serves the one above and uses the one below.
- Encapsulation
- Wrapping data in a header (and sometimes a trailer) as it goes down the layers. The receiver removes them in reverse order.
- Header
- Extra bytes a layer puts in front of the data, with the information that layer needs, such as addresses or port numbers.
- Segment
- The data plus a TCP header: the transport layer's unit.
- Packet
- A segment plus an IP header: the internet layer's unit, also called a datagram.
- Frame
- A packet plus an Ethernet header and FCS trailer: the link layer's unit.
- FCS
- Frame check sequence: a 4-byte CRC-32 code at the end of an Ethernet frame. The receiver recomputes it to spot damaged frames.
- OSI model
- A seven-layer reference model (ISO/IEC 7498-1) used to talk about networks. Its layer numbers, like layer 2 and layer 3, are everyday jargon.
Notes and sources
- Header sizes are the minimums (no options): TCP 20 bytes (RFC 9293), IPv4 20 bytes (RFC 791), Ethernet 14 bytes plus a 4-byte FCS (IEEE 802.3). The drawing is not to scale.
- 192.168.1.20 and 192.168.1.30 are private home-network addresses (RFC 1918); the MAC addresses are documentation values (RFC 9542, formerly RFC 7042). Port 51514 is illustrative.
- Not shown: the TCP connection was opened first (the three-way handshake), and the sender found the receiver's MAC address with ARP.
- On the cable each frame is also preceded by 8 bytes of preamble and start-of-frame delimiter, and frames are spaced by a 12-byte gap.
- RFC 1122: Requirements for Internet Hosts (the four layers)
- RFC 9293: Transmission Control Protocol (TCP)
- RFC 791: Internet Protocol (IPv4)
- IEEE 802.3: Ethernet
- RFC 1918: Address Allocation for Private Internets
- RFC 9542: IANA considerations for IEEE 802 parameters (documentation MACs; obsoletes RFC 7042)
Quiz Unlocks after the last step.