配置BGP联盟示例
BGP联盟可解决网络中过多的IBGP连接。
组网需求
某运营商在一个区域内拥有多台设备,现要求在该区域内实现IBGP全连接,如果采用每两台设备间配置IBGP连接的方式,则会由于设备数量较多导致IBGP连接数量过多,这样将产生较高的运维成本。为了解决这个问题,可以在该区域中部署BGP联盟功能。
如图10-39所示,为保证AS200内的各个设备之间的连通性,需要各个设备之间建立IBGP全连接关系。但是由于AS200中有多台运行BGP协议的路由器,导致建立全连接网络的开销很大。此时为了减少IBGP的连接数量,可以在AS200内的设备上配置联盟功能。联盟是处理AS内部的IBGP网络连接激增的一种方法,以图10-39为例通过配置联盟功能将AS200划分为3个子自治系统:AS65001、AS65002和AS65003。AS65001通过配置联盟EBGP多等体关系与AS65002、AS65003建立连接,其中AS65001内的三台路由器建立IBGP全连接关系。这样大量减少了AS200内的IBGP的连接数量,降低了运维成本。
数据准备
为完成此配置例,需准备如下的数据:
DeviceA、DeviceB、DeviceC、DeviceD、DeviceE、DeviceF的Router ID分别为1.1.1.1、2.2.2.2、3.3.3.3、4.4.4.4、5.5.5.5、6.6.6.6。
自治系统号AS100,自治系统号AS200,AS200中的3个子自治系统号AS65001,AS65002,AS65003。
操作步骤
- 配置各接口的IP地址(略)
- 配置BGP联盟
# 配置DeviceA。
[~DeviceA] bgp 65001
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] confederation id 200
[*DeviceA-bgp] confederation peer-as 65002 65003
[*DeviceA-bgp] peer 10.1.1.2 as-number 65002
[*DeviceA-bgp] peer 10.1.2.2 as-number 65003
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.1.1.2 next-hop-local
[*DeviceA-bgp-af-ipv4] peer 10.1.2.2 next-hop-local
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# 配置DeviceB。
[~DeviceB] bgp 65002
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] confederation id 200
[*DeviceB-bgp] confederation peer-as 65001
[*DeviceB-bgp] peer 10.1.1.1 as-number 65001
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# 配置DeviceC。
[~DeviceC] bgp 65003
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] confederation id 200
[*DeviceC-bgp] confederation peer-as 65001
[*DeviceC-bgp] peer 10.1.2.1 as-number 65001
[*DeviceC-bgp] commit
[~DeviceC-bgp] quit
- 配置AS65001内的IBGP连接
# 配置DeviceA。
[~DeviceA] bgp 65001
[*DeviceA-bgp] peer 10.1.3.2 as-number 65001
[*DeviceA-bgp] peer 10.1.4.2 as-number 65001
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.1.3.2 next-hop-local
[*DeviceA-bgp-af-ipv4] peer 10.1.4.2 next-hop-local
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# 配置DeviceD。
[~DeviceD] bgp 65001
[*DeviceD-bgp] router-id 4.4.4.4
[*DeviceD-bgp] confederation id 200
[*DeviceD-bgp] peer 10.1.3.1 as-number 65001
[*DeviceD-bgp] peer 10.1.5.2 as-number 65001
[*DeviceD-bgp] commit
[~DeviceD-bgp] quit
# 配置DeviceE。
[~DeviceE] bgp 65001
[*DeviceE-bgp] router-id 5.5.5.5
[*DeviceE-bgp] confederation id 200
[*DeviceE-bgp] peer 10.1.4.1 as-number 65001
[*DeviceE-bgp] peer 10.1.5.1 as-number 65001
[*DeviceE-bgp] commit
[~DeviceE-bgp] quit
- 配置AS100和AS200之间的EBGP连接
# 配置DeviceA。
[~DeviceA] bgp 65001
[*DeviceA-bgp] peer 172.16.1.2 as-number 100
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# 配置DeviceF。
[~DeviceF] bgp 100
[*DeviceF-bgp] router-id 6.6.6.6
[*DeviceF-bgp] peer 172.16.1.1 as-number 200
[*DeviceF-bgp] ipv4-family unicast
[*DeviceF-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceF-bgp-af-ipv4] commit
[~DeviceF-bgp-af-ipv4] quit
[~DeviceF-bgp] quit
- 查看配置结果
# 查看DeviceB的BGP路由表。
[~DeviceB] display bgp routing-table
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.1.0/24 10.1.1.1 0 100 0 (65001) 100i
[~DeviceB] display bgp routing-table 192.168.1.0
BGP local router ID : 2.2.2.2 Local AS number : 65002 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.1.1.1 (1.1.1.1) Route Duration: 00h12m29s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.1.1 Qos information : 0x0 AS-path (65001) 100, origin igp, MED 0, localpref 100, pref-val 0, valid, external-confed, best, select, active, pre 255 Not advertised to any peer yet
# 查看DeviceD的BGP路由表。
[~DeviceD] display bgp routing-table
BGP Local router ID is 4.4.4.4
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V - valid, I - invalid, N - not-found
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 192.168.1.0/24 10.1.3.1 0 100 0 100i
[~DeviceD] display bgp routing-table 192.168.1.0
BGP local router ID : 4.4.4.4 Local AS number : 65001 Paths: 1 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.1.3.1 (1.1.1.1) Route Duration: 00h23m57s Relay IP Nexthop: 0.0.0.0 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 10.1.3.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal-confed, best, select, active, pre 255 Not advertised to any peer yet
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.1.3.1 255.255.255.0
#
interface GigabitEthernet0/1/2
undo shutdown
ip address 10.1.4.1 255.255.255.0
#
bgp 65001
router-id 1.1.1.1
confederation id 200
confederation peer-as 65002 65003
peer 10.1.1.2 as-number 65002
peer 10.1.2.2 as-number 65003
peer 10.1.3.2 as-number 65001
peer 10.1.4.2 as-number 65001
peer 172.16.1.2 as-number 100
#
ipv4-family unicast
undo synchronization peer 172.16.1.2 enable
peer 10.1.1.2 enable
peer 10.1.1.2 next-hop-local
peer 10.1.2.2 enable
peer 10.1.2.2 next-hop-local
peer 10.1.3.2 enable
peer 10.1.3.2 next-hop-local
peer 10.1.4.2 enable
peer 10.1.4.2 next-hop-local
#
return
DeviceB的配置文件
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
bgp 65002
router-id 2.2.2.2
confederation id 200
confederation peer-as 65001
peer 10.1.1.1 as-number 65001
#
ipv4-family unicast
undo synchronization peer 10.1.1.1 enable
#
return
DeviceC的配置文件与DeviceB类似,此处省略。
DeviceD的配置文件
#
sysname DeviceD
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.3.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.5.1 255.255.255.0
#
bgp 65001
router-id 4.4.4.4
confederation id 200
peer 10.1.3.1 as-number 65001
peer 10.1.5.2 as-number 65001
#
ipv4-family unicast
undo synchronization peer 10.1.3.1 enable
peer 10.1.5.2 enable
#
return
DeviceE的配置文件与DeviceD类似,此处省略。
DeviceF的配置文件
#
sysname DeviceF
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 192.168.1.1 255.255.255.0
#
bgp 100
router-id 6.6.6.6
peer 172.16.1.1 as-number 200
#
ipv4-family unicast
undo synchronization network 192.168.1.0 255.255.255.0
peer 172.16.1.1 enable
#
return