- When a host transmits data across a network to another network or device, the data goes through Encapsulation.
- Encapsulation is a process of wrapping protocol information to the data.
- At each layer PDU is attaches to the data and passed to next layer.
- When the data stream handed to the transport layer, which actually setup virtual circuit with receiving device by sending over a sync packet, it attaches TCP header (PDU) to the data field. This complete piece is now called segment.
- Each segment is sequenced so that at receive end it helps them in rearranging once received.
- Each segment is then passed to the Network Layer for network addressing and routing through internetwork.
- Network Layer adds control header (IP Header) to the segment. This piece is called packet or datagram.
- On receiving end, network layer and transport layer work together to rebuild a data stream.
- Data link layer encapsulates each packet into frame and frame header contains hardware address (mac address) of source and destination.
- If the destination device is on the other network, frame is then sent to router.
- To put this frame on the network, it must be put into a digital signal.
- Since frame is a logical group of 0’s and 1’s, the physical layer is responsible for encoding these digits into digital signals.
- The receiving device will synchronize on the digital signal and extract (decode) signals the 1’ and 0’s from the digital signal.
- Receiving device rebuilds the frame, the run a CRC (Cyclic Redundancy Check) and match against frames FCS field.
- If it matches, Packet is pulled from frame and rest of the part discarded. This process is called de-encapsulation.
- This packet is then passed to the network layer, where the address is checked.
- If address matches, the segment is pulled from the packet and remaining part is discarded.
- The segment is pulled from the packet at transport layer, which rebuilds the data stream and acknowledges to the transmitting station that it received at each piece.
- Data stream is the handed to the upper-layer application.