lrfgjj2 发表于 2011-12-21 08:43

ppp协议详解

<P style="TEXT-INDENT: 21pt; MARGIN: 0cm 0cm 0pt" class=MsoToc1 align=left><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><a href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201106/24/25979788_1308888111yDRr.jpg" target="_blank"></A>用户接入</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Internet</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,在传送数据时都需要有数据链路层协议,其中最为广泛的是串行</SPAN><FONT face="Times New Roman"> </FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">线路网际协议(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SLIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)和点对点协议(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。由于</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SLIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">具有仅支持</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等缺点,主要用于低速(不超过</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">19.2kbit/s</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)的交互性业务,它并未成为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Internet</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的标准协议。为了改进</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">SLIP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,人们制订了点对点</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Point-to-Point Protocol</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">RFC1661</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">RFC1662</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">RFC1663</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: red">PPP</SPAN></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">三大成就:</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="TEXT-INDENT: -15.75pt; MARGIN: 0cm 0cm 0pt 36.75pt; tab-stops: list 36.75pt; mso-list: l0 level1 lfo1" class=MsoNormal><SPAN style="COLOR: red; mso-fareast-font-family: 'Times New Roman'" lang=EN-US><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">1.</FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">明确地划分出一帧的尾部和下一帧的头部的成帧方式。这种帧格式也处理错误检测工作。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="TEXT-INDENT: -15.75pt; MARGIN: 0cm 0cm 0pt 36.75pt; tab-stops: list 36.75pt; mso-list: l0 level1 lfo1" class=MsoNormal><SPAN style="COLOR: red; mso-fareast-font-family: 'Times New Roman'" lang=EN-US><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">2.</FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当线路不再需要时,挑出这些线路,测试它们,商议选择,并仔细地再次释放链路控制协议。这个协议被称为链路控制协议</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">link control protocol</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="TEXT-INDENT: -15.75pt; MARGIN: 0cm 0cm 0pt 36.75pt; tab-stops: list 36.75pt; mso-list: l0 level1 lfo1" class=MsoNormal><SPAN style="COLOR: red; mso-fareast-font-family: 'Times New Roman'" lang=EN-US><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">3.</FONT></SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用独立于所使用的网络层协议的方法来商议使用网络层的哪些选项。对于每个所支持的网络层来说,所选择的方法有不同的网络控制协议</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">NCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">network control protocol</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt 21pt" class=MsoNormal><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">帧不仅能通过拨号电话线发送出去,而且还能通过</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">SONET</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或真正面向位的</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">HDLC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">线路(即路由器与路由器相连)发送出去。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<A name=_Toc533172935></A><A name=_Toc519045023></A><A name=_Toc518886574></A><A name=_Toc518467188><SPAN style="mso-bookmark: _Toc518886574"><SPAN style="mso-bookmark: _Toc519045023"><SPAN style="mso-bookmark: _Toc533172935"><SPAN style="FONT-FAMILY: 黑体">一、<SPAN lang=EN-US>PPP</SPAN>协议组成</SPAN></SPAN></SPAN></SPAN></A><SPAN style="FONT-FAMILY: 黑体" lang=EN-US></SPAN>
<P style="MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">协议有三个组成部分:</SPAN></P>
<P style="MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)一个将</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据报封到串行链路的方法。</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">既支持异步链路(无奇偶校验的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">8</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比特数据),也支持面向比特的同步链路。</SPAN></P>
<P style="MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)一个用来建立、配置和测试数据链路的链路控制协议</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Link Control Protocol</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)。通信的双方可协商一些选项。在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman"></FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中定义了</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">11</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">种类型的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分组。</SPAN></P>
<P style="MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">3</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)一套网络控制协议</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Network Control Protocol</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">),支持不同的网络层协议,如</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">OSI</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的网络层、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">DECnet</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">AppleTalk</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等。</SPAN></P>
<A name=_Toc533172936></A><A name=_Toc519045024></A><A name=_Toc518886575></A><A name=_Toc518467189><SPAN style="mso-bookmark: _Toc518886575"><SPAN style="mso-bookmark: _Toc519045024"><SPAN style="mso-bookmark: _Toc533172936"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: 'Times New Roman'">二、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN></SPAN></SPAN></SPAN></A><SPAN style="mso-bookmark: _Toc518467189"><SPAN style="mso-bookmark: _Toc518886575"><SPAN style="mso-bookmark: _Toc519045024"><SPAN style="mso-bookmark: _Toc533172936"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: 'Times New Roman'">帧格式</SPAN></SPAN></SPAN></SPAN></SPAN>
<P style="MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">帧格式和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">HDLC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">帧格式相似,如图</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">1</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示。<SPAN style="COLOR: red">二者主要区别:</SPAN></SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是面向字符的,而</SPAN><SPAN style="COLOR: red" lang=EN-US><FONT face="Times New Roman">HDLC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; COLOR: red; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是面向位的。</SPAN><SPAN style="COLOR: red" lang=EN-US></SPAN></P>
<P style="TEXT-INDENT: 78.75pt; MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent><SPAN lang=EN-US><a href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201106/24/25979788_13088879910rH0.jpg" target="_blank"><IMG border=0 src="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201106/24/25979788_13088879910rH0.jpg" .load="imgResize(this, 650);" ;></A></SPAN></P>
<P style="TEXT-ALIGN: center; LINE-HEIGHT: 18pt; TEXT-INDENT: 0cm; MARGIN: 0cm 0cm 6pt" class=MsoNormalIndent align=center><SPAN style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">图<SPAN lang=EN-US>1 PPP</SPAN>帧格式<SPAN lang=EN-US></SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 5.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">可以看出,<SPAN lang=EN-US>PPP</SPAN>帧的前<SPAN lang=EN-US>3</SPAN>个字段和最后两个字段与<SPAN lang=EN-US>HDLC</SPAN>的格式是一样的。标志字段<SPAN lang=EN-US>F</SPAN>为<SPAN lang=EN-US>0x7E</SPAN>(<SPAN lang=EN-US>0x</SPAN>表示<SPAN lang=EN-US>7E</SPAN>),但地址字段<SPAN lang=EN-US>A</SPAN>和控制字段<SPAN lang=EN-US>C</SPAN>都是固定不变的,分别为<SPAN lang=EN-US>0xFF</SPAN>、<SPAN lang=EN-US>0x03</SPAN>。<SPAN lang=EN-US>PPP</SPAN>协议不是面向比特的,因而所有的<SPAN lang=EN-US>PPP</SPAN>帧长度都是整数个字节。<SPAN lang=EN-US></SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 5.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">与<SPAN lang=EN-US>HDLC</SPAN>不同的是多了<SPAN lang=EN-US>2</SPAN>个字节的协议字段。协议字段不同,后面的信息字段类型就不同。如:<SPAN lang=EN-US></SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 26.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0x0021</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是<SPAN lang=EN-US>IP</SPAN>数据报<SPAN lang=EN-US></SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 26.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0xC021</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是链路控制数据<SPAN lang=EN-US>LCP</SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 26.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0x8021</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是网络控制数据<SPAN lang=EN-US>NCP</SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 21pt; MARGIN: 6pt 0cm" class=MsoNormal><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0xC023</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是安全性认证<SPAN lang=EN-US>PAP</SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 21pt; MARGIN: 6pt 0cm" class=MsoNormal><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0xC025</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是<SPAN lang=EN-US>LQR</SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 21pt; MARGIN: 6pt 0cm" class=MsoNormal><SPAN style="FONT-FAMILY: 宋体" lang=EN-US>0xC223</SPAN><SPAN style="FONT-FAMILY: 宋体">——信息字段是安全性认证<SPAN lang=EN-US>CHAP</SPAN></SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 5.25pt; MARGIN: 6pt 0cm 6pt -5.25pt" class=MsoNormalIndent><SPAN style="FONT-FAMILY: 宋体" lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体">当信息字段中出现和标志字段一样的比特<SPAN lang=EN-US>0x7E</SPAN>时,就必须采取一些措施。因<SPAN lang=EN-US>PPP</SPAN>协议是面向字符型的,所以它不能采用<SPAN lang=EN-US>HDLC</SPAN>所使用的零比特插入法,而是使用一种特殊的字符填充。具体的做法是将信息字段中出现的每一个<SPAN lang=EN-US>0x7E</SPAN>字节转变成<SPAN lang=EN-US>2</SPAN>字节序列(<SPAN lang=EN-US>0x7D</SPAN>,<SPAN lang=EN-US>0x5E</SPAN>)。若信息字段中出现一个<SPAN lang=EN-US>0x7D</SPAN>的字节,则将其转变成<SPAN lang=EN-US>2</SPAN>字节序列(<SPAN lang=EN-US>0x7D</SPAN>,<SPAN lang=EN-US>0x5D</SPAN>)。若信息字段中出现<SPAN lang=EN-US>ASCII</SPAN>码的控制字符,则在该字符前面要加入一个<SPAN lang=EN-US>0x7D</SPAN>字节。这样做的目的是防止这些表面上的<SPAN lang=EN-US>ASCII</SPAN>码控制字符被错误地解释为控制字符。<SPAN lang=EN-US></SPAN></SPAN></P>
<A name=_Toc533172937></A><A name=_Toc519045025></A><A name=_Toc518886576></A><A name=_Toc518467190><SPAN style="mso-bookmark: _Toc518886576"><SPAN style="mso-bookmark: _Toc519045025"><SPAN style="mso-bookmark: _Toc533172937"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: 'Times New Roman'">三、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN></SPAN></SPAN></SPAN></A><SPAN style="mso-bookmark: _Toc518467190"><SPAN style="mso-bookmark: _Toc518886576"><SPAN style="mso-bookmark: _Toc519045025"><SPAN style="mso-bookmark: _Toc533172937"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: 'Times New Roman'">链路工作过程</SPAN></SPAN></SPAN></SPAN></SPAN>
<P style="LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当用户拨号接入</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">ISP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时,路由器的调制解调器对拨号做出应答,并建立一条物理连接。这时</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机向路由器发送一系列的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">分组(封装成多个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">帧)。这些分组及其响应选择了将要使用的一些</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">参数,接着就进行网络层培植,</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给新接入的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机分配一个临时的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地址,这样</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">PC</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">机就成为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Internet</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上一个主机了。</SPAN></P>
<P style="LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当用户通信完毕时,</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">释放网络层连接,收回原来分配出去的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地址。接着</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">释放数据链路层连接,最后释放的是物理层的连接。</SPAN></P>
<P style="LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上述过程可用图</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">2</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来描述。</SPAN></P>
<P style="LINE-HEIGHT: 18pt; TEXT-INDENT: 57.75pt; MARGIN: 6pt 0cm" class=MsoBodyTextFirstIndent><SPAN lang=EN-US><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><a href="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201106/24/25979788_1308888111yDRr.jpg" target="_blank"><IMG border=0 src="http://blog.chinaunix.nethttp://blog.chinaunix.net/attachment/201106/24/25979788_1308888111yDRr.jpg" .load="imgResize(this, 650);" ;></A></SPAN></SPAN></P>
<P style="TEXT-ALIGN: center; LINE-HEIGHT: 18pt; MARGIN: 0cm 0cm 6pt" class=MsoBodyTextFirstIndent align=center><SPAN style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.0pt">图</SPAN><SPAN style="FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt" lang=EN-US><FONT face="Times New Roman">2 PPP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; FONT-SIZE: 9pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-size: 10.0pt">协议过程状态图</SPAN><SPAN style="FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt" lang=EN-US></SPAN></P>
<P style="LINE-HEIGHT: 18pt; MARGIN: 6pt 0cm" class=MsoBodyTextFirstIndent><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当线路处于静止状态时,并不存在物理层的连接。当检测到调制解调器的载波信号,并建立物理层连接后,线路就进入建立状态,这时</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开始协商一些选项。协商结束后就进入鉴别状态。若通信的双方鉴别身份成功,则进入网络状态。</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">NCP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置网络蹭,分配</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">IP</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地址,然后就进入可进行数据通信的打开状态。数据传输结束后就转到终止状态。载波停止后则回到静止状态。</SPAN></P>
<A name=_Toc533172938></A><A name=_Toc518886577></A>&nbsp;
页: [1]
查看完整版本: ppp协议详解