When we look at data in a network we can look ‘horizontally’ at a single layer in the network stack or ‘vertically’ as data moves up and down the stack between adjacent layers.

Same Layer Interaction

Same layer interaction is when we look at communication between two devices using a single protocol at a single layer. It allows us to abstract away higher and lower layers to focus on the services provided by the given layer.

For example, we might look at same-layer interaction between a web browser and a web server at the application layer, ignoring how the lower layers are transporting the data. Another example is looking at the route an IP packet takes across a network – addresses and routing – without needing to know what physical media is used or what application layer protocol is being transported.

Adjacent Layer Interaction

On a given network device, it will likely provide some form of network stack. On a switch, this could just support the Link Layer, whereas on a router it could be the Link Layer and the Internet Layer. A computer supports all layers of the TCP/IP network stack. Each layer provides a service to the layer above it. Adjacent-layer interaction is the service provided from one layer to the layer above and the passing of data between these layers in the network stack. It allows us to abstract away different parts of the network so that someone writing an application doesn't have to reimplement the low-level networking technology every time.

For example at the transport layer, TCP provides data sequencing to the layer above. Data received by the transport layer can then be passed to the application layer program without that program having to worry about the order in which the data was received.

Adjacent Layer Interaction Example

When sending an email, you might use SMTP (Simple Mail Transfer Protocol) which enables a sender to communicate with a receiver using a command/reply sequence.

SMTP is an application layer protocol which relies on TCP at the adjacent layer below (the transport layer) to ensure that the email data is sent and then received, error-free, and in the correct order by the recipient.

This provides a useful level of abstraction so that SMTP can focus on the email commands and not have to worry about lower-level details like error checking or sequence numbers.


As data is passed to a lower adjacent layer, that layer will add a header (and possibly also a trailer) before passing it to the layer below. This process of wrapping up higher layer data in a header and/or trailer is called encapsulation. The higher-layer data being encapsulated is often referred to as the payload or 'client data'.

When the data is passed back up the stack, each layer pops off its respective header/trailer – this is called decapsulation or de-encapsulation.

Protocol Data Units

At each layer, we refer to the combination of header/trailer and the data being encapsulated as a Protocol Data Unit (PDU).

In TCP/IP, each layer has specific terminology for a PDU:

  • Transport Layer: Segment

  • Internet Layer: Packet

  • Link Layer: Frame

Encapsulation and De-encapsulation Example

When sending an email with SMTP, the data goes through a process of encapsulation and de-encapsulation.

  1. The SMTP data will be encapsulated in a TCP segment which will add a header with some extra information for sequencing and error checking (amongst other things).

  2. The data provided by the transport layer (the full TCP segment) has an IP header added as it is encapsulated in an IP packet. This adds information like the source and destination IP addresses.

  3. The IP packet is encapsulated by an Ethernet header and trailer to become a frame.

When the frame reaches its final destination, the process is reversed:

  1. The computer de-encapsulates the IP packet from the frame.

  2. It checks the destination IP address belongs to this computer and then de-encapsulates the data in the IP packet and passes it up to the transport layer.

  3. The transport layer de-encapsulates the SMTP data from the TCP segment.

  4. The application layer receives the SMTP data and presents it to the user as an email.

Other Related Skills

UDP is a simple transport layer protocol.
TCP is probably the most widely used protocol at the transport layer.
At the data-link layer, Ethernet provides an interface between the physical layer and the higher network layers. It also specifies MAC address formats.