0

I have read in many tutorials that Encapsulation is when the data go down the OSI model or the TCP/IP model and a header is added to it at each layer, and Decapsulation is when the data+headers go up the OSI model or the TCP/IP model and a header is removed at each layer.

But are Encapsulation and Decapsulation is really what happens inside an operating system, or are Encapsulation and Decapsulation just a theoratical concept that isn't really implemented in operating systems?

1
  • If you capture a frame on the network, you will see that there is actually a frame (header, payload, FCS), and the frame payload is a packet (header, payload), and the packet payload is a transport PDU, etc. The application did not create the encapsulations, and they are really there (switches use the frame header and routers use the packet header), so they were put on in a process that the application used to send its data.
    – Ron Maupin
    Aug 20, 2022 at 16:15

1 Answer 1

2

Encapsulation (prepending of lower-layer header) and decapsulation (removal of that header) happen within each layer.

The "payload" (SDU data) to send is passed from the higher layer, possibly along with some metadata. Then the layer creates its header, embeds (encapsulates) the payload to create its PDU and passes that down the stack to the next lower layer. The physical layer is an exception, it encodes the "payload" for the physical link and moves the encoded bits from one place to the other. When data is received all the steps above happen in reverse.

This answer shows the encapsulation in more detailed example.

Whether that happens within a host OS, inside a NIC, in a switch, router, ... is a matter of implementation. Traditionally, physical layer encoding and data link layer encapsulation happen inside a NIC, network and transport layer encapsulation in the OS's stack, application layer encapsulation in the actual application. Today, many functions have been "offloaded" down the layer stack, so a NIC can also be responsible for network and transport layer functions, including encapsulation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.