2.6 PPP: Point-to-Point Protocol
PPP
点到点协议
PPP, the Point-to-Point Protocol, corrects all the deficiencies in SLIP. PPP consists of three components.
PPP
,点到点协议,更正了所有
SLIP
的不足,
PPP
由
3
部分组成。
A way to encapsulate IP datagrams on a serial link. PPP supports either an asynchronous link with 8 bits of data and no parity (i.e., the ubiquitous serial interface found on most computers) or bit-oriented synchronous links.
作为在串行链路上封装
IP
数据报的一种方式。
PPP
既是个非同步
8
比特数据非奇偶性(例如,多数电脑中无处不在的串行接口)或者定向比特的同步链路。
A link control protocol (LCP) to establish, configure, and test the data-link connection. This allows each end to negotiate various options.
链路控制协议(
LCP
)用于建立,配置和测试数据链路的连接。其允许两端协商各种选项。
A family of network control protocols (NCPs) specific to different network layer protocols. RFCs currently exist for IP, the OSI network layer, DECnet, and AppleTalk. The IP NCP, for example, allows each end to specify if it can perform header compression, similar to CSLIP. (The acronym NCP was also used for the predecessor to TCP.)
网络控制协议族(
NCPs
)具体到不同网络层协议。
RFCs
如今有
IP
,
OSI
网络层,
DECnet
,以及
Apple Talk
。
IP NCP
,例如,允许两端确认是否可执行头部压缩,与
CSLIP
相似。(
NCP
缩写,同样用于
TCP
前身。)
RFC 1548 [Simpson 1993] specifies the encapsulation method and the link control protocol. RFC 1332 [McGregor 1992] specifies the network control protocol for IP.
RFC 1548
说明了封装方式及链路控制协议。
RFC 1332
说明了
IP
的网络控制协议。
The format of the PPP frames was chosen to look like the ISO HDLC standard (high-level data link control). Figure 2.3 shows the format of PPP frames.
PPP
帧的格式选出类似
ISO HDLC
标准(高层数据链路控制)。图
2.3
显示了
PPP
帧的格式。
Figure 2.3. Format of PPP frames.
图
2.3 PPP
帧格式
Each frame begins and ends with a flag byte whose value is 0x7e. This is followed by an address byte whose value is always 0xff, and then a control byte, with a value of 0x03.
每个帧头尾是一个值为
0x7e
的标记字节。其后为地址字节值为
0xff
,再后为控制字节,值为
0x03
。
Next comes the protocol field, similar in function to the Ethernet type field. A value of 0x0021 means the information field is an IP datagram, a value of 0xc021 means the information field is link control data, and a value of 0x8021 is for network control data.
其后为协议区域,与以太网的类型区域功能相似。值
0x0021
表示信息区域是个
IP
数据报,值
0xc021
表示信息区域是链路控制数据,值
0x8021
是网络控制数据。
The CRC field (or FCS, for frame check sequence) is a cyclic redundancy check, to detect errors in the frame.
CRC
区域(或
FCS
,帧校验序列)是个循环冗余校验,检测帧中的错误。
Since the byte value 0x7e is the flag character, PPP needs to escape this byte when it appears in the information field. On a synchronous link this is done by the hardware using a technique called bit stuffing [Tanenbaum 1989]. On asynchronous links the special byte 0x7d is used as an escape character. Whenever this escape character appears in a PPP frame, the next character in the frame has had its sixth bit complemented, as follows:
值
0x7e
是标示特征,
PPP
需要转义这个字节,当其出现在信息区域。在同步链路中,一个叫做比特填充的硬件实现此功能。在非同步链路中,特殊字节
7d
用于转义字符。无论此转义特征是否在
PPP
帧中出现,下一个帧中的字符有如下的第六个比特的补充:
The byte 0x7e is transmitted as the 2-byte sequence 0x7d, 0x5e. This is the escape of the flag byte.
0x7e
被
0x7d
和
0x5e
两个字节替代。这是转义标示字节。
The byte 0x7d is transmitted as the 2-byte sequence 0x7d, 0x5d. This is the escape of the escape byte.
字节
0x7d
被
0x7d
、
0x5d 2
个字节替代。
By default, a byte with a value less than 0x20 (i.e., an ASCII control character) is also escaped. For example, the byte 0x01 is transmitted as the 2-byte sequence 0x7d, 0x21. (In this case the complement of the sixth bit turns the bit on, whereas in the two previous examples the complement turned the bit off.)
默认,一个值低于
0x20
的字节(
ASCII
控制字符)也要转义。例如,字节
0x01
被
2
个字节
0x7d
和
0x21
替代。(这时,第六个比特的完整填充打开,鉴于之前的
2
个例子,完整比特关闭。)
The reason for doing this is to prevent these bytes from appearing as ASCII control characters to the serial driver on either host, or to the modems, which sometimes interpret these control characters specially. It is also possible to use the link control protocol to specify which, if any, of these 32 values must be escaped. By default, all 32 are escaped.
这么做的原因是阻止这些字节出现
ASCII
控制字符到任何主机上的串行驱动器,或到猫,有时会特殊的翻译这些控制字符。也可以是链路控制协议区别这些,总之,这
32
个值必须被转义。默认,所有的
32
都被转义。
Since PPP, like SLIP, is often used across slow serial links, reducing the number of bytes per frame reduces the latency for interactive applications. Using the link control protocol, most implementations negotiate to omit the constant address and control fields and to reduce the size of the protocol field from 2 bytes to 1 byte. If we then compare the framing overhead in a PPP frame, versus the 2-byte framing overhead in a SLIP frame (Figure 2.2), we see that PPP adds three additional bytes: 1 byte for the protocol field, and 2 bytes for the CRC. Additionally, using the IP network control protocol, most implementations then negotiate to use Van Jacobson header compression (identical to CSLIP compression) to reduce the size of the IP and TCP headers.
PPP
,如同
SLIP
,用于通过慢速串行链路,减少每个帧中的字节数,以减少交互程序的延时。使用链路控制协议,多数应用协商省略恒定地址和控制区域以减少协议区域大小从
2
字节到
1
字节。如果我们比较
PPP
帧中成帧的开销,与
SLIP
帧(图
2.2
)
2
字节成帧开销相比,我们发现
PPP
添加三个额外的字节,
1
字节为协议区域,
2
字节为
CRC
。此外,使用
IP
网络控制协议,多数应用协商使用
Van Jacobson
头部压缩(等同于
CSLIP
压缩)以减少
IP
和
TCP
头部的大小。
In summary, PPP provides the following advantages over SLIP: (1) support for multiple protocols on a single serial line, not just IP datagrams, (2) a cyclic redundancy check on every frame, (3) dynamic negotiation of the IP address for each end (using the IP network control protocol), (4) TCP and IP header compression similar to CSLIP, and (5) a link control protocol for negotiating many data-link options. The price we pay for all these features is 3 bytes of additional overhead per frame, a few frames of negotiation when the link is established, and a more complex implementation.
总之,
PPP
提供比
SLIP
如下优势:
1
、单一串行链路支持多协议,不仅是
IP
数据报,
2
、每个帧的循环冗余校验,
3
、对端动态协商
IP
地址(使用
IP
网络控制协议),
4
、
TCP
和
IP
头部压缩类似
CSLIP
,
5
、链路控制协议用于协商许多数据链路选项。这些特征的代价仅为每帧
3
字节的额外开销,链路建立是的一些协商帧,以及一些复杂的实现。
Despite all the added benefits of PPP over SLIP, today there are more SLIP users than PPP users. As implementations become more widely available, and as vendors start to support PPP, it should (eventually) replace SLIP.
忽略所有
PPP
对比
SLIP
带来的好处,如今有更多的
SLIP
用户。随着应用的广泛增加,而且随着厂商开始支持
PPP
,它将最终取代
SLIP
。