ILD

The Point-to-Point Protocol (PPP)
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2019-9-18 站点:Inside Linux Development

RFC 1661 The Point-to-Point Protocol (PPP)


PPP主要包括3个部分

PPP Encapsulation  

一个Link Control Protocol (LCP) 来建立、配置、测试数据链路连接。

一组Network Control Protocols (NCPs) 来维护和配置不同的网络层协议。


PPP Encapsulation

就是一个Protocol域。2个字节。0xabcd。

d必须为奇数。a必须为偶数。


0xxx-3xxx 表示网络层协议。IPV4:0x0021,IPV6:0x0057

8xxx-bxxx 表示NCPs的协议。IPCP:0x8021,IPV6CP:0x8057

4xxx-7xxx 表示不需要NCP的low volume traffic

cxxx-fxxx 表示link-layer Control Protocols协议。LCP:0xc021,CHAP:0xc223,PAP:0xc023


PPP Link Operation Overview

为了建立PPP链路通信,双方首先需要发送LCP来建立和测试data link。

然后可以执行authenticate。

然后PPP必须发送NCP来选择和配置一个或多个网络层协议。

然后各个网络层的数据包就可以通信了。


Link Dead Phase

开始状态和结束状态。


Link Establishment Phase

使用LCP来建立连接。通过exchange of Configure packets。

一旦双方收到到了Configure-ACK packets。交换完成、进入LCP Opened状态。

所有的配置保持默认值,除非交换配置修改了它。

只有和网络层无关的配置才通过LCP配置。网络层相关的配置由NCP来处理。

这个Phase所有非LCP的包都被丢弃。

抓包显示客户端的配置包括了Maximum Receive Unit 大小为


Authentication Phase

Network-Layer Protocol Phase

每个网络层协议必须独立配置。


Link Termination Phase



LCP Packet Formats

有3种LCP packets。


1 Link Configuration packets

Configure-Request, Configure-Ack, Configure-Nak and Configure-Reject


2 Link Termination packets

Terminate-Request and Terminate-Ack


3 Link Maintenance packets

Code-Reject, Protocol-Reject, Echo-Request, Echo-Reply, and Discard-Request


    0                   1                   2                   3

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |     Code      |  Identifier   |            Length             |

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |    Data ...

   +-+-+-+-+


code

         1       Configure-Request

         2       Configure-Ack

         3       Configure-Nak

         4       Configure-Reject

         5       Terminate-Request

         6       Terminate-Ack

         7       Code-Reject

         8       Protocol-Reject

         9       Echo-Request

         10      Echo-Reply

         11      Discard-Request


6.  LCP Configuration Options


    0                   1

    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   |     Type      |    Length     |    Data ...

   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   

         0       RESERVED

         1       Maximum-Receive-Unit

         3       Authentication-Protocol

         4       Quality-Protocol

         5       Magic-Number

         7       Protocol-Field-Compression

         8       Address-and-Control-Field-Compression

 

认证协议:

      c023            Password Authentication Protocol

      c223            Challenge Handshake Authentication Protocol


参考:

https://tools.ietf.org/rfc/rfc1661.txt

Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.