配置BFD for BGP4+功能示例
组网需求
如图9-34,SwitchA属于AS100,SwitchB和SwitchC属于AS200,SwitchA和SwitchB、SwitchA和SwitchC分别建立EBGP连接。
业务流量在主链路SwitchA→SwitchB上传送,链路SwitchA→SwitchC→SwitchB作为备份链路。客户希望能在主链路上实现毫秒级故障检测,当主链路出现故障时,能将业务流量及时切换到备份链路上。
配置思路
采用如下思路配置BFD for BGP4+功能:
在各Switch上配置BGP4+基本功能。使各Switch间可以建立BGP对等体。
在SwitchA和SwitchB上配置MED属性控制路由的选路功能,使流量在主链路SwitchA到SwitchB上传输。
在SwitchA和SwitchB上使能BFD检测机制。实现毫秒级故障检测,当主链路出现故障时,能将业务流量及时切换到备份链路上。
操作步骤
- 配置各Switch接口的IPv6地址(略)。
- 配置BGP4+基本功能,在SwitchA和SwitchB,SwitchA和SwitchC之间建立EBGP连接,SwitchB和SwitchC之间建立IBGP连接。
# 配置SwitchA。
[~SwitchA] bgp 100
[*SwitchA-bgp] router-id 10.1.1.1
[*SwitchA-bgp] peer fc00:0:0:8::2 as-number 200
[*SwitchA-bgp] peer fc00:0:0:10::2 as-number 200
[*SwitchA-bgp] ipv6-family unicast
[*SwitchA-bgp-af-ipv6] peer fc00:0:0:8::2 enable
[*SwitchA-bgp-af-ipv6] peer fc00:0:0:10::2 enable
[*SwitchA-bgp-af-ipv6] commit
[~SwitchA-bgp-af-ipv6] quit
[~SwitchA-bgp] quit
# 配置SwitchB。
[~SwitchB] bgp 200
[*SwitchB-bgp] router-id 10.2.2.2
[*SwitchB-bgp] peer fc00:0:0:8::1 as-number 100
[*SwitchB-bgp] peer fc00:0:0:9::1:2 as-number 200
[*SwitchB-bgp] ipv6-family unicast
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:8::1 enable
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:9::1:2 enable
[*SwitchB-bgp-af-ipv6] network fc00:0:0:7:: 64
[*SwitchB-bgp-af-ipv6] commit
[~SwitchB-bgp-af-ipv6] quit
[~SwitchB-bgp] quit
# 配置SwitchC。
[~SwitchC] bgp 200
[*SwitchC-bgp] router-id 10.3.3.3
[*SwitchC-bgp] peer fc00:0:0:10::1 as-number 100
[*SwitchC-bgp] peer fc00:0:0:9::1:1 as-number 200
[*SwitchC-bgp] ipv6-family unicast
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:10::1 enable
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:9::1:1 enable
[*SwitchC-bgp-af-ipv6] commit
[~SwitchC-bgp-af-ipv6] quit
[~SwitchC-bgp] quit
# 在SwitchA上查看,BGP邻居已经建立(Established)。
[SwitchA] display bgp ipv6 peer
BGP local router ID : 10.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 FC00:0:0:8::2 4 200 5 6 0 00:01:28 Established 1 FC00:0:0:10::2 4 200 4 5 0 00:00:04 Established 1
- 配置MED属性
通过策略配置SwitchB和SwitchC发送给SwitchA的MED值。
# 配置SwitchB。
[~SwitchB] route-policy 10 permit node 10
[*SwitchB-route-policy] apply cost 100
[*SwitchB-route-policy] quit
[*SwitchB] bgp 200
[*SwitchB-bgp] ipv6-family unicast
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:8::1 route-policy 10 export
[*SwitchB-bgp-af-ipv6] quit
[*SwitchB-bgp] quit
[*SwitchB] commit
# 配置SwitchC。
[~SwitchC] route-policy 10 permit node 10
[*SwitchC-route-policy] apply cost 150
[*SwitchC-route-policy] quit
[*SwitchC] bgp 200
[*SwitchC-bgp] ipv6-family unicast
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:10::1 route-policy 10 export
[*SwitchC-bgp-af-ipv6] quit
[*SwitchC-bgp] quit
[*SwitchC] commit
# 查看SwitchA上BGP的所有路由信息。
[SwitchA] display bgp ipv6 routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 2 *> Network : FC00:0:0:7:: PrefixLen : 64 NextHop : FC00:0:0:8::2 LocPrf : MED : 100 PrefVal : 0 Label : Path/Ogn : 200i * NextHop : FC00:0:0:10::2 LocPrf : MED : 150 PrefVal : 0 Label : Path/Ogn : 200i
从BGP路由表可以看出,去往FC00:0:0:7::1/64的路由下一跳地址为FC00:0:0:8::2,流量在主链路SwitchA→SwitchB上传输。
- 配置BFD检测功能、发送和接收间隔、本地检测时间倍数。
# 在SwitchA上使能BFD功能,并指定最小发送和接收间隔为300ms,本地检测时间倍数为5。
[~SwitchA] bfd
[*SwitchA-bfd] quit
[*SwitchA] bgp 100
[*SwitchA-bgp] peer fc00:0:0:8::2 bfd enable
[*SwitchA-bgp] peer fc00:0:0:8::2 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5
[*SwitchA-bgp] quit
[*SwitchA] commit
# 在SwitchB上使能BFD功能,并指定最小发送和接收间隔为300ms,本地检测时间倍数为5。
[~SwitchB] bfd
[*SwitchB-bfd] quit
[*SwitchB] bgp 200
[*SwitchB-bgp] peer fc00:0:0:8::1 bfd enable
[*SwitchB-bgp] peer fc00:0:0:8::1 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5
[*SwitchB-bgp] commit
[~SwitchB-bgp] quit
# 在SwitchA上显示BGP建立的所有BFD会话。
[SwitchA] display bgp ipv6 bfd session all
-------------------------------------------------------------------------------- Local_Address : FC00:0:0:8::1 Peer_Address : FC00:0:0:8::2 Tx-interval(ms): 300 Rx-interval(ms): 300 Multiplier : 5 Interface : 10GE1/0/1 Session-State : Up Wtr-interval(m): 0 --------------------------------------------------------------------------------
- 查看配置结果
# 对SwitchB的10GE1/0/2接口执行shutdown命令,模拟主链路故障。
[~SwitchB] interface 10ge 1/0/2
[~SwitchB-10GE1/0/2] shutdown
[*SwitchB-10GE1/0/2] commit
# 在SwitchA上,查看BGP路由表。
[SwitchA] display bgp ipv6 routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 1 *> Network : FC00:0:0:7:: PrefixLen : 64 NextHop : FC00:0:0:10::2 LocPrf : MED : 150 PrefVal : 0 Label : Path/Ogn : 200i
从BGP路由表可以看出,在主链路失效后,备份链路SwitchA-SwitchC-SwitchB生效,去往FC00:0:0:7::1/64的路由下一跳地址为FC00:0:0:10::2。
配置文件
SwitchA的配置文件
# sysname SwitchA # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:8::1/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:10::1/64 # bgp 100 router-id 10.1.1.1 peer FC00:0:0:8::2 as-number 200 peer FC00:0:0:8::2 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 peer FC00:0:0:8::2 bfd enable peer FC00:0:0:10::2 as-number 200 # ipv4-family unicast # ipv6-family unicast peer FC00:0:0:8::2 enable peer FC00:0:0:10::2 enable # return
SwitchB的配置文件
# sysname SwitchB # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:9::1:1/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:8::2/64 # interface 10GE1/0/3 undo portswitch ipv6 enable ipv6 address FC00:0:0:7::1/64 # bgp 200 router-id 10.2.2.2 peer FC00:0:0:8::1 as-number 100 peer FC00:0:0:8::1 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 peer FC00:0:0:8::1 bfd enable peer FC00:0:0:9::1:2 as-number 200 # ipv4-family unicast # ipv6-family unicast network FC00:0:0:7:: 64 peer FC00:0:0:8::1 enable peer FC00:0:0:8::1 route-policy 10 export peer FC00:0:0:9::1:2 enable # route-policy 10 permit node 10 apply cost 100 # return
SwitchC的配置文件
# sysname SwitchC # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:9::1:2/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:10::2/64 # bgp 200 router-id 10.3.3.3 peer FC00:0:0:9::1:1 as-number 200 peer FC00:0:0:10::1 as-number 100 # ipv4-family unicast # ipv6-family unicast peer FC00:0:0:9::1:1 enable peer FC00:0:0:10::1 enable peer FC00:0:0:10::1 route-policy 10 export # route-policy 10 permit node 10 apply cost 150 # return