Question: How do the encapsulation work in TCP/IP network?

Simple explanation, the encapsulation means the lower layer of TCP/IP protocol suite would wrap (encapsulate) the upper layer’s data, header and add its own header/footer with protocol information, then send to lower layer again till the encapsulated data is sent out to other networking device, finally the unwrapping (decapsulation) process on the received data would be enforced at the destination.

As an example, when you send a message to your friend’s computer using chat program, the message data is passed from Application layer (chat program) to Transport layer. The Transport layer wraps (encapsulates) the entire data and adds the TCP header/footer (it can be udp data/footer depending on application) , after that send to lower layer, Internet layer. The Internet layer wraps the received data and adds the IP header/footer, sends to Network Access layer. The same process happens in Network Access layer and then the encapsulated data is sent through physical network link to the Internet.

When the encapsulated data arrived at the destination computer, the unwrapping (decapsulation) process would happen. The Network Access layer removes its frame header and footer from the encapsulated data, moves it to upper layer, Internet layer. The Internet layer would also remove the IP header/footer and pass the remains to Transport layer. The same process happens in Transport layer and the original data is passed to Application layer. Your friend would then see the message you typed at last.

Encapsulation