pppoe的工作原理

Appendix A.  Examples of Session Credit Flows

   Session Credit Flow with the default 64-byte credit unit.

   Server                    Client
   ====================================================================
   <------------PADI--------------    Initiate
    ------------PADO-------------->   Offer

   <------------PADR--------------    Credits TLV:
                                      FCN represents the initial
                                      Client credit grant to the
                                      Server in 64-byte units.
                                      BCN is set to 0.

    ------------PADS-------------->   Credits TLV:
                                      FCN represents the initial
                                      Server credit grant to the
                                      Client in 64-byte units.
                                      BCN represents an echo of
                                      initial Client credits.

   <==============================>   Data w/ optional in-band
                                      Credits TLV

   <------------PADG--------------    Credits TLV: (out-of-band)
                                      FCN represents an incremental
                                      Client credit grant to the
                                      Server, in 64-byte units.
                                      BCN represents the remaining
                                      Server credits that were granted
                                      to the Client, in 64-byte units.

    ------------PADC-------------->   Credits TLV: (out-of-band)
                                      FCN represents an incremental
                                      Server credit grant to the
                                      Client, in 64-byte units.
                                      BCN represents the remaining
                                      Client credits that were granted
                                      to the Server, in 64-byte units.

   <==============================>   Data w/ optional in-band Credits
                                      TLV

   <------------PADT-------------->   Terminate

参见 rfc

pppoe协议的工作流程包括发现(PPPoE discovery)和会话(PPP session)两个阶段

 

pppoe帧格式 首部长为6个字节

The Ethernet payload for PPPoE is as follows:

                        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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  VER     | TYPE     |      CODE           |          SESSION_ID                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |            LENGTH                               |           payload             ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

pppoe有效载荷(payload)包括0或多个tags,一个tag是一个TLV(type-length-vlaue)结构

定义如下

                        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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          TAG_TYPE                              |        TAG_LENGTH                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          TAG_VALUE ...                                        ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  TAG_TYPE 为16位 网络字节顺序(network byte order).

  TAG_LENGTH is a sixteen bit field.  It is an unsigned number in network byte order, indicating the length in octets of the TAG_VALUE.
 

 

pppoe discovery

由于pppoe的典型的客户-服务器模型,服务提供商建立主机与服务器的单一物理连接

包括以下4个步骤

1> Client to server: Initiation (PADI)

PPPoE Active Discovery Initiation

 

A PADI packet:

                           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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         0xffffffff                            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |           0xffff              |        Host_mac_addr          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                    Host_mac_addr (cont)                       |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |    ETHER_TYPE = 0x8863        | v = 1 | t = 1 |  CODE = 0x09  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     SESSION_ID = 0x0000       |      LENGTH = 0x0004          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      TAG_TYPE = 0x0101        |    TAG_LENGTH = 0x0000        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

2>Server to client: Offer (PADO)

PPPoE Active Discovery Offer

 

A PADO packet:

                           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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         Host_mac_addr                         |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      Host_mac_addr (cont)     | Access_Concentrator_mac_addr  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |             Access_Concentrator_mac_addr (cont)               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |    ETHER_TYPE = 0x8863        | v = 1 | t = 1 |  CODE = 0x07  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     SESSION_ID = 0x0000       |      LENGTH = 0x0020          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      TAG_TYPE = 0x0101        |    TAG_LENGTH = 0x0000        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      TAG_TYPE = 0x0102        |    TAG_LENGTH = 0x0018        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x47      |     0x6f      |     0x20      |     0x52      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x65      |     0x64      |     0x42      |     0x61      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x63      |     0x6b      |     0x20      |     0x2d      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x20      |     0x65      |     0x73      |     0x68      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x73      |     0x68      |     0x65      |     0x73      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     0x68      |     0x6f      |     0x6f      |     0x74      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

3>Client to server: Request (PADR)

PPPoE Active Discovery Request

 

4>Server to client: Session-confirmation (PADS)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值