PDU (协议数据单元)¶
什么是 PDU? (What is PDU?)¶
PDU(Protocol Data Unit,协议数据单元)是指在网络通信的各个层次上使用的数据封装单元。它代表了不同网络协议之间交换的数据的格式或结构。PDU 包含了传输的数据以及相关的控制信息,以确保数据能够在网络中正确传输。
PDU (Protocol Data Unit) refers to the data encapsulation unit used at various levels of network communication. It represents the format or structure of the data exchanged between different network protocols. A PDU contains the transmitted data and related control information to ensure that data is correctly transmitted across the network.
PDU 在 OSI 模型中的应用 (PDU in the OSI Model)¶
在 OSI 模型的每一层,PDU 都有不同的名称和结构,反映了该层处理数据的方式。以下是 PDU 在 OSI 模型中各层的定义:
In each layer of the OSI model, PDU has different names and structures, reflecting how that layer handles data. Below are the definitions of PDU at each layer of the OSI model:
1. 物理层 (Physical Layer)¶
- PDU 名称 (PDU Name): 比特 (Bits)
- 功能 (Function): 物理层的 PDU 是比特流,即通过电缆、光纤或无线电波传输的 0 和 1 的序列。这些比特是数据的最基本单位,在物理介质上传输。
- The PDU at the Physical Layer is a bitstream, a sequence of 0s and 1s transmitted over cables, fiber optics, or wireless signals. These bits are the basic unit of data transmitted over the physical medium.
2. 数据链路层 (Data Link Layer)¶
- PDU 名称 (PDU Name): 帧 (Frame)
- 功能 (Function): 数据链路层将数据封装成帧,并添加 MAC 地址和错误检测信息(如 FCS)。帧是数据链路层之间传输的基本单元,确保在相邻网络节点之间的可靠传输。
- The Data Link Layer encapsulates data into frames, adding MAC addresses and error detection information (such as FCS). Frames are the basic units of data transfer between Data Link Layers, ensuring reliable transmission between adjacent network nodes.
3. 网络层 (Network Layer)¶
- PDU 名称 (PDU Name): 数据包 (Packet)
- 功能 (Function): 网络层将数据封装成数据包,并添加逻辑地址(如 IP 地址)和路由信息。数据包是在不同网络之间传输的基本单元,用于实现跨越多个网络的通信。
- The Network Layer encapsulates data into packets, adding logical addresses (such as IP addresses) and routing information. Packets are the basic units of data transfer across different networks, enabling communication across multiple networks.
4. 传输层 (Transport Layer)¶
- PDU 名称 (PDU Name): 段 (Segment) 或 数据报 (Datagram)
- 功能 (Function): 传输层将数据封装成段(用于 TCP)或数据报(用于 UDP),并添加传输控制信息,如端口号和序列号。段和数据报确保了端到端的可靠数据传输。
- The Transport Layer encapsulates data into segments (for TCP) or datagrams (for UDP), adding transport control information such as port numbers and sequence numbers. Segments and datagrams ensure reliable end-to-end data transmission.
5. 会话层 (Session Layer)¶
- PDU 名称 (PDU Name): 数据 (Data)
- 功能 (Function): 会话层管理和维护应用程序之间的对话,PDU 通常不做进一步封装,直接处理传输层的数据。
- The Session Layer manages and maintains dialogs between applications. The PDU is typically not further encapsulated and directly handles the data from the Transport Layer.
6. 表示层 (Presentation Layer)¶
- PDU 名称 (PDU Name): 数据 (Data)
- 功能 (Function): 表示层负责数据的格式转换、加密和解密,PDU 也是以数据的形式存在。
- The Presentation Layer is responsible for data format conversion, encryption, and decryption. The PDU also exists in the form of data.
7. 应用层 (Application Layer)¶
- PDU 名称 (PDU Name): 数据 (Data)
- 功能 (Function): 应用层为用户应用提供网络服务,PDU 形式为数据,直接供应用程序使用。
- The Application Layer provides network services for user applications. The PDU is in the form of data, directly used by applications.
PDU 的重要性 (Importance of PDU)¶
PDU 的概念对于理解网络协议栈如何工作至关重要。每一层的 PDU 都包括上一层的 PDU,并添加该层的特定控制信息,这就是所谓的“封装”过程。通过这种封装,不同层的协议可以相互协作,确保数据在复杂的网络环境中安全、准确地传输。
The concept of PDU is crucial for understanding how the network protocol stack works. Each layer's PDU includes the PDU of the previous layer and adds specific control information for that layer, a process known as "encapsulation." Through this encapsulation, protocols at different layers can work together, ensuring that data is transmitted securely and accurately in complex network environments.
总结 (Summary)¶
PDU 是在网络通信中各层之间传输的基本单元。它们在每一层的定义和结构不同,反映了该层的功能和目标。理解 PDU 如何在网络各层中流动和转换,是掌握网络协议和通信机制的关键。
A PDU is the basic unit of transfer between layers in network communication. Its definition and structure vary at each layer, reflecting the functions and objectives of that layer. Understanding how PDUs flow and transform through the layers is key to mastering network protocols and communication mechanisms.