The process of adding and removing headers as data moves through the layers.
Encapsulation is a fundamental concept in layered network models. It describes the process of wrapping data with protocol information at each layer of the sending device. Think of it as preparing a letter for mail. You start with your message (the application data). At the Transport layer, a header (like a TCP or UDP header containing port numbers) is added, turning the data into a 'segment' or 'datagram'. This segment is then passed down to the Network layer, which adds its own header (an IP header containing source and destination IP addresses). This new unit is now called a 'packet'. The packet is passed down to the Data Link layer, which adds another header and a trailer (containing MAC addresses and error-checking information), creating a 'frame'. Finally, the Physical layer converts the frame into a stream of bits for transmission over the network medium. Each layer only needs to understand its own header; it treats everything it receives from the layer above as a payload. On the receiving end, the reverse process, known as de-encapsulation, occurs. As the data moves up the stack, each layer reads and removes its corresponding header, processes the information, and passes the remaining payload up to the next layer. The Data Link layer strips off the frame header, the Network layer strips off the packet header, and so on, until the original application data is delivered to the receiving application. This process ensures that each layer can perform its function independently without needing to know the details of the other layers.