I was wondering how the message changes its form or structure while passing through multiple layers.

Consider host 'A' sending "Hello" as message to host 'B'. enter image description here

So how it changes its form while getting through different layers and devices?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Dec 25 '18 at 8:15

The message itself doesn't change. Generally, higher layer data is encapsulated in lower layer protocol overhead, transported along - the lower layer protocols likely change along the way - and pieced together at the end again.

For instance, an application on host A sends a UDP message to an application on host B, containing the string "Hello":

  1. host A's IP stack encapsulates "Hello" in a UDP datagram, labeled for the destination application's UDP port
  2. the stack encapsulates the datagram in an IP packet, labeled for host B
  3. host A's NIC encapsulates the IP packet in an Ethernet frame, labeled for the router
  4. the NIC line-encodes the frame, encapsulates it in an Ethernet packet, and transmits it to the switch
  5. the switch decodes the Ethernet packet, forwards the frame through the router's port, and line-encodes the frame once again into an Ethernet packet
  6. the router decodes the Ethernet packet, extracts the frame, extracts the IP packet, and forwards the packet through the port facing host B; the packet is Ethernet framed (labeled for host B), line-encoded and transmitted to the switch
  7. see 5.
  8. on host B, steps 4. to 1. are reversed and the UDP payload is passed to the application

I've omitted some details for simplicity (forwarding decisions, IP senders ARPing the next hop's MAC address, different line codes/PHYs, ...).


Seven-layered approach to data transmission divides the many operations up into specific related groups of actions at each layer
The transmitting computer software gives the data to be transmitted to the applications layer, where it is processed and passed from layer to layer down the stack with each layer performing its designated functions. The data is then transmitted over the physical layer of the network until the destination computer or another device receives it.
During transmission, each layer adds a header to the data that directs and indentifies the packet. This process is called encapsulation. The header and data together form the data packet for the next layer that, in turn, adds its header and so on. As the message is transmitting through various layers various headers are added on top of it

As the message is received , De-encapsulation starts

You can learn about different headers in the layer in any of the networking books.You will find this link helpful:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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