What is a protocol data unit (PDU)?
In networking, a protocol data unit (PDU) is the basic unit of exchange between entities that communicate using a specified networking protocol. When working with a multilayer protocol stack, like the TCP/IP networking suite, use of the correct PDU is important when discussing protocol interactions.
Networking protocols, especially those developed in the framework of a layered reference model, like the seven-layer Open Systems Interconnection (OSI) model or the five-layer TCP/IP model, define their units of data exchange between networked entities. For example, packet is the PDU for IP, which defines interactions between hosts identified by IP addresses at the network layer.
When a host is connected to the internet through an Ethernet network, IP packets are incorporated into Ethernet frames to be transmitted between network interface cards. The PDUs most often carried within IP packets are datagrams when using the User Datagram Protocol (UDP) transport protocol or segments when using TCP. These two transport layer protocols mediate communication between processes (programs), and the datagram and segment are the units of exchange between processes running on the network hosts.
While the PDU is the unit of exchange between communicating entities, the service data unit (SDU) is the unit of data to be delivered over data networks. The SDU can be thought of as the message to be delivered by the next lower protocol layer, which that lower layer protocol incorporates as the payload of its PDU.
What does a PDU contain?
The format and function of a protocol's PDU are set in the protocol specification. To be compliant with a protocol specification, a protocol implementation must be able to accept PDUs sent by other compliant implementations, as well as be able to compose PDUs that other implementations accept as valid.
The PDU defines what a protocol message should look like, and PDUs typically consist of the following:
- Protocol header, a sequence of fields that contain specific data about the PDU. Most protocol headers include fields for a destination address and a source address. Protocol headers can be fixed length or variable length, depending on the protocol specification.
- Protocol body or payload, the information being transmitted by the protocol.
- Protocol trailer, a sequence of bits attached to the PDU, after the payload. Protocol trailers are most commonly encountered in data link layer (Layer 2) protocols; at higher layers, PDU length is signaled in a header field. PDU trailers are a part of the Ethernet protocol, where a four-octet (32-bit) field containing a cyclic redundancy check, or CRC, value for the Ethernet frame follows the payload of the frame.
Protocols that define specific word lengths -- groupings of multiple bits or bytes used to expedite processing -- may require padding some sections of the header or PDU with bits with values of either zero or one. Many networking protocols call for the processing of network data in 32-bit groups, so if the PDU has a remainder of fewer than 32 bits, it is augmented with padding.
How do PDUs work?
PDUs enable the interoperable transmission of data across internetworks -- networks of networks -- through the use of encapsulation.
Consider the following example:
Alice, using an application layer protocol -- it doesn't matter which one; it could be a file transfer protocol or some other application -- requests a file be transferred from a remote server to her local host. The file contains 10,000 bytes of data.
To request the file, Alice uses a client application -- e.g., a browser -- that drafts a request to the remote server application for the file.
Having received the request, the remote server begins to send the file.
In general, most of the functions assigned to the upper layers of the OSI model -- application layer, presentation layer and session layer -- are incorporated in the application layer of the TCP/IP model. Most application layer protocols use messages as their PDUs. For simplicity, the focus in this example is on how the file is sent from the server to Alice's client using the lower layers of the OSI model: the transport, network, data link and physical (hardware) layers.
The file is passed into the lower layers of the protocol stack for transmission over the necessary data networks that separate Alice from the remote server.
The process proceeds as follows:
- The file is treated as a unit of data that the application layer protocol handles. In this case, it is a 10,000-byte file.
- The application layer protocol passes this SDU to the protocol operating at the next layer. In this case, the application passes the file to the relevant transport layer protocol -- probably TCP.
- The TCP implementation accepts the SDU and prepares it for transmission by encapsulating the file into TCP segments. The file may be divided into chunks of 1,000 bytes, or octets, each of which is addressed to the appropriate port on the client host machine. Port numbers are numbers used to address processes running on a host. A process can be uniquely identified by the combination of the host's IP address and the port number assigned to the process. The result is a TCP segment that includes header information, like the source and destination ports for the payload, as well as the length of the payload and the payload itself. The payload in this case is the SDU received from the application layer.
- The TCP implementation then passes its SDU -- the completed segment -- to the next lower layer, the internet layer.
- The IP implementation treats this TCP segment as its payload, to which is added a set of IP packet headers indicating the IP addresses of the source and destination hosts, and other required IP header fields.
- Assuming the remote server is connected to the internet through an Ethernet interface, the server's Ethernet implementation then accepts this IP packet as the SDU payload for an Ethernet frame, which is the PDU for Ethernet networks. The Ethernet frame contains a set of headers -- and a trailer -- which include source and destination media access control (MAC) addresses. These are the addresses of the network interfaces of the server (source) and the nearest router for routing onto the internet (destination).
- The next step is for the server host to physically transmit the Ethernet frame onto its local network. At the physical layer, the basic unit of data exchange is the bit. The Ethernet frame is converted into electronic signals for ones and zeros that are physically transmitted onto the local area network (LAN).
- Once the bits of the Ethernet frame are physically received by the local router, they are reconverted into an Ethernet frame. The local router recognizes that the frame is directed to it by the MAC address and then strips off the Ethernet header and trailer to reveal the IP packet carried inside the Ethernet frame payload.
- The local router's IP implementation then examines the IP packet for the destination address. The router then forwards the packet to another router if it needs to be forwarded out to the internet or to its destination if the destination is local. This process repeats until the IP packet arrives at Alice's host.
The encapsulation process is reversed, known as decapsulation, when it arrives at a destination. When an Ethernet frame is sent to a local router, the router only needs to decapsulate the frame to determine the next internet layer hop. Once the packet arrives at Alice's host, the process is reversed:
- Alice's host receives signals on a network interface (Ethernet) addressed to that interface.
- The Ethernet implementation accepts the frame and sees that the MAC address of the Ethernet payload matches that of Alice's host. The Ethernet header and trailer are stripped off to reveal the IP packet, which is passed as an SDU to the IP implementation.
- The IP implementation strips off the IP headers to reveal the TCP segment, which is then passed up to Alice's TCP implementation.
- The TCP implementation recognizes the segment's destination TCP port used by Alice's application. The payload of the segment, which contains a chunk of the file being transmitted, is then passed along to the application program Alice is using.
- The application protocol accepts that fraction of the sent file, and the entire process repeats until the requested file has been received.
This explanation is simplified for clarity. For example, most IP packets are no longer than 1,500 octets (bytes) because that is the maximum transmission unit length for many Ethernet networks. IP packets larger than that are likely to need to be fragmented during their internet transit, which is undesirable because it can slow transmissions significantly.
PDUs for commonly used protocols
Although internet transmissions are all contained in IP packets, those packets also usually encapsulate other protocols, such as those used in the transport layer or the application layer. Further, IP packets are, in turn, encapsulated in data link layer protocols. The IP packet is an SDU for LAN technologies, such as those used in Ethernet or asynchronous transfer mode (ATM) networks.
Commonly used PDUs are listed in the following table.
PDU name | OSI reference model layer | TCP/IP reference model layer | Protocol | Notes |
message |
application layer |
application layer |
most application layer protocols, including Hypertext Transfer Protocol Secure (web), Simple Mail Transfer Protocol (email) and Secure Shell (terminal emulation and IP tunneling) |
Application layer PDUs are conventionally referred to as messages. |
segment |
transport layer |
transport layer |
TCP |
|
datagram |
transport layer |
transport layer |
UDP |
|
packet |
transport layer |
transport layer |
Stream Control Transmission Protocol (SCTP) |
The PDU is called a packet; SCTP packets are composed of an additional unit called a chunk. |
packet |
network layer |
internet layer |
IP |
IP packets are also referred to as datagrams. |
frame |
data link layer |
network interface layer |
Ethernet |
|
cell |
data link layer |
network interface layer |
ATM |
|
bit |
physical layer |
physical hardware |
physical network media |
Multilayer protocols stacks use different protocols to communicate at different layers, all while enabling interoperability between systems using different software applications, operating systems and physical network types -- all capable of interoperating across geographic and technological boundaries. Find out more about how the TCP/IP and the OSI reference models differ.