BGPで複数経路を同時に利用する(マルチパス)場合の設定では「maximum-path」が有名ですが、これだけだとルーティングテーブルに複数パスが設定されない場合があります。
同じ事象で悩んでいる方は、この記事が役に立つかもしれません。
まぁ現実世界で利用する必要性はほとんどないかもしれませんが、CCIEのラボ環境だとありえるかもなので。
BGPでマルチパスを行う方法
詳細は、以下のリンクを参考してください。非常に非常に参考になります。というか、私がCCIEの勉強をしていた時もこのページは熟読しました。
シングルホームおよびマルチホーム環境における、BGP を使用したロード シェアリング:設定例
ちなみに、このレベルを勉強されている方は既にご存じだと思うのですが、そもそもマルチパスの対象とするBGPプレフィックスの候補になる為にはBGPのPath Selectionでかなり深いところまで対象のプレフィックスが一致する必要があります。その辺は以下を参考にしてください。CCIEを受けるなら、これも必読です。
つまり、マルチパスを行う流れとしては以下となります。
- ルータがBGPプレフィックスでマルチパスとしてルーティングテーブルに入れれる2つのプレフィックスを持っている事
- maximum-paths 2(かそれ以上)を設定する事
基本的には、これでルーティングテーブルに「B」がついた2つの経路が表示されるはずです。
上記だけだとマルチパスできなかったケース
今回、BGPのマルチパスの練習として以下のトポロジを作成したところ、マルチパスが出来ませんでした(R7のルーティングテーブルに1.1.1.1/32の経路が一つしか表示されない)。
例によってINEのトポロジを流用しています。汚くてごめんなさい。Apple Pencilに慣れるのにもう少しかかりそう。
考え方としては、R1で1.1.1.1/32をBGPのTableにInjectします。それを全部違うASで回して、最終的にR7がR6とR3から受け取るイメージ。
念のため、コンフィグを紹介します。
R1:
hostname R1 ! interface Loopback0 ip address 150.1.1.1 255.255.255.255 ipv6 address 2001:150:1:1::1/128 ! interface Loopback1 ip address 1.1.1.1 255.255.255.255 ! ! interface GigabitEthernet1/0 no ip address negotiation auto ! interface GigabitEthernet1/0.13 encapsulation dot1Q 13 ip address 155.1.13.1 255.255.255.0 ipv6 address 2001:155:1:13::1/64 interface GigabitEthernet1/0.146 encapsulation dot1Q 146 ip address 155.1.146.1 255.255.255.0 ipv6 address 2001:155:1:146::1/64 ! router bgp 1 bgp log-neighbor-changes network 1.1.1.1 mask 255.255.255.255 neighbor 155.1.13.3 remote-as 3 neighbor 155.1.146.6 remote-as 6 !
R3:
hostname R3 ! ! ! ! interface Loopback0 ip address 150.1.3.3 255.255.255.255 ipv6 address 2001:150:3:3::3/128 ! ! interface GigabitEthernet1/0 no ip address negotiation auto ! interface GigabitEthernet1/0.13 encapsulation dot1Q 13 ip address 155.1.13.3 255.255.255.0 ipv6 address 2001:155:1:13::3/64 ! interface GigabitEthernet1/0.23 encapsulation dot1Q 23 ip address 155.1.23.3 255.255.255.0 ipv6 address 2001:155:1:23::3/64 ! interface GigabitEthernet1/0.37 encapsulation dot1Q 37 ip address 155.1.37.3 255.255.255.0 ipv6 address 2001:155:1:37::3/64 ! interface GigabitEthernet1/0.100 encapsulation dot1Q 100 ip address 169.254.100.3 255.255.255.0 ipv6 address 2001:169:254:100::3/64 ! router bgp 3 bgp log-neighbor-changes neighbor 155.1.13.1 remote-as 1 neighbor 155.1.37.7 remote-as 7 !
R6:
hostname R6 ! interface Loopback0 ip address 150.1.6.6 255.255.255.255 ipv6 address 2001:150:6:6::6/128 ! interface GigabitEthernet1/0 no ip address negotiation auto ! interface GigabitEthernet1/0.67 encapsulation dot1Q 67 ip address 155.1.67.6 255.255.255.0 ipv6 address 2001:155:1:67::6/64 ! interface GigabitEthernet1/0.146 encapsulation dot1Q 146 ip address 155.1.146.6 255.255.255.0 ipv6 address 2001:155:1:146::6/64 ! router bgp 6 bgp log-neighbor-changes neighbor 155.1.67.7 remote-as 7 neighbor 155.1.146.1 remote-as 1 !
R7:
hostname R7 ! interface Loopback0 ip address 150.1.7.7 255.255.255.255 ipv6 address 2001:150:7:7::7/128 ! interface GigabitEthernet1/0 no ip address negotiation auto ! interface GigabitEthernet1/0.7 encapsulation dot1Q 7 ip address 155.1.7.7 255.255.255.0 ipv6 address 2001:155:1:7::7/64 ! interface GigabitEthernet1/0.37 encapsulation dot1Q 37 ip address 155.1.37.7 255.255.255.0 ipv6 address 2001:155:1:37::7/64 ! interface GigabitEthernet1/0.67 encapsulation dot1Q 67 ip address 155.1.67.7 255.255.255.0 ipv6 address 2001:155:1:67::7/64 ! interface GigabitEthernet1/0.79 encapsulation dot1Q 79 ip address 155.1.79.7 255.255.255.0 ipv6 address 2001:155:1:79::7/64 ! router bgp 7 bgp log-neighbor-changes neighbor 155.1.37.3 remote-as 3 neighbor 155.1.67.6 remote-as 6 maximum-paths 2
この状態でのR7のBGP Tableとip Tableが以下の通りです。
R7#sh ip bgp
BGP table version is 2, local router ID is 150.1.7.7
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
*> 1.1.1.1/32 155.1.37.3 0 3 1 i
* 155.1.67.6 0 6 1 i
R7#sh ip bgp 1.1.1.1/32
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (2 available, best #1, table default)
Multipath: eBGP
Advertised to update-groups:
1
Refresh Epoch 1
3 1
155.1.37.3 from 155.1.37.3 (150.1.3.3)
Origin IGP, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0
Refresh Epoch 1
6 1
155.1.67.6 from 155.1.67.6 (150.1.6.6)
Origin IGP, localpref 100, valid, external
rx pathid: 0, tx pathid: 0
R7#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 155.1.37.3, 01:30:59
150.1.0.0/32 is subnetted, 1 subnets
C 150.1.7.7 is directly connected, Loopback0
155.1.0.0/16 is variably subnetted, 8 subnets, 2 masks
C 155.1.7.0/24 is directly connected, GigabitEthernet1/0.7
L 155.1.7.7/32 is directly connected, GigabitEthernet1/0.7
C 155.1.37.0/24 is directly connected, GigabitEthernet1/0.37
L 155.1.37.7/32 is directly connected, GigabitEthernet1/0.37
C 155.1.67.0/24 is directly connected, GigabitEthernet1/0.67
L 155.1.67.7/32 is directly connected, GigabitEthernet1/0.67
C 155.1.79.0/24 is directly connected, GigabitEthernet1/0.79
L 155.1.79.7/32 is directly connected, GigabitEthernet1/0.79
R7#1.1.1.1/32を2経路から貰っているにもかかわらず、ip tableに1経路しか表示されていないことがわかると思います。このままだと、もともとの目的であるマルチパスが達成されいません。
なぜでしょうか?
複数AS元へマルチパスするときは追加設定が必要
ネットで色々調べたところ、どうやら複数AS元から同一プレフィックスをもらって、それをマルチパスするときは以下のコマンドが追加でR7に必要のようです。
・bgp bestpath as-path multipath-relax
なぜ「のようです」と書いているかと言いますと、このコマンド自体隠しコマンドで「?」などでcontext helpが使えません。
実際に設定してみました。
R7#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 155.1.37.3, 01:34:48
150.1.0.0/32 is subnetted, 1 subnets
C 150.1.7.7 is directly connected, Loopback0
155.1.0.0/16 is variably subnetted, 8 subnets, 2 masks
C 155.1.7.0/24 is directly connected, GigabitEthernet1/0.7
L 155.1.7.7/32 is directly connected, GigabitEthernet1/0.7
C 155.1.37.0/24 is directly connected, GigabitEthernet1/0.37
L 155.1.37.7/32 is directly connected, GigabitEthernet1/0.37
C 155.1.67.0/24 is directly connected, GigabitEthernet1/0.67
L 155.1.67.7/32 is directly connected, GigabitEthernet1/0.67
C 155.1.79.0/24 is directly connected, GigabitEthernet1/0.79
L 155.1.79.7/32 is directly connected, GigabitEthernet1/0.79
R7#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R7(config)#router bgp 7
R7(config-router)#bgp bestpath as-path multipath-relax ?
% Unrecognized command
R7(config-router)#bgp bestpath as-path multipath-relax
R7(config-router)#do sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 155.1.67.6, 00:00:04
[20/0] via 155.1.37.3, 00:00:04
150.1.0.0/32 is subnetted, 1 subnets
C 150.1.7.7 is directly connected, Loopback0
155.1.0.0/16 is variably subnetted, 8 subnets, 2 masks
C 155.1.7.0/24 is directly connected, GigabitEthernet1/0.7
L 155.1.7.7/32 is directly connected, GigabitEthernet1/0.7
C 155.1.37.0/24 is directly connected, GigabitEthernet1/0.37
L 155.1.37.7/32 is directly connected, GigabitEthernet1/0.37
C 155.1.67.0/24 is directly connected, GigabitEthernet1/0.67
L 155.1.67.7/32 is directly connected, GigabitEthernet1/0.67
C 155.1.79.0/24 is directly connected, GigabitEthernet1/0.79
L 155.1.79.7/32 is directly connected, GigabitEthernet1/0.79
R7(config-router)#
いかがでしょうか。「?」を入力してそんなコマンドないよ!と言われても実際にはコマンドを投入できています。そして、投入後のsh ip routeの結果としてマルチパスが実現できていることが確認できます。
ただ、現実的な設計では、殆どの場合同一ISPへマルチホーミングするなどでマルチパスを使用すると思うので、このコマンドを利用する機会は少ないのではないでしょうか。ラボ試験ではどんな問題がでるか分からないので、知っておくにこしたことはないと思います。
参考までに、R3をR6と同じAS(AS3→AS6)に変更した後にR7の情報を紹介しておきますね。bgp bestpath as-path multipath-relaxは外しました。
R7#sh ip bgp
BGP table version is 6, local router ID is 150.1.7.7
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
*m 1.1.1.1/32 155.1.37.3 0 6 1 i
*> 155.1.67.6 0 6 1 i
R7#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
B 1.1.1.1 [20/0] via 155.1.67.6, 00:00:11
[20/0] via 155.1.37.3, 00:00:11
150.1.0.0/32 is subnetted, 1 subnets
C 150.1.7.7 is directly connected, Loopback0
155.1.0.0/16 is variably subnetted, 8 subnets, 2 masks
C 155.1.7.0/24 is directly connected, GigabitEthernet1/0.7
L 155.1.7.7/32 is directly connected, GigabitEthernet1/0.7
C 155.1.37.0/24 is directly connected, GigabitEthernet1/0.37
L 155.1.37.7/32 is directly connected, GigabitEthernet1/0.37
C 155.1.67.0/24 is directly connected, GigabitEthernet1/0.67
L 155.1.67.7/32 is directly connected, GigabitEthernet1/0.67
C 155.1.79.0/24 is directly connected, GigabitEthernet1/0.79
L 155.1.79.7/32 is directly connected, GigabitEthernet1/0.79
R7#
bgp bestpath as-path multipath-relaxなしでも、マルチパスが実現出来ています。
BGPは色々隠しコマンドがあってややこしいですね・・・




コメント