1.組網需求
在AS 200內使用OSPF作為IGP協議,實現AS內的互通。
Switch A與Switch C之間建立兩條IBGP連接。當Switch A與Switch C之間的兩條路徑均連通時,Switch C與1.1.1.0/24之間的報文使用Switch A<->Switch B<->Switch C這條路徑轉發;
當Switch A<->Switch B<->Switch C這條路徑發生故障時,BFD能夠快速檢測並通告BGP協議,使得Switch A<->Switch D<->Switch C這條路徑能夠迅速生效。
2.配置步驟
1)配置OSPF,保證Switch A和Switch C之間路由可達
2)Switch A上的BGP配置
# 配置Switch A和Switch C建立兩條IBGP連接。 [SwitchA] bgp 200 [SwitchA-bgp-default] peer 3.0.2.2 as-number 200 [SwitchA-bgp-default] peer 2.0.2.2 as-number 200 [SwitchA-bgp-default] address-family ipv4 unicast [SwitchA-bgp-default-ipv4] peer 3.0.2.2 enable [SwitchA-bgp-default-ipv4] peer 2.0.2.2 enable # 配置當Switch A與Switch C之間的兩條路徑均連通時,Switch C與1.1.1.0/24之間的報文使用Switch A<->Switch B<->Switch C這條路徑轉發。(在Switch A上對發布給對等體2.0.2.2的1.1.1.0/24路由配置較高的MED屬性值) ¡ 定義編號為2000的IPv4基本ACL,允許路由1.1.1.0/24通過。 [SwitchA] acl basic 2000 [SwitchA-acl-ipv4-basic-2000] rule permit source 1.1.1.0 0.0.0.255 ¡ 定義兩個Route-policy,一個名為apply_med_50,為路由1.1.1.0/24設置MED屬性值為50;另一個名為apply_med_100,為路由1.1.1.0/24設置MED屬性值為100。 [SwitchA] route-policy apply_med_50 permit node 10 [SwitchA-route-policy-apply_med_50-10] if-match ip address acl 2000 [SwitchA-route-policy-apply_med_50-10] apply cost 50 [SwitchA-route-policy-apply_med_50-10] quit [SwitchA] route-policy apply_med_100 permit node 10 [SwitchA-route-policy-apply_med_100-10] if-match ip address acl 2000 [SwitchA-route-policy-apply_med_100-10] apply cost 100 [SwitchA-route-policy-apply_med_100-10] quit ¡ 對發布給對等體3.0.2.2的路由應用名為apply_med_50的Route-policy,對發布給對等體2.0.2.2的路由應用名為apply_med_100的Route-policy。 [SwitchA] bgp 200 [SwitchA-bgp-default] address-family ipv4 unicast [SwitchA-bgp-default-ipv4] peer 3.0.2.2 route-policy apply_med_50 export [SwitchA-bgp-default-ipv4] peer 2.0.2.2 route-policy apply_med_100 export [SwitchA-bgp-default-ipv4] quit # 配置當Switch A<->Switch B<->Switch C這條路徑發生故障時,BFD能夠快速檢測並通告BGP協議,使得Switch A<->Switch D<->Switch C這條路徑能夠迅速生效。 [SwitchA-bgp-default] peer 3.0.2.2 bfd
3)Switch C上的BGP配置。
# 配置Switch A和Switch C建立兩條IBGP連接。 [SwitchC] bgp 200 [SwitchC-bgp-default] peer 3.0.1.1 as-number 200 [SwitchC-bgp-default] peer 2.0.1.1 as-number 200 [SwitchC-bgp-default] address-family ipv4 unicast [SwitchC-bgp-default-ipv4] peer 3.0.1.1 enable [SwitchC-bgp-default-ipv4] peer 2.0.1.1 enable [SwitchC-bgp-default-ipv4] quit # 配置當Switch A<->Switch B<->Switch C這條路徑發生故障時,BFD能夠快速檢測並通告BGP協議,使得Switch A<->Switch D<->Switch C這條路徑能夠迅速生效。 [SwitchC-bgp-default] peer 3.0.1.1 bfd
3.驗證配置
# 顯示Switch C的BFD信息。
<SwitchC> display bfd session verbose Total Session Num: 1 Up Session Num: 1 Init Mode: Active IPv4 Session Working Under Ctrl Mode: Local Discr: 513 Remote Discr: 513 Source IP: 3.0.2.2 Destination IP: 3.0.1.1 Session State: Up Interface: N/A Min Tx Inter: 500ms Act Tx Inter: 500ms Min Rx Inter: 500ms Detect Inter: 2500ms Rx Count: 135 Tx Count: 135 Connect Type: Indirect Running Up for: 00:00:58 Hold Time: 2457ms Auth mode: None Detect Mode: Async Slot: 0 Protocol: BGP Version:1 Diag Info: No Diagnostic 以上顯示信息表明:Switch A和Switch C之間已經建立了BFD連接,而且BFD協議運行正常。
# 在Switch C上查看BGP鄰居信息,可以看出Switch A和Switch C之間建立兩條BGP連接,且均處於Established狀態。 <SwitchC> display bgp peer ipv4 BGP local router ID: 3.3.3.3 Local AS number: 200 Total number of peers: 2 Peers in established state: 2 * - Dynamically created peer ^ - Peer created through link-local address Peer AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State 2.0.1.1 200 4 5 0 0 00:01:55 Established 3.0.1.1 200 4 5 0 0 00:01:52 Established
# 在Switch C上查看1.1.1.0/24的路由信息,可以看出Switch C通過Switch A<->Switch B<->Switch C這條路徑與1.1.1.0/24網段通信。 <SwitchC> display ip routing-table 1.1.1.0 24 verbose Summary count : 1 Destination: 1.1.1.0/24 Protocol: BGP Process ID: 0 SubProtID: 0x1 Age: 00h00m09s Cost: 50 Preference: 255 IpPre: N/A QosLocalID: N/A Tag: 0 State: Active Adv OrigTblID: 0x1 OrigVrf: default-vrf TableID: 0x2 OrigAs: 0 NibID: 0x15000001 LastAs: 0 AttrID: 0x1 Neighbor: 3.0.1.1 Flags: 0x10060 OrigNextHop: 3.0.1.1 Label: NULL RealNextHop: 3.0.2.1 BkLabel: NULL BkNextHop: N/A SRLabel: NULL BkSRLabel: NULL SIDIndex: NULL InLabel: NULL Tunnel ID: Invalid Interface: Vlan-interface101 BkTunnel ID: Invalid BkInterface: N/A FtnIndex: 0x0 TrafficIndex: N/A Connector: N/A PathID: 0x0 LinkCost: 0 MicroSegID: 0
# Switch A和Switch B之間的鏈路發生故障后,在Switch C上查看1.1.1.0/24的路由信息,可以看出Switch C通過Switch A<->Switch D<->Switch C這條路徑與1.1.1.0/24網段通信。 <SwitchC> display ip routing-table 1.1.1.0 24 verbose Summary count : 1 Destination: 1.1.1.0/24 Protocol: BGP Process ID: 0 SubProtID: 0x1 Age: 00h03m08s Cost: 100 Preference: 255 IpPre: N/A QosLocalID: N/A Tag: 0 State: Active Adv OrigTblID: 0x1 OrigVrf: default-vrf TableID: 0x2 OrigAs: 0 NibID: 0x15000000 LastAs: 0 AttrID: 0x0 Neighbor: 2.0.1.1 Flags: 0x10060 OrigNextHop: 2.0.1.1 Label: NULL RealNextHop: 2.0.2.1 BkLabel: NULL BkNextHop: N/A SRLabel: NULL BkSRLabel: NULL SIDIndex: NULL InLabel: NULL Tunnel ID: Invalid Interface: Vlan-interface201 BkTunnel ID: Invalid BkInterface: N/A FtnIndex: 0x0 TrafficIndex: N/A Connector: N/A PathID: 0x0 LinkCost: 0 MicroSegID: 0