The Data Link Layer

a link-layer frame

If a network-layer packet is the letter, a link-layer frame is the envelope used for one leg of its journey. The frame holds the packet inside it, and wraps it with everything the next hop needs to deliver and check it: addresses for this link, markers for where it starts and ends, and a code to detect damage. At the end of the hop the envelope is thrown away and, if the packet must travel further, a fresh envelope is put on for the next leg.

A generic frame has a few standard parts laid out in order. At the front is a header, which carries the source and destination link addresses (MAC addresses on Ethernet and Wi-Fi) and a type field saying what kind of payload is inside, for example an IP packet. In the middle is the payload, the network-layer packet being carried, often with a minimum and maximum size. At the back is a trailer carrying an error-detection field, typically a cyclic redundancy check, computed over the rest of the frame so the receiver can tell if any bit flipped in transit. Around all of this, framing markers tell the receiver where the frame begins and ends.

The frame is the unit the link layer actually moves, error-checks, and (on some links) acknowledges and retransmits. Its size is bounded by the link's maximum transmission unit; a 1500-byte payload limit is the classic Ethernet number. An honest caveat: the addresses in a frame are LOCAL to this link. The destination MAC address is the next node on this hop, not the final destination — that final address lives in the IP packet inside, untouched.

An Ethernet frame, simplified: [dest MAC | src MAC | type=IPv4 | ...IP packet payload... | CRC]. The receiver reads the destination MAC to decide whether the frame is for it, the type to know it holds IP, and the CRC to check nothing got corrupted.

Header, payload, trailer: the three standard parts of a generic frame.

The frame's addresses change at every hop; the IP packet's addresses do not. Strip away the link-layer envelope and the same network-layer letter is still inside.

Also called
frameL2 frame訊框第二層訊框