前回は BGP Advertise Best External による BGP のバックアップパスを設定してみました。通常であれば BGP はスプリットホラインズン動作によりループが出来ないように振る舞います。しかし、BGP Advertise Best External を使うとループが発生してしまうことがあります。今回は BGP Advertise Best External 設定環境下で意図的にループを発生させてみます。
構成
構成は下図の通りです。
以下の通り、BGP の属性を付与しています。
方向 | 属性 |
---|---|
R2 → R3 | MED 100 |
R2 ← R3 | MED 100 |
R5 → R6 | MED 200 |
R5 ← R6 | MED 200 |
R5 ← R6 | AS-PATH PREPEND(+1) |
ルータは Cisco IOS 15.4(1) を使いました。各ルータのコンフィグは以下の通りです。
R1 の設定
hostname R1 ! interface Loopback0 ip address 10.0.99.1 255.255.255.255 ! interface Ethernet0/1 ip address 10.0.12.1 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 10.0.61.1 255.255.255.0 no shutdown ! router bgp 65001 bgp router-id 10.0.99.1 network 10.0.0.0 mask 255.0.0.0 neighbor 10.0.12.2 remote-as 65002 neighbor 10.0.61.6 remote-as 65006 ! ip route 10.0.0.0 255.0.0.0 Null0 ! end
R2 の設定
hostname R2 ! interface Loopback0 ip address 10.0.99.2 255.255.255.255 ! interface Ethernet0/1 ip address 192.168.23.2 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 10.0.12.2 255.255.255.0 no shutdown ! router bgp 65002 bgp router-id 10.0.99.2 neighbor 10.0.12.1 remote-as 65001 neighbor 192.168.23.3 remote-as 65345 ! end
R3 の設定
hostname R3 ! interface Loopback0 ip address 192.168.99.3 255.255.255.255 ! interface Ethernet0/1 ip address 192.168.34.3 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 192.168.23.3 255.255.255.0 no shutdown ! router ospf 65345 router-id 192.168.99.3 passive-interface default no passive-interface Ethernet0/1 network 0.0.0.0 0.0.0.0 area 0.0.0.0 ! router bgp 65345 bgp router-id 192.168.99.3 neighbor 192.168.23.2 remote-as 65002 neighbor 192.168.23.2 remote-as 65002 neighbor 192.168.23.2 route-map MED-100 in neighbor 192.168.23.2 route-map MED-100 out neighbor 192.168.99.4 remote-as 65345 neighbor 192.168.99.4 update-source Loopback0 neighbor 192.168.99.4 next-hop-self neighbor 192.168.99.5 remote-as 65345 neighbor 192.168.99.5 update-source Loopback0 neighbor 192.168.99.5 next-hop-self ! route-map MED-100 permit 10 set metric 100 ! end
R4 の設定
hostname R4 ! interface Loopback0 ip address 192.168.99.4 255.255.255.255 ! interface Ethernet0/1 ip address 192.168.45.4 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 192.168.34.4 255.255.255.0 no shutdown ! router ospf 65345 router-id 192.168.99.4 passive-interface default no passive-interface Ethernet0/1 no passive-interface Ethernet0/2 network 0.0.0.0 0.0.0.0 area 0.0.0.0 ! router bgp 65345 bgp router-id 192.168.99.4 network 192.168.0.0 mask 255.255.0.0 neighbor 192.168.99.3 remote-as 65345 neighbor 192.168.99.3 update-source Loopback0 neighbor 192.168.99.3 update-source Loopback0 neighbor 192.168.99.5 remote-as 65345 neighbor 192.168.99.5 update-source Loopback0 neighbor 192.168.99.5 update-source Loopback0 ! ip route 192.168.0.0 255.255.0.0 Null0 ! end
R5 の設定
hostname R5 ! interface Loopback0 ip address 192.168.99.5 255.255.255.255 ! interface Ethernet0/1 ip address 192.168.56.5 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 192.168.45.5 255.255.255.0 no shutdown ! router ospf 65345 router-id 192.168.99.5 passive-interface default no passive-interface Ethernet0/2 network 0.0.0.0 0.0.0.0 area 0.0.0.0 ! router bgp 65345 bgp router-id 192.168.99.5 neighbor 192.168.99.3 remote-as 65345 neighbor 192.168.99.3 update-source Loopback0 neighbor 192.168.99.3 next-hop-self neighbor 192.168.99.4 remote-as 65345 neighbor 192.168.99.4 update-source Loopback0 neighbor 192.168.99.4 next-hop-self neighbor 192.168.56.6 remote-as 65006 neighbor 192.168.56.6 route-map MED-200 in neighbor 192.168.56.6 route-map MED-200 out ! route-map MED-200 permit 10 set metric 200 ! end
R6 の設定
hostname R6 ! interface Loopback0 ip address 10.0.99.6 255.255.255.255 ! interface Ethernet0/1 ip address 10.0.61.6 255.255.255.0 no shutdown ! interface Ethernet0/2 ip address 192.168.56.6 255.255.255.0 no shutdown ! router bgp 65006 bgp router-id 10.0.99.6 neighbor 10.0.61.1 remote-as 65001 neighbor 192.168.56.5 remote-as 65345 neighbor 192.168.56.5 route-map AS-PATH-PREPEND out ! route-map AS-PATH-PREPEND permit 10 set as-path prepend 65006 ! end
通常の BGP テーブル
AS65345 側で見た 10.0.0.0/8 宛の BGP テーブルを図示すると以下の通りです。R5 は iBGP Peer へ経路を広告しない為、R3 や R4 では BGP テーブル上には 1 経路しかありません。
R3 の BGP テーブル
R3# show ip bgp 10.0.0.0/8 subnets BGP table version is 3, local router ID is 192.168.99.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.0.0.0 192.168.23.2 100 0 65002 65001 i
R4 の BGP テーブル
R4# show ip bgp 10.0.0.0/8 subnets BGP table version is 3, local router ID is 192.168.99.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i 10.0.0.0 192.168.99.3 100 100 0 65002 65001 i
R5 の BGP テーブル
R5# show ip bgp 10.0.0.0/8 subnets BGP table version is 4, local router ID is 192.168.99.5 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i 10.0.0.0 192.168.99.3 100 100 0 65002 65001 i * 192.168.56.6 200 0 65006 65006 65001 i
R4 → R1 への Traceroute
R4 から R1 へ Traceroute を実行した結果は以下の通りです。「R4 → R3 → R2 → R1」とホップしています。
R4# traceroute 10.0.99.1 numeric probe 1 Type escape sequence to abort. Tracing the route to 10.0.99.1 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.34.3 1 msec 2 192.168.23.2 1 msec 3 10.0.12.1 [AS 65001] 1 msec
Advertise Best External を有効化した時の BGP テーブル
R5 で Advertise Best External を有効化します。
R5# configure terminal Enter configuration commands, one per line. End with CNTL/Z. R5(config)# router bgp 65345 R5(config-router)# bgp advertise-best-external R5(config-router)# end R5#
この状態の BGP テーブルを図示すると以下の通りです。先程は R5 が eBGP で学習している経路を iBGP Peer に広告していませんでした。しかし、Advertise Best External を有効化したことで R5 が eBGP で学習した経路を iBGP Peer 経由で広告している為、R3 や R4 でバックアップパスを学習出来ていることが分かります。
R3 の BGP テーブル
R5 から iBGP でバックアップパスを受信しているのが分かります。
R3# show ip bgp 10.0.0.0/8 subnets BGP table version is 3, local router ID is 192.168.99.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path * i 10.0.0.0 192.168.99.5 200 100 0 65006 65006 65001 i *> 192.168.23.2 100 0 65002 65001 i
R4 の BGP テーブル
R3 同様、R5 から iBGP でバックアップパスを受信しているのが分かります。
R4# show ip bgp 10.0.0.0/8 subnets BGP table version is 3, local router ID is 192.168.99.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path * i 10.0.0.0 192.168.99.5 200 100 0 65006 65006 65001 i *>i 192.168.99.3 100 100 0 65002 65001 i
R5 の BGP テーブル
R6 から eBGP で学習している経路を「b(backup-path)」の「x(best-external」)として認識しているのが分かります。
R5# show ip bgp 10.0.0.0/8 subnets BGP table version is 6, local router ID is 192.168.99.5 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i 10.0.0.0 192.168.99.3 100 100 0 65002 65001 i *b x 192.168.56.6 200 0 65006 65006 65001 i
詳細に確認すると以下のように表示されます。
R5# show ip bgp 10.0.0.0/8 BGP routing table entry for 10.0.0.0/8, version 5 Paths: (2 available, best #1, table default) Advertise-best-external Advertised to update-groups: 1 2 Refresh Epoch 1 65002 65001 192.168.99.3 (metric 21) from 192.168.99.3 (192.168.99.3) Origin IGP, metric 100, localpref 100, valid, internal, best rx pathid: 0, tx pathid: 0x0 Refresh Epoch 1 65006 65006 65001 192.168.56.6 from 192.168.56.6 (10.0.99.6) Origin IGP, metric 200, localpref 100, valid, external, backup/repair, advertise-best-external , recursive-via-connected rx pathid: 0, tx pathid: 0
R4 → R1 への Traceroute
R4 から R1 へ Traceroute を実行した結果は以下の通りです。バックアップパスを学習しても障害が発生ているわけでは無いのでホップするルートに変化はありません。Advertise Best External を設定する前と同様に「R4 → R3 → R2 → R1」とホップしています。
R4# traceroute 10.0.99.1 numeric probe 1 Type escape sequence to abort. Tracing the route to 10.0.99.1 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.34.3 0 msec 2 192.168.23.2 1 msec 3 10.0.12.1 [AS 65001] 1 msec
ループさせてみる
ここでループさせてみる為に R5 → R4 の iBGP で LP(Local Preference)200 を設定します。
R4# configure terminal Enter configuration commands, one per line. End with CNTL/Z. R4(config)#route-map LP-200 permit 10 R4(config-route-map)# set local-preference 200 R4(config-route-map)#exit R4(config)# R4(config)#router bgp 65345 R4(config-router)# neighbor 192.168.99.5 route-map LP-200 in R4(config-router)#end R4#
設定が完了したら iBGP Peer を Soft Refresh し、設定変更を反映します。
R4# clear ip bgp 192.168.99.5 soft in
この状態の BGP テーブルを図示すると以下の通りです。R3 と R5 の BGP テーブルに変化はありません。但し、R5 → R4 の iBGP Peer に LP 200 を設定した為、R4 の Best Path が(R3 では無く)R5 に切り替わっているのがポイントです。
同じ Prefix(10.0.0.0/8)に対して…
- R5 は R3 を NextHop だと認識している(NextHop は R4)
- R4 は R5 を NextHop だと認識している(NextHop は R5)
…と NextHop がお互いを向いており、ループしています。
R3 の BGP テーブル
R3 の BGP テーブルには特に変化はありません。
R3# show ip bgp 10.0.0.0/8 subnets BGP table version is 3, local router ID is 192.168.99.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path * i 10.0.0.0 192.168.99.5 200 100 0 65006 65006 65001 i *> 192.168.23.2 100 0 65002 65001 i
R4 の BGP テーブル
R5 との iBGP に LP 200 を設定した為、10.0.0.0/8 の LP(LocPrf)が 200 に変更され、Best Path に選出されています。
R4# show ip bgp 10.0.0.0/8 subnets BGP table version is 4, local router ID is 192.168.99.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i 10.0.0.0 192.168.99.5 200 200 0 65006 65006 65001 i * i 192.168.99.3 100 100 0 65002 65001 i
R5 の BGP テーブル
R5 の BGP テーブルには特に変化はありません。
R5# show ip bgp 10.0.0.0/8 subnets BGP table version is 6, local router ID is 192.168.99.5 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *>i 10.0.0.0 192.168.99.3 100 100 0 65002 65001 i *b x 192.168.56.6 200 0 65006 65006 65001 i
R4 → R1 への Traceroute
R4 から R1 へ Traceroute を実行した結果は以下の通りです。ループしている為、R4 から R1 への疎通性が無くなってしまいました。
R4# traceroute 10.0.99.1 numeric probe 1 Type escape sequence to abort. Tracing the route to 10.0.99.1 VRF info: (vrf in name/id, vrf out name/id) 1 192.168.45.5 1 msec 2 192.168.45.4 0 msec 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20 * 21 * 22 * 23 * 24 * 25 * 26 * 27 * 28 * 29 * 30 *
まとめ
バックアップパスが存在することで障害が発生してもいち早くバックアップパスに切り替わることが出来る、という利点は存在します。但し、BGP Advertise Best External を利用している環境下で更に属性値により Best Path を操作していると今回のように簡単にループしてしまうので注意が必要です。