BCP功能简介及调试方法之三

本文介绍了BCP功能,它是PPP链路上的网络桥接协议,用于建立和配置远程桥接。内容包括BCP的简介、网络拓扑、协议分析、功能增加指南,特别是针对Cisco和Mikrotik RouterOS系统的实现。此外,还提供了第三方公司调试的详细步骤,涉及xl2tpd、ppp和Linux内核的修改,以及BCP的测试分析,探讨了LNS开启和关闭IPCP功能对LAC的影响。
摘要由CSDN通过智能技术生成

BCP功能简介及调试方法

1. BCP简介

​ BCP是最近研究的一个网络协议,主要是基于PPP链路,能够把双方子网的网络桥接。

​ BCP全称: Point-to-Point Protocol (PPP) Bridging Control Protocol (BCP)

简介:

The Point-to-Point Protocol (PPP) provides a standard method for

transporting multi-protocol datagrams over point-to-point links. PPP

defines an extensible Link Control Protocol (LCP) and proposes a

family of Network Control Protocols (NCP) for establishing and

configuring different network-layer protocols.

This document defines the NCP for establishing and configuring Remote

Bridging for PPP links.

​This document obsoletes RFC 2878, which was based on the IEEE

802.1D-1993 MAC Bridge. This document extends that specification by

improving support for bridge control packets.

2. BCP网络拓扑图

在这里插å¥å›¾ç‰‡æè¿°

3. BCP协议分析

详细参考RFC3518文档(前身有RFC1638,RFC2878)

下载地址:链接: https://pan.baidu.com/s/1zJmiwen9fQBpDMRQrV7T0w 提取码: 2gkc

在这里插入图片描述

4. BCP功能增加指南

目前,支持此功能的设备主要有Cisco,Mikrotik(RouterOS系统)等。

4.1 自己折腾

详细参考如下patch:
参考连接:

1)内核patch:https://lists.linuxfoundation.org/pipermail/bridge/2004-February/003788.html

2)pppd patch:https://lists.linuxfoundation.org/pipermail/bridge/2004-February/003787.html

附件下载地址:链接: https://pan.baidu.com/s/1o0N7i-r-rUnQTQN1BCf0_Q 提取码: 464f

从此patch文件可以得知,主要修改linux kernel和ppp代码,增加bridge的支持。

虽然patch支持的版本比较低(ppp 版本V2.4.1, 内核版本V2.4.1),但是还是非常具有参考价值的,从无到有的过程,对我帮助很大。

我在调试的过程中(适配内核版本3.3.x,ppp版本2.4.7),发现ppp建立bcp0网卡的时候,一直会导致内核cpu0,系统奔溃。经过柱栋修改内核的代码后,内核的错误没有了。但是创建bcp0网卡一直失败。由于本人对内核不熟悉,柱栋出差时间比较少,所以一直没有进展。应市场需要,领导确定让第三方公司帮忙。

4.2 第三方公司调试说明

他们的参考文档,与我上面发的一样。都是来自Dane作者的patch,只是适配了我们现在的内核版本3.3.x/3.4.x及ppp版本2.4.7,另外修改了xl2tpd-1.3.14的部分功能。

4.2.1 xl2tpd修改说明

适配xl2tpd版本:1.3.14

 xl2tp: add "disable ip" config option

 Add "disable ip" config file parameter in lac section to have xl2tpd
 not tear down its session if no IP address is set. This is required if
 pppd is used with IPCP disabled (noip).

---
 xl2tp-1.3.14/control.c | 30 ++++++++++++++++++------------
 xl2tp-1.3.14/file.c    | 18 ++++++++++++++++++
 xl2tp-1.3.14/file.h    |  1 +
 3 files changed, 37 insertions(+), 12 deletions(-)


4.2.2 ppp修改说明

适配ppp版本:2.4.7

 ppp: add bcp network protocol

 Import patch from
 https://lists.linuxfoundation.org/pipermail/bridge/2005-May/004523.html
 of work begun in 2004 which was never completed.

 Reverse logic of bridge option such that BCP is enabled only when
 bridge option is specified.

 Have bridge_mac option accept a 3-byte OUI with the remaining 3-bytes
 of a MAC address then randomly generated.

 Add support for BCP 802-Tagged-Frames negotiation (rfc2878).

 Add bridge_vlan option to control 802-Tagged-Frames BCP parameter.

 Modify all network protocols to tear down ppp connection of sifnpmode
 returns an error.

 Add BCP printer for BridgeControlPacketIndicator (rfc3518). This is
 not supported by the Linux kernel so is not negotiated by
 pppd. However, it is useful to log it in pppd debug output.

 Fetch and log link stats on BCP protocol down, consistent with other
 network protocols.

 pppd supports some additional options:-

 bridge             - enables BCP. Default: BCP is not enabled.

 bridge_mac mac|oui - set the MAC of the local bcpN interface. Takes a
                      MAC address or MAC OUI arg.

                      xx:xx:xx:xx:xx:xx (MAC address)
                      xx:xx:xx          (OUI)

                      If parameter is xx:xx:xx, a MAC address is
                      autogenerated using the OUI and 3 random bytes.

                      Bit 0 of the first byte is the MAC Multicast bit
                      so must never be set.

		      Bit 1 of the first byte if the MAC Local bit
		      indicating a locally generated MAC. This is
		      always set if the arg is xx:xx:xx.

 bridge_vlan        - enables 802-Tagged-Frames BCP parameter. Default: off.

 If bridge option is specified without bridge_mac, pppd requires that
 the peer assign it a MAC during BCP negotiation. When testing this,
 we found no current ppp implementation that supports this. Therefore,
 when bridge option is specified, always also include bridge_mac.

 If VLAN tagged frames are to be carried over the PPP bridge link, add
 the bridge_vlan option. Note that bridge_vlan tells the peer only
 that we may be sending VLAN frames and we will accept VLAN frames, it
 does not tell the peer which VLAN tags will be used. Configuration of
 VLANs on the bcpN interface would be done using commands in
 /etc/ppp/eth-up or by a VLAN protocol such as GVRP. If BCP peers do
 not agree to enable 802-Tagged-Frames, no VLAN tagged frame should be
 transmitted or received on the bcpN interface.

 When bcp interfaces are created or destroyed, pppd runs scripts
 /etc/ppp/eth-up and /etc/ppp/eth-down if they exist and are
 executable. The scripts are called with the following arguments:

 eth-up - $1 - interface name, e.g. bcp0
          $2 - "vlan" or "novlan", depending on whether 802-Tagged-Frames was
               negotiated.

 eth-down - $1 - interface name, e.g. bcp0

---
 ppp-2.4.7/include/linux/ppp_defs.h |    3 +
 ppp-2.4.7/include/net/ppp_defs.h   |    3 +
 ppp-2.4.7/pppd/Makefile.linux      |    6 +-
 ppp-2.4.7/pppd/bcp.c               | 1864 ++++++++++++++++++++++++++++++++++++
 ppp-2.4.7/pppd/bcp.h               |   76 ++
 ppp-2.4.7/pppd/ipcp.c              |   15 +-
 ppp-2.4.7/pppd/ipv6cp.c            |   15 +-
 ppp-2.4.7/pppd/ipxcp.c             |    7 +
 ppp-2.4.7/pppd/main.c              |   
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值