配置BGP RPD示例
配置BGP RPD可以实现路由策略的动态下发。
组网需求
在城域入口或IGW场景下,当链路资源利用不均匀或链路故障导致局部流量路径拥塞时,为使用户充分利用网络带宽,可部署入方向流量调优方案,指定流量调优方案,影响路由优先级,将流量引导至空闲链路。此时,路由器作为转发设备,需要部署RPD特性。
如图10-52所示,所有路由器都配置BGP,DeviceA和DeviceB在AS 100中,DeviceC在AS 200中,NCE在AS 300中。此时来自AS 200 DeviceC发送至目的地址为192.168.1.0的流量可以从DeviceA和DeviceB进入AS 100。若经NCE分析后,发现DeviceA和DeviceC间的流量路径拥堵,可以配置调流策略并下发RPD路由控制流量进入AS 100的入口设备为DeviceB,即流量路径改为DeviceC到DeviceB。
配置思路
采用如下的思路配置BGP RPD,配套NCE完成流量调优:
在DeviceA和DeviceC、DeviceB和DeviceC之间配置EBGP连接。
在DeviceA和DeviceB上部署RPD,分别和NCE建立RPD邻居。
在DeviceA,DeviceB和DeviceC配置IPv4单播,即DeviceA和DeviceC、DeviceB和DeviceC互为IPv4单播邻居。
数据准备
为完成此配置例,需准备如下的数据:
- DeviceA、DeviceB的Router ID分别为1.1.1.1、2.2.2.2,所在AS号为100。
- DeviceC的Router ID为3.3.3.3,所在AS号为200。
操作步骤
- 配置各接口的IP地址(略)。
- 配置BGP连接。
# 配置DeviceA。
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.2.1.2 as-number 200
[*DeviceB-bgp] peer 1.1.1.1 as-number 300
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# 配置DeviceB。
[~DeviceB] bgp 100
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.3.1.2 as-number 200
[*DeviceB-bgp] peer 2.1.1.1 as-number 300
[*DeviceB-bgp] ipv4-family unicast
[*DeviceB-bgp-af-ipv4] network 192.168.1.0 255.255.255.0
[*DeviceB-bgp-af-ipv4] commit
[~DeviceB-bgp-af-ipv4] quit
[~DeviceB-bgp] quit
# 配置DeviceC。
[~DeviceC] bgp 200
[*DeviceC-bgp] router-id 3.3.3.3
[*DeviceC-bgp] peer 10.2.1.1 as-number 100
[*DeviceC-bgp] peer 10.3.1.1 as-number 100
[*DeviceC-bgp] ipv4-family unicast
[*DeviceC-bgp-af-ipv4] commit
[~DeviceC-bgp-af-ipv4] quit
[~DeviceC-bgp] quit
# 查看DeviceC的路由表。
[~DeviceC] display bgp routing-table 192.168.1.0 24 BGP local router ID : 3.3.3.3 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.2.1.1 (1.1.1.1) Route Duration: 0d00h00m56s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.2.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.2.1.1 10.3.1.1 BGP routing table entry information of 192.168.1.0/24: From: 10.3.1.1 (2.2.2.2) Route Duration: 0d00h00m06s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.3.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peers yet
从路由表中可以看出,到目的地址192.168.1.0/24有两条有效路由,其中下一跳为10.2.1.1的路由是最优路由(因为DeviceA的Router ID要小一些),即流量路径优选从DeviceA流入AS 100。
- 配置BGP RPD属性,本设备接收NCE下发的RPD路由并执行对应的路由策略。
# 配置DeviceA。
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 1.1.1.1 as-number 300
[*DeviceA-bgp] rpd-family
[*DeviceA-bgp-af-rpd] peer 1.1.1.1 enable
[*DeviceA-bgp-af-rpd] quit
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.2.1.2 rpd-policy export enable
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# 配置DeviceB。
[~DeviceA] bgp 100
[*DeviceA-bgp] peer 2.1.1.1 as-number 300
[*DeviceA-bgp] rpd-family
[*DeviceA-bgp-af-rpd] peer 2.1.1.1 enable
[*DeviceA-bgp-af-rpd] quit
[*DeviceA-bgp] ipv4-family unicast
[*DeviceA-bgp-af-ipv4] peer 10.3.1.2 rpd-policy export enable
[*DeviceA-bgp-af-ipv4] commit
[~DeviceA-bgp-af-ipv4] quit
[~DeviceA-bgp] quit
# 查看DeviceA的RPD路由信息。[~DeviceA] display bgp rpd routing-table Total number of Routes : 1 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 Network Peer MED LocPrf PrefVal Path/Ogn *> 1/10.2.1.2/1 1.1.1.1 50 0 100?
# 查看DeviceC的路由表。[~DeviceC] display bgp routing-table 192.168.1.0 24 BGP local router ID : 3.3.3.3 Local AS number : 200 Paths: 2 available, 1 best, 1 select BGP routing table entry information of 192.168.1.0/24: From: 10.2.1.1 (1.1.1.1) Route Duration: 0d00h00m56s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.2.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 50, pref-val 0, valid, external, best, select, pre 255 Advertised to such 2 peers: 10.2.1.1 10.3.1.1 BGP routing table entry information of 192.168.1.0/24: From: 10.3.1.1 (2.2.2.2) Route Duration: 0d00h00m06s Direct Out-interface: GigabitEthernet0/1/1 Original nexthop: 10.3.1.1 Qos information : 0x0 AS-path 100, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for router ID Not advertised to any peers yet
从路由表中可以看出,由于下一跳为10.2.1.1(DeviceA)的路由MED值为50,下一跳为10.3.1.1(DeviceB)的路由MED值为0,则DeviceB到DeviceC路由优先级高,从而控制流量路径选择DeviceC到DeviceB,避开拥堵路径。
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.2.1.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 1.1.1.2 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 1.1.1.1 as-number 300
peer 10.2.1.2 as-number 200
#
ipv4-family unicast
network 192.168.1.0 255.255.255.0
peer 10.2.1.2 enable
peer 10.2.1.2 rpd-policy export enable
#
rpd-family
peer 1.1.1.1 enable
#
return
DeviceB的配置文件
#
sysname DeviceB
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.3.1.1 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 2.1.1.2 255.255.255.0
#
bgp 100
router-id 2.2.2.2
peer 2.1.1.1 as-number 300
peer 10.3.1.2 as-number 200
#
ipv4-family unicast
network 192.168.1.0 255.255.255.0
peer 10.3.1.2 enable
peer 10.3.1.2 rpd-policy export enable
#
rpd-family
peer 2.1.1.1 enable
#
return
DeviceC的配置文件
#
sysname DeviceC
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.2.1.2 255.255.255.0
#
interface GigabitEthernet0/1/1
undo shutdown
ip address 10.3.1.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 10.2.1.1 as-number 100
peer 10.3.1.1 as-number 100
#
ipv4-family unicast
peer 10.2.1.1 enable
peer 10.3.1.1 enable
#
return