はじめに
IOS XR デバイスにおいて eBGP の multipath の経路を iBGP の neighbor に広報した際に next-hop を自動的に自身のアドレスに書き換えます。
本ドキュメントではこの動作についての解説と、回避策について説明します。
本動作の解説
上図の R1 と R2 では同じ 10.10.10.10/32 のアドレスを持つ Lo10 を R101 に eBGP で広報しており、 R101 はさらに iBGP でそのルートを R6 に広報しています。
multipath 設定が入っていない場合の挙動
R101 に multipath の設定が入っていない場合、以下のように Router ID の比較により R1 からのルートが best path となります。
RP/0/RP0/CPU0:R101#show bgp 10.10.10.10/32 bestpath-compare
BGP routing table entry for 10.10.10.10/32
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to update-groups (with more than one peer):
0.5
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.6
Path #1: Received by speaker 0
Flags: 0x3000000001060001+0x00, import: 0x020
Advertised IPv4 Unicast paths to update-groups (with more than one peer):
0.5
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.6
65000
10.1.101.1 from 10.1.101.1 (10.0.0.1), if-handle 0x00000000 <<< Path#1 は R1 からのルート
Origin incomplete, metric 0, localpref 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 17
Origin-AS validity: (disabled)
best of AS 65000, Overall best
Path #2: Received by speaker 0
Flags: 0x3000000000020001+0x00, import: 0x020
Not advertised to any peer
65000
10.2.101.2 from 10.2.101.2 (10.0.0.2), if-handle 0x00000000 <<< Path#2 は R2 からのルート
Origin incomplete, metric 0, localpref 100, valid, external
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)
Higher router ID than best path (path #1)
R6 でも 10.10.10.10/32 の BGP エントリーを確認すると、 next hop は 10.1.101.1 になっており、これは R1 のアドレスとなります。 R101 では next-hop self の設定を入れていないため、これは自然な動作となります。
RP/0/RP0/CPU0:R6#show bgp 10.10.10.10/32 detail
BGP routing table entry for 10.10.10.10/32
-snip-
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Flags: 0x2000000001060005+0x00, import: 0x020
Not advertised to any peer
65000
10.1.101.1 (metric 2) from 10.0.0.101 (10.0.0.101), if-handle 0x00000000 <<< next hop が 10.1.101.1 のルートを R101 から受け取っている
Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 41
multipath 設定が入っている場合の挙動
R101 に multipath の設定が入っている場合、以下のように R101 において R1 と R2 からのルートが multipath となります。
RP/0/RP0/CPU0:R101#show bgp 10.10.10.10/32 bestpath-compare
BGP routing table entry for 10.10.10.10/32
-snip-
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to update-groups (with more than one peer):
0.5
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.6
Path #1: Received by speaker 0
Flags: 0x3000000001070001+0x00, import: 0x020
Advertised IPv4 Unicast paths to update-groups (with more than one peer):
0.5
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.6
65000
10.1.101.1 from 10.1.101.1 (10.0.0.1), if-handle 0x00000000
Origin incomplete, metric 0, localpref 100, valid, external, best, group-best, multipath
Received Path ID 0, Local Path ID 1, version 20
Origin-AS validity: (disabled)
best of AS 65000, Overall best
Path #2: Received by speaker 0
Flags: 0x3000000000070001+0x00, import: 0x020
Not advertised to any peer
65000
10.2.101.2 from 10.2.101.2 (10.0.0.2), if-handle 0x00000000
Origin incomplete, metric 0, localpref 100, valid, external, multipath, backup, add-path
Received Path ID 0, Local Path ID 4, version 21
Origin-AS validity: (disabled)
eBGP multi-path
この時に R6 で 10.10.10.10/32 の BGP エントリーを確認すると、 next hop は 10.0.0.101 になっており、これは R101 の iBGP を張っている Lo のアドレスとなります。 R101 では next-hop self の設定を入れていないにもかかわらず、 next hop が自動で書き換わります。こちらは仕様動作となっております。
RP/0/RP0/CPU0:R6#show bgp 10.10.10.10/32 detail
BGP routing table entry for 10.10.10.10/32
-snip-
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Flags: 0x2000000001060005+0x00, import: 0x020
Not advertised to any peer
65000
10.0.0.101 (metric 2) from 10.0.0.101 (10.0.0.101), if-handle 0x00000000
Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 42
回避策
この動作を回避したい場合、 以下のように R101 にて R6 向けの neighbor 設定に next-hop-unchanged multipath 設定を入れることで解消されます。
router bgp 65001
neighbor 10.0.0.6
address-family ipv4 unicast
next-hop-unchanged multipath
設定後に R6 で 10.10.10.10/32 の BGP エントリーを確認すると、 next hop は 10.1.101.1 になっており、 R101 での next hop の書き換えが無効になったことが確認できます。
RP/0/RP0/CPU0:R6#show bgp 10.10.10.10/32 detail
BGP routing table entry for 10.10.10.10/32
-snip-
Last Modified: Apr 25 05:35:17.321 for 00:00:16
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Flags: 0x2000000001060005+0x00, import: 0x020
Not advertised to any peer
65000
10.1.101.1 (metric 2) from 10.0.0.101 (10.0.0.101), if-handle 0x00000000
Origin incomplete, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 43