Protocol layers and encapsulation

Layered architecture

To manage the complexity of network design, network protocols are organized into layers.

Each layer performs specific functions and provides services to the layer above it while relying on services from the layer below.

Benefits of layering:

Drawbacks of layering:

Protocol layers can be implemented in software, hardware, or both:

The TCP/IP stack

The set of protocols across all layers is called a protocol stack.

The Internet protocol stack is commonly called the TCP/IP stack because it is built around the core protocols TCP and IP.

The TCP/IP stack includes five layers:

Layer Responsibilities Examples Data Unit

Application Layer

  • hosts network applications
  • responsible for communication between applications on different end systems

HTTP, SMTP, DNS

Messages

Transport Layer

  • moves application messages between end systems using TCP or UDP
  • TCP: connection-oriented, reliable, flow and congestion control
  • UDP: connectionless, lightweight, no guarantees

TCP, UDP

Segments

Network Layer

  • handles routing and delivery of data between source and destination
  • defines how datagrams are structured and forwarded
  • includes routing protocols to determine paths

IP, routing protocols

Datagrams

Link Layer

  • moves datagrams between adjacent nodes
  • services depend on the specific link-layer protocol used
  • different links may use different protocols along a route

Ethernet, WiFi, PPP

Frames

Physical Layer

  • transmits individual bits over the physical medium
  • protocols are link dependent

twisted-pair copper wire, coaxial cable, fiber optics

Packets/Bits

This stack enables the reliable transmission of data from one application on one device to another across diverse physical and logical paths.

Encapsulation

Encapsulation is the process of wrapping data with protocol-specific headers as it passes through the layers of a network protocol stack.

At the sending host, an application-layer message is passed down the stack:

Each lower layer treats the data from the layer above as its payload:

Encapsulation

Hosts implement all 5 layers but routers and link-layer switches have protocol stacks only for the lower layers:

Hosts, routers and switches contain a different set of layers

Encapsulation can be more complex when messages are split into multiple segments or datagrams that must later be reassembled.

Previous Delay, loss, and throughput All ⏎ Next TCP/IP vs. OSI

A Kemar Joint