
こんにちは、ITインフラ本部インフラ部ネットワークグループNRE(Network Reliability Engineering)チームの大橋です。
この記事では、バックボーン検証中に発生したCisco IOS XRのiBGPの挙動について紹介します。
Cisco IOS XRでeBGPマルチパスを有効にすると、iBGPピアへの経路広報時にnext-hop-selfが自動的に動作します。
これは仕様上の動作であり、意図しない経路変更の原因となり得ます。
この挙動は next-hop-self を明示的に無効化する設定で簡単に制御可能です。
本記事では、この仕様の詳細と対策をまとめています。
DMMでは、物理的に分離された2系統のバックボーンネットワークを運用しています。
この2系統はそれぞれ、Cisco社と別メーカの2社の製品を用いたマルチベンダー構成となっており、各拠点は冗長性の要件に基づき、そのいずれかまたは両方に接続されています。
2系統のうち一方のバックボーンのリプレイスは完了しており、現在は残るもう一方のリプレイスと、それに伴うネットワークアーキテクチャの最適化プロジェクトを進行中です。
この最適化では、オーバーレイプロトコルをBGPに統一し、OSPFはアンダーレイのIGPとしての役割に限定する設計を目指していました。
この新アーキテクチャへの移行検証において、これまでBGP-to-OSPFで実施していた再配送(redistribution)を廃止しました。
その結果、従来はマスクされていたnext-hop-selfの挙動が顕在化し、iBGPピア間で経路を広報する際にネクストホップが自身のIPアドレスへ自動的に書き換えられる事象が予期せず発生しました。
これは、Cisco IOS XRのデフォルト仕様に起因する動作であり、少なくとも今回比較対象とした他社製品では再現されないことから、検証中に意図せず遭遇する形となりました。
containerlab に同様の構成を用意して確認しました。

