学习精彩网络技术老师:华为HCIA和HCIP数通eNSP实战视频课
学习精彩网络技术老师:华为、华三、锐捷、WLAN、IPv6等全套视频课程
当BGP对等体之间的链路发生故障时,BFD能够快速检测到故障并通告给BGP,使业务流量使用备份链路传送,提高业务传输可靠性。
组网需求
随着社会的发展,语音和视频业务应用广泛,而这些业务对于网络可靠性和稳定性的要求很高。网络故障时,要求业务恢复时间尽量小,一般需要达到电信级可靠性要求(50ms)。BFD for BGP可以满足这个要求。
如图1所示,为了保障业务传输的稳定性,网络部署成主备备份链路,DeviceA和DeviceB、DeviceA和DeviceC之间都建立非直连EBGP邻居。正常情况下,业务流量在主链路DeviceA→DeviceB上传送,当主链路故障时,用户希望BGP协议能够快速感知,并且及时把业务切换到备份链路DeviceA→DeviceC→DeviceB上。
为了保证在主链路故障时,业务可以快速切换到备份链路,可以配置BFD for BGP功能,使用BFD检测DeviceA和DeviceB之间的BGP邻居关系,当DeviceA和DeviceB之间的链路发生故障时,BFD能够快速检测到故障并通告给BGP协议,使业务流量使用备份链路传送。
本例中interface1,interface2,interface3分别代表GE0/1/0,GE0/2/0,GE0/3/0。
如果两个路由器使用直连链路建立EBGP邻居,则无需配置BFD for BGP功能,因为BGP已经缺省配置了ebgp-interface-sensitive命令快速感知链路故障。
配置注意事项
在配置过程中,需注意以下事项:
使能BFD for BGP功能时,必须先使能全局BFD能力。
使能BFD for BGP功能时,BFD会话两端的参数必须保持一致。
配置思路
采用如下思路配置BFD for BGP功能:
在各NE上配置BGP基本功能。
配置MED属性控制路由的选路功能。
在DeviceA和DeviceB上使能BFD检测机制。
数据准备
为完成此配置例,需准备如下的数据:
DeviceA、DeviceB和DeviceC的Router ID和所在AS号。
BFD检测的对端IP地址。
BFD控制报文的最小发送间隔、最小接收间隔、本地检测倍数。
操作步骤
- 配置各NE接口的IP地址(略)
- 配置BGP基本功能,在DeviceA和DeviceB,DeviceA和DeviceC之间建立EBGP连接, DeviceB和DeviceC之间建立IBGP连接
# 配置DeviceA。
[~DeviceA] bgp 100
[*DeviceA-bgp] router-id 1.1.1.1
[*DeviceA-bgp] peer 10.20.1.2 as-number 200
[*DeviceA-bgp] peer 10.20.1.2 ebgp-max-hop
[*DeviceA-bgp] peer 10.20.2.2 as-number 200
[*DeviceA-bgp] peer 10.20.2.2 ebgp-max-hop
[*DeviceA-bgp] commit
[~DeviceA-bgp] quit
# 配置DeviceB。
[~DeviceB] bgp 200
[*DeviceB-bgp] router-id 2.2.2.2
[*DeviceB-bgp] peer 10.20.1.1 as-number 100
[*DeviceB-bgp] peer 10.20.1.1 ebgp-max-hop
[*DeviceB-bgp] peer 10.1.1.2 as-number 200
[*DeviceB-bgp] network 172.16.1.0 255.255.255.0
[*DeviceB-bgp] commit
[~DeviceB-bgp] quit
# 配置DeviceC。
[~Devicec] bgp 200
[*Devicec-bgp] router-id 3.3.3.3
[*Devicec-bgp] peer 10.20.2.1 as-number 100
[*Devicec-bgp] peer 10.20.2.1 ebgp-max-hop
[*Devicec-bgp] peer 10.1.1.1 as-number 200
[*Devicec-bgp] commit
[~Devicec-bgp] quit
# 在DeviceA上查看,BGP邻居已经建立(Established)。
<DeviceA> display bgp peer
BGP local router ID : 1.1.1.1
Local AS number : 100
Total number of peers : 2 Peers in established state : 2
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
10.20.1.2 4 200 2 5 0 00:01:25 Established 0
10.20.2.2 4 200 2 4 0 00:00:55 Established 0
- 配置MED属性
通过策略配置DeviceB和DeviceC发送给DeviceA的MED值。
# 配置DeviceB。
[~DeviceB] route-policy 10 permit node 10
[*DeviceB-route-policy] apply cost 100
[*DeviceB-route-policy] commit
[~DeviceB-route-policy] quit
[~DeviceB] bgp 200
[*DeviceB-bgp] peer 10.20.1.1 route-policy 10 export
[*DeviceB-bgp] commit
# 配置DeviceC。
[~DeviceC] route-policy 10 permit node 10
[*DeviceC-route-policy] apply cost 150
[*DeviceC-route-policy] commit
[~DeviceC-route-policy] quit
[~DeviceC] bgp 200
[*DeviceC-bgp] peer 10.20.2.1 route-policy 10 export
[*DeviceC-bgp] commit
# 查看DeviceA上BGP的所有路由信息。
<DeviceA> display bgp routing-table
BGP Local router ID is 1.1.1.1
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: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 172.16.1.0/24 10.20.1.2 100 0 200i
* 10.20.2.2 150 0 200i
从BGP路由表可以看出,去往172.16.1.0/24的路由下一跳地址为10.20.1.2,流量在主链路DeviceA→DeviceB上传输。
- 配置BFD检测功能、发送和接收间隔、本地检测时间倍数。
# 在DeviceA上使能BFD功能,并指定最小发送和接收间隔为100ms,本地检测时间倍数为4。
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] bgp 100
[*DeviceA-bgp] peer 10.20.1.2 bfd enable
[*DeviceA-bgp] peer 10.20.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceA-bgp] commit
# 在DeviceB上使能BFD功能,并指定最小发送和接收间隔为100ms,本地检测时间倍数为4。
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] bgp 200
[*DeviceB-bgp] peer 10.20.1.1 bfd enable
[*DeviceB-bgp] peer 10.20.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
[*DeviceB-bgp] commit
# 在DeviceA上显示BGP建立的所有BFD会话。
<DeviceA> display bgp bfd session all
--------------------------------------------------------------------------------
Local_Address Peer_Address Interface
10.20.1.1 10.20.1.2 GigibitEthernet0/1/0
Tx-interval(ms) Rx-interval(ms) Multiplier Session-State
100 100 4 Up
Wtr-interval(m)
10
--------------------------------------------------------------------------------
- 查看配置结果
# 对DeviceB的GE0/2/0接口执行shutdown命令,模拟主链路故障。
[~DeviceB] interface gigabitethernet 0/2/0
[*DeviceB-GigabitEthernet0/2/0] shutdown
[*DeviceB-GigabitEthernet0/2/0] commit
# 在NEDeviceA上,查看bgp路由表
<DeviceA> display bgp routing-table
BGP Local router ID is 1.1.1.1
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
*> 172.16.1.0/24 10.20.2.2 150 0 200i
从BGP路由表可以看出,在主链路失效后,备份链路DeviceA-DeviceC-DeviceB生效,去往172.16.1.0/24的路由下一跳地址为10.20.2.2。
配置文件
DeviceA的配置文件
#
sysname DeviceA
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.20.2.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.1.1 255.255.255.0
#
bgp 100
router-id 1.1.1.1
peer 10.20.1.2 as-number 200
peer 10.20.1.2 ebgp-max-hop 255
peer 10.20.1.2 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
peer 10.20.1.2 bfd enable
peer 10.20.2.2 as-number 200
peer 10.20.2.2 ebgp-max-hop 255
#
ipv4-family unicast
undo synchronization
peer 10.20.1.2 enable
peer 10.20.2.2 enable
#
return
DeviceB的配置文件
#
sysname DeviceB
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.20.1.2 255.255.255.0
#
interface GigabitEthernet0/3/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
bgp 200
router-id 2.2.2.2
peer 10.1.1.2 as-number 200
peer 10.20.1.1 as-number 100
peer 10.20.1.1 ebgp-max-hop 255
peer 10.20.1.1 bfd min-tx-interval 100 min-rx-interval 100 detect-multiplier 4
peer 10.20.1.1 bfd enable
#
ipv4-family unicast
undo synchronization
network 172.16.1.0 255.255.255.0
peer 10.1.1.2 enable
peer 10.20.1.1 enable
peer 10.20.1.1 route-policy 10 export
#
route-policy 10 permit node 10
apply cost 100
#
return
DeviceC的配置文件
#
sysname DeviceC
#
bfd
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.20.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
bgp 200
router-id 3.3.3.3
peer 10.1.1.1 as-number 200
peer 10.20.2.1 as-number 100
peer 10.20.2.1 ebgp-max-hop 255
#
ipv4-family unicast
undo synchronization
peer 10.1.1.1 enable
peer 10.20.2.1 enable
peer 10.20.2.1 route-policy 10 export
#
route-policy 10 permit node 10
apply cost 150
#
return