📡

Understanding Protocol Data Units and Encapsulation

May 23, 2025

Lecture Notes on Protocol Data Units (PDU) and Encapsulation

Key Concepts

  • Protocol Data Unit (PDU): A unit of data at any layer of the OSI model.
    • Also known as transmission units.
    • Example: Ethernet frames transfer data between MAC addresses.

Layered Communication

  1. Ethernet (Layer 2)

    • Encapsulates data in Ethernet frames.
    • Ethernet does not concern itself with inner data; it just transmits frames.
  2. IP Layer (Layer 3)

    • Sends data between IP addresses.
    • Can contain UDP or TCP data.
    • IP does not care what's inside the packet, just the source and destination addresses.
  3. Transport Layer (Layer 4)

    • Uses TCP or UDP protocols to transport data.
    • Adds a TCP or UDP header to application data.
  4. Application Layer (Layers 5, 6, and 7)

    • Contains the actual application data (e.g., web browser data).
    • Needs to be encapsulated and sent through the layers.

Encapsulation Process

  • Data flow from application to transport:
    1. Application data is encapsulated with a TCP header.
    2. TCP data is then encapsulated with an IP header.
    3. The entire packet is encapsulated in a DLC frame.
    4. The frame may also contain a trailer.

Decapsulation Process

  • At the destination device:
    1. The frame is received.
    2. The frame header is removed.
    3. The IP header is removed.
    4. The TCP header is removed to access the application data.

Control Information in Headers

  • TCP Flags: Control how data is processed.

    • SYN: Synchronizes sequence numbers.
    • PSH: Pushes data to the application immediately.
    • RST: Resets the connection.
    • FIN: Indicates last packet from sender.
  • IP Header Flags: Mainly deal with fragmentation.

    • Helps manage packet sizes according to network constraints.
    • Maximum Transmission Unit (MTU): The largest size of packet that can be sent.

Fragmentation of Packets

  • If data exceeds MTU, it must be fragmented into smaller packets.

    • Example: If MTU = 16 bytes and data = 44 bytes, three packets will be sent of size 16, 16, and 12 bytes.
  • MTU Setting: Typically set during network design; changes are rare.

  • Fragmentation can slow down traffic flow. Avoiding fragmentation enhances throughput.

Testing MTU

  • Use ping command to test MTU between devices:

    • Use -f to set Don't Fragment bit.
    • Use -l to specify the length of data to send.
    • Example for Ethernet: Maximum size = 1,472 bytes (1,500 bytes - headers).
  • Ping Command Example:

    • ping -f -l 1472 8.8.8.8 to test against Google DNS.
    • Adjust size lower until successful replies are received.

Conclusion

  • Understanding PDUs, encapsulation, decapsulation, and MTU is crucial for efficient network communication.