コアから見ると拠点Aのみマルチパスとなっています。
まず各拠点の広報経路を確認してみます。
site-a-1#show bgp neighbors 192.0.2.4 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.5, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.0/25 192.0.2.5 - - - - 64501 ?site-a-1#show bgp neighbors 192.0.2.8 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.5, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.0/25 192.0.2.9 - - - - 64501 ?site-a-1#show bgp neighbors 2001:db8::1:4 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.5, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:1::/64 2001:db8::1:5 - - - - 64501 ?site-a-1#show bgp neighbors 2001:db8::1:8 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.5, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:1::/64 2001:db8::1:9 - - - - 64501 ?site-a-1#
site-a-2#show bgp neighbors 192.0.2.6 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.7, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.0/25 192.0.2.7 - - - - 64501 ?site-a-2#show bgp neighbors 192.0.2.10 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.7, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.0/25 192.0.2.11 - - - - 64501 ?site-a-2#show bgp neighbors 2001:db8::1:6 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.7, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:1::/64 2001:db8::1:7 - - - - 64501 ?site-a-2#show bgp neighbors 2001:db8::1:10 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.7, local AS number 64501Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:1::/64 2001:db8::1:11 - - - - 64501 ?
Next Hopの値がすべてコアルータとの接続インターフェースのIPアドレスになっています。
想定通りです。
site-b-1#show bgp neighbors 192.0.2.12 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.13, local AS number 64502Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.128/25 192.0.2.13 - - - - 64502 ?site-b-1#show bgp neighbors 2001:db8::1:12 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.13, local AS number 64502Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:2::/64 2001:db8::1:13 - - - - 64502 ?
site-b-2#show bgp neighbors 192.0.2.14 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.15, local AS number 64502Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 198.51.100.128/25 192.0.2.15 - - - - 64502 ?site-b-2#show bgp neighbors 2001:db8::1:14 advertised-routesBGP routing table information for VRF defaultRouter identifier 192.0.2.15, local AS number 64502Route status codes: s - suppressed, * - valid, > - active, E - ECMP head, e - ECMP S - Stale, c - Contributing to ECMP, b - backup, L - labeled-unicast, q - Queued for advertisement % - Pending BGP convergenceOrigin codes: i - IGP, e - EGP, ? - incompleteRPKI Origin Validation codes: V - valid, I - invalid, U - unknownAS Path Attributes: Or-ID - Originator ID, C-LST - Cluster List, LL Nexthop - Link Local Nexthop Network Next Hop Metric AIGP LocPref Weight Path * > 2001:db8:2::/64 2001:db8::1:15 - - - - 64502 ?
Next Hopの値がすべてコアルータとの接続インターフェースのIPアドレスになっています。
こちらも想定通りです。
各拠点のプレフィックスを確認してみます。
RP/0/RP0/CPU0:core1#show route 198.51.100.0/25Wed Aug 20 16:50:49.750 UTCRouting entry for 198.51.100.0/25 Known via "bgp 64500", distance 20, metric 0 Tag 64501, type external Installed Aug 20 15:19:11.602 for 01:31:38 Routing Descriptor Blocks 192.0.2.5, from 192.0.2.5, BGP external, BGP multi path Route metric is 0 192.0.2.7, from 192.0.2.7, BGP external, BGP multi path Route metric is 0 No advertising protos. RP/0/RP0/CPU0:core1#show route ipv6 2001:db8:1::/64Wed Aug 20 16:51:12.514 UTCRouting entry for 2001:db8:1::/64 Known via "bgp 64500", distance 20, metric 0 Tag 64501, type external Installed Aug 20 15:19:49.410 for 01:31:23 Routing Descriptor Blocks 2001:db8::1:5, from 2001:db8::1:5, BGP external, BGP multi path Route metric is 0 2001:db8::1:7, from 2001:db8::1:7, BGP external, BGP multi path Route metric is 0 No advertising protos.
nexthopが拠点境界ルータのインターフェースのIPアドレスになっており、マルチパスも有効になっています。
想定通りです。
RP/0/RP0/CPU0:core1#show route 198.51.100.128/25Wed Aug 20 16:53:42.020 UTCRouting entry for 198.51.100.128/25 Known via "bgp 64500", distance 20, metric 0 Tag 64502, type external Installed Aug 20 15:51:18.216 for 01:02:23 Routing Descriptor Blocks 192.0.2.13, from 192.0.2.13, BGP external Route metric is 0 No advertising protos.RP/0/RP0/CPU0:core1#show route ipv6 2001:db8:2::/64Wed Aug 20 16:53:56.218 UTCRouting entry for 2001:db8:2::/64 Known via "bgp 64500", distance 20, metric 0 Tag 64502, type external Installed Aug 20 16:13:09.147 for 00:40:47 Routing Descriptor Blocks 2001:db8::1:13, from 2001:db8::1:13, BGP external Route metric is 0 No advertising protos.RP/0/RP0/CPU0:core1#
nexthopが拠点境界ルータのインターフェースのIPアドレスになっています。
こちらはマルチパスにはなっていません。
想定通りです。
iBGP経由で聞こえてくる経路を確認してみます。
RP/0/RP0/CPU0:asbr1#show route 198.51.100.0/25Wed Aug 20 16:56:56.179 UTCRouting entry for 198.51.100.0/25 Known via "bgp 64500", distance 200, metric 0 Tag 64501, type internal Installed Aug 20 15:19:10.800 for 01:37:45 Routing Descriptor Blocks 203.0.113.1, from 203.0.113.1 Route metric is 0 No advertising protos.RP/0/RP0/CPU0:asbr1#show route ipv6 2001:db8:1::/64Wed Aug 20 16:57:07.282 UTCRouting entry for 2001:db8:1::/64 Known via "bgp 64500", distance 200, metric 0 Tag 64501, type internal Installed Aug 20 15:19:48.607 for 01:37:18 Routing Descriptor Blocks 2001:db8::1, from 2001:db8::1 Route metric is 0 No advertising protos.RP/0/RP0/CPU0:asbr1#
nexthopが拠点境界ルータ1/2のインターフェースのIPアドレスではなくコアルータ1のループバックのIPアドレスになっています。
iBGPの受信経路を確認してみます。
RP/0/RP0/CPU0:asbr1#show bgp neighbor 203.0.113.1 received routesWed Aug 20 17:02:00.432 UTCBGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secs BGP table state: ActiveTable ID: 0xe0000000 RD version: 6BGP main routing table version 6BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path*>i198.51.100.0/25 203.0.113.1 100 0 64501 ?*>i198.51.100.128/25 192.0.2.13 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#show bgp neighbor 203.0.113.2 received routesWed Aug 20 17:02:18.932 UTCBGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secsNon-stop routing is enabledBGP table state: ActiveTable ID: 0xe0000000 RD version: 6BGP main routing table version 6BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path* i198.51.100.0/25 192.0.2.9 100 0 64501 ?* i198.51.100.128/25 192.0.2.15 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#show bgp ipv6 all neighbors 2001:db8::1 received routesWed Aug 20 17:03:33.145 UTCAddress Family: IPv6 Unicast----------------------------BGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secsNon-stop routing is enabledBGP table state: ActiveTable ID: 0xe0800000 RD version: 6BGP main routing table version 6BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path*>i2001:db8:1::/64 2001:db8::1 100 0 64501 ?*>i2001:db8:2::/64 2001:db8::1:13 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#show bgp ipv6 all neighbors 2001:db8::2 received routesWed Aug 20 17:03:39.746 UTCAddress Family: IPv6 Unicast----------------------------BGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secsNon-stop routing is enabledBGP table state: ActiveTable ID: 0xe0800000 RD version: 6BGP main routing table version 6BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path* i2001:db8:1::/64 2001:db8::1:9 100 0 64501 ?* i2001:db8:2::/64 2001:db8::1:15 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#
Next Hopの部分を確認すると、コアルータ1から聞こえてきている経路のみnexthopがループバックのIPアドレスになっていることを確認できます。
ここまでの確認で、eBGPマルチパスが有効な経路をiBGPピアへ広報する際に、next-hop-selfが自動的に動作することがわかりました。
この自動的なnext-hop-selfの動作は、iBGPピアにおいて、ネクストホップ情報を書き換えないように設定することで無効化できます。
今回は、特定のネイバーに対してネクストホップを書き換えないようにするnext-hop-unchanged multipathという設定を利用します。
コアルータ1に下記のように設定を追加します。
RP/0/RP0/CPU0:core1(config-bgp-nbrgrp-af)#show commit changes diffWed Aug 20 17:20:51.714 UTCBuilding configuration... router bgp 64500 neighbor-group ibgp_v4 address-family ipv4 unicast+ next-hop-unchanged multipath ! ! neighbor-group ibgp_v6 address-family ipv6 unicast+ next-hop-unchanged multipath ! ! !endRP/0/RP0/CPU0:core1(config-bgp-nbrgrp-af)#
設定を追加したので再度ボーダールータで経路を確認してみます。
RP/0/RP0/CPU0:asbr1#show route 198.51.100.0/25Wed Aug 20 17:24:42.833 UTCRouting entry for 198.51.100.0/25 Known via "bgp 64500", distance 200, metric 0 Tag 64501, type internal Installed Aug 20 17:21:11.533 for 00:03:31 Routing Descriptor Blocks 192.0.2.5, from 203.0.113.1, BGP multi path Route metric is 0 192.0.2.9, from 203.0.113.2, BGP multi path Route metric is 0 No advertising protos.RP/0/RP0/CPU0:asbr1#show route ipv6 2001:db8:1::/64Wed Aug 20 17:24:59.523 UTCRouting entry for 2001:db8:1::/64 Known via "bgp 64500", distance 200, metric 0 Tag 64501, type internal Installed Aug 20 17:21:11.533 for 00:03:48 Routing Descriptor Blocks 2001:db8::1:5, from 2001:db8::1, BGP multi path Route metric is 0 2001:db8::1:9, from 2001:db8::2, BGP multi path Route metric is 0 No advertising protos.RP/0/RP0/CPU0:asbr1#
nexthopが拠点境界ルータ1/2のインターフェースのIPアドレスに変わりました。
multipathに変わったのは、nexthopをospfで解決しており、そのネクストホップが拠点境界ルータのインターフェイスのIPアドレスになり2台のコアルータから見えるコストが同じになったためです。
iBGPの受信経路を確認してみます。
RP/0/RP0/CPU0:asbr1#show bgp neighbor 203.0.113.1 received routesWed Aug 20 17:31:14.335 UTCBGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secsNon-stop routing is enabledBGP table state: ActiveTable ID: 0xe0000000 RD version: 7BGP main routing table version 7BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path*>i198.51.100.0/25 192.0.2.5 100 0 64501 ?*>i198.51.100.128/25 192.0.2.13 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#show bgp ipv6 all neighbors 2001:db8::1 received routesWed Aug 20 17:31:18.272 UTCAddress Family: IPv6 Unicast----------------------------BGP router identifier 203.0.113.11, local AS number 64500BGP generic scan interval 60 secsNon-stop routing is enabledBGP table state: ActiveTable ID: 0xe0800000 RD version: 7BGP main routing table version 7BGP NSR Initial initsync version 2 (Reached)BGP NSR/ISSU Sync-Group versions 0/0BGP scan interval 60 secsStatus codes: s suppressed, d damped, h history, * valid, > best i - internal, r RIB-failure, S stale, N Nexthop-discardOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path*>i2001:db8:1::/64 2001:db8::1:5 100 0 64501 ?*>i2001:db8:2::/64 2001:db8::1:13 100 0 64502 ?Processed 2 prefixes, 2 pathsRP/0/RP0/CPU0:asbr1#
こちらでもNext Hopが変わったことを確認できました。
本件についてCisco社に問い合わせたところ、仕様としての公式ドキュメントは存在しませんでした。
そのため、コミュニティに記事を書いていただきましたので、参考までにリンクを記載します。
IOS XR:eBGPのmultipathの経路をiBGPのneighborに広報した際にnext-hopが書き換わる
IOS XRではeBGPマルチパス利用時にnext-hop-selfが自動動作するため、意図せぬ経路変更を防ぐにはnext-hop-unchanged multipathで明示的に制御することが重要です。
DMMグループの多種多様なサービスを支える、大規模システムインフラのネットワークエンジニアとして活躍しませんか?
現在、以下の2つのポジションで新たな仲間を募集しています。
主な業務内容
主な業務内容
どちらのポジションも、DMMのサービスを縁の下で支える、非常にやりがいのある仕事です。
ご興味のある方は、ぜひカジュアル面談もやっているので気軽にどうぞ!
引用をストックしました
引用するにはまずログインしてください
引用をストックできませんでした。再度お試しください
限定公開記事のため引用できません。