ADD-PATHとは
BGPは同じプレフィックスについて、ピアごとに1本しか広告できません。 UPDATEのNLRIが「プレフィックス長+プレフィックス」だけでできているため、 同じプレフィックスを2回送ると、後から送ったほうが前のものを置き換えてしまうからです。
RFC 7911(Proposed Standard)は、 NLRIの前にPath Identifierを足して経路を区別できるようにし、この制限を外します。
+--------------------------------+
| Path Identifier (4 octets) |
+--------------------------------+
| Length (1 octet) |
+--------------------------------+
| Prefix (variable) |
+--------------------------------+Capabilityで合意する
使うかどうかはOPENメッセージのCapabilityで決めます。
| 項目 | 値 |
|---|---|
| Capability Code | 69 |
| 値 | <AFI, SAFI, Send/Receive>の並び |
| Send/Receive | 1=受信できる/2=送信できる/3=両方 |
送る側と受ける側の両方が噛み合う必要があります。
For a BGP speaker to be able to send multiple paths to its peer, that BGP speaker MUST advertise the ADD-PATH Capability with the Send/Receive field set to either 2 or 3, and MUST receive from its peer the ADD-PATH Capability with the Send/Receive field set to either 1 or 3.
つまり片側だけ設定しても複数経路は流れません。送信側が2か3を広告し、かつ相手から1か3を受け取って初めて有効になります。
Capabilityの合意はOPENで行うため、設定を変えただけでは反映されません。
既存のセッションには古い値が残るので、clear bgpでセッションを張り直す必要があります。
Path Identifierの意味
Path Identifierは4オクテットの数値ですが、中身に意味はありません。
The assignment of the Path Identifier for a path by a BGP speaker is purely a local matter.
求められるのは「広告先ごとに(プレフィックス, Path Identifier)が一意であること」だけです。
受け取った側も番号から何かを読み取ってはいけません。
A BGP speaker that receives a route should not assume that the identifier carries any particular semantics.
同じ経路でも、ピアが違えば別の番号が付くことがあります。
何本広告するかは規格が決めていない
RFC 7911は本数も選び方も決めていません。唯一あるのは次の指針だけです。
A BGP speaker SHOULD include the best route when more than one path is advertised to a neighbor, unless it is a path received from that neighbor.
複数広告するならベストパスを含めるべきで、ただしそのピアから受け取った経路は除く(送り返さない)。 何本をどう選ぶかは実装とポリシーに委ねられています。
マルチパスとの違い
BGPマルチパスと混同しやすいのですが、層が違います。
| 項目 | ADD-PATH | マルチパス |
|---|---|---|
| 変えるもの | ピアへ広告する経路数 | 転送テーブルに入れる経路数 |
| 標準化 | RFC 7911 | されていない(実装ごとの拡張) |
| ピアから見た違い | 同じプレフィックスの経路が複数届く | 無い(広告されるのはベストパスだけ) |
| 仕組み | CapabilityとPath Identifierが必要 | ローカルの設定のみ |
IOS XRのset path-selectionには、advertise と install という別々のキーワード があり、
この違いがそのままコマンドに現れています。advertiseが広告(ADD-PATH側)、installがRIBへの導入(マルチパス側)です。
何のために使うのか
効いてくるのはルートリフレクタです。
RRはベストパスしかクライアントへ反射しないため、クライアントはAS内に別の出口があっても知ることができません。 ADD-PATHでRRが複数経路を反射すれば、クライアントはあらかじめ代替経路を持てます。 BGP PICのような高速切り替えの前提にもなります。
マルチパスを設定してあっても同じです。 クライアントにmaximum-pathsを入れても、
RRから1本しか届かなければ転送テーブルに入る経路も1本です。
BGPマルチパスはローカルの設定だけでは完結せず、
RRの下では複数経路が届いていることが前提になります。
IOS XRでの設定
address-family配下に置き、広告する経路の選び方はルートポリシーで指定します。
route-policy ADD-PATH-ALL
set path-selection all advertise
end-policy
!
router bgp 65001
address-family ipv4 unicast
additional-paths receive
additional-paths send
additional-paths selection route-policy ADD-PATH-ALL| 項目 | 内容 |
|---|---|
additional-paths receive | Capability 69 の受信側(Send/Receive に 1 を立てる) |
additional-paths send | 送信側(2 を立てる)。両方書くと 3 |
additional-paths selection route-policy <名前> | 何本どれを広告するかをポリシーで決める |
set path-selection all advertise | 候補すべてを広告する |
set path-selection backup 1 advertise | バックアップ経路を1本だけ広告する |
show bgp <プレフィックス> | 広告対象になった経路にadd-pathが付く |
additional-paths send はaddress-familyの直下に置く
additional-paths sendはneighbor配下のaddress-familyにも同じ名前で存在し、
どちらのヘルプにも出てきます。
RP/0/RP0/CPU0:R1(config-bgp-af)# additional-paths ?
advertise-limit Limit the number of paths to be advertised (default 32)
receive Additional paths Receive capability
selection Additional paths selection
send Additional paths Send capability
RP/0/RP0/CPU0:R1(config-bgp-af)# additional-paths
% Incomplete command.
RP/0/RP0/CPU0:R1(config-bgp-af)#
RP/0/RP0/CPU0:R1(config-bgp-nbr-af)# additional-paths ?
receive Additional paths Receive capability
send Additional paths Send capability
RP/0/RP0/CPU0:R1(config-bgp-nbr-af)# additional-paths
% Incomplete command.
RP/0/RP0/CPU0:R1(config-bgp-nbr-af)#ただし、neighbor配下に書いても送信のCapabilityは広告されません。
Cisco ASR 9000シリーズのBGPコマンドリファレンスも、
Command Modesを「IPv4 address family configuration」などとしたうえで、こう述べています。
When the additional-paths send command is configured, the send capability is automatically enabled for all internal BGP neighbors for the specified address family.
ネイバーごとに設定するものではなく、そのアドレスファミリの内部BGPネイバー全体に効きます。
紛らわしいのは、show bgp neighborsに出る次の2行が別物であることです。
| 行 | 意味 |
|---|---|
Addpath send capability enabled by configuration | neighbor配下にadditional-paths sendが書いてある |
Additional-paths Send: advertised | address-family直下の設定により、Capabilityを実際に広告している |
前者だけが出ていて後者が出ていない状態が存在します。設定した覚えがあるのに経路が増えないときは、 前者ではなく後者を見てください。
実機での検証
XRd 26.1.1のルータ6台で確認します。ルートリフレクタ構成にしているのは、ADD-PATHが実際に必要になるのがこの形だからです。
- AS 65001はR1がルートリフレクタ、R2・R3・R4がクライアント。OSPF area 0でLoopback0の到達性を作り、iBGPはLoopback0間
- R5(AS 65002)とR6(AS 65003)が同じ
192.168.100.0/24を広告するので、R1は2本受け取って片方をベストに選ぶ - R2・R3は外部から受けた経路に
next-hop-selfを適用する
| ルータ | 役割 | 外部セッション |
|---|---|---|
| R1 | ルートリフレクタ | なし |
| R2 | クライアント | R5(AS 65002)とeBGP |
| R3 | クライアント | R6(AS 65003)とeBGP |
| R4 | クライアント。観測点 | なし |
| R5 / R6 | 外部AS。192.168.100.0/24を出す | — |
観測点をR4にしているのが要点です。 R4は外部セッションを持たないので、
show bgpに出る経路はすべてR1が反射したものです。
R2やR3だと「自分の外部経路+反射分」で元々2本見えてしまい、ADD-PATHの効果と区別がつきません。
検証の全体像
| STEP | 操作 | 確かめること |
|---|---|---|
| 0 | 初期状態(ADD-PATHの設定なし) | RRは2本持っていてもクライアントへは1本。R4の転送も1本 |
| 1 | R1 - R4のセッションをリセット | 既定のOPENにCapability 69が無い |
| 2 | R1〜R4にadditional-paths receive | 両側ともReceive (1)。それだけでは増えない |
| 3 | R1のneighbor配下にadditional-paths sendと選択ポリシー | それでもSendは広告されない |
| 4 | R1のaddress-family直下にadditional-paths send | ここでBoth (3)。R4に2本届き、転送も2本になる |
| 5 | 選択ポリシーをbackup 1 advertiseに変更 | 広告する経路の選び方はポリシーで決まる |
| 6 | ADD-PATHの設定をすべて外す | 1本に戻る |
STEP 3とSTEP 4の違いは、additional-paths sendをどこに書いたかだけです。
R4には最初からmaximum-paths ibgp 2とbgp bestpath as-path multipath-relaxを入れてあり、
全STEPを通して一度も変更していません。R4の転送エントリが増減する理由をADD-PATHだけに限定するためです。
router bgp 65001
bgp router-id 10.0.0.4
bgp bestpath as-path multipath-relax
address-family ipv4 unicast
maximum-paths ibgp 2
!STEP 1・2・3・4ではR1 - R4間のパケットキャプチャーを取っています。
いずれもclear bgpでセッションを張り直した前後を含みます。
STEP 0:RRはベストパスしか反射しない
R1は2本持っていますが、R4に届くのは1本だけです。
RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Fri Sep 11 22:30:39.555 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 3 3
Last Modified: Sep 11 22:24:55.023 for 00:05:44
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.3 10.0.0.4
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.3 10.0.0.4
65002, (Received from a RR-client), (received & used)
10.0.0.2 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 3
Path #2: Received by speaker 0
Not advertised to any peer
65003, (Received from a RR-client), (received & used)
10.0.0.3 (metric 2) from 10.0.0.3 (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal, group-best
Received Path ID 0, Local Path ID 0, version 0ベストはPath #1(AS 65002経由)で、Path #2にはNot advertised to any peerと出ています。
RP/0/RP0/CPU0:R4#show bgp 192.168.100.0/24
Fri Sep 11 22:33:42.460 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 3 3
Last Modified: Sep 11 22:24:55.023 for 00:08:47
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.0.0.2 (metric 3) from 10.0.0.1 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 3
Originator: 10.0.0.2, Cluster list: 10.0.0.1R4は外部セッションを持たないので、この1本はR1が反射したものです。 転送テーブルも当然1本です。
RP/0/RP0/CPU0:R4#show route 192.168.100.0/24
Fri Sep 11 22:33:41.009 UTC
Routing entry for 192.168.100.0/24
Known via "bgp 65001", distance 200, metric 0
Tag 65002, type internal
Installed Sep 11 22:24:55.502 for 00:08:45
Routing Descriptor Blocks
10.0.0.2, from 10.0.0.1
Route metric is 0, Wt is 1
No advertising protos. maximum-paths ibgp 2が入っていてもRouting Descriptor Blocksは1つです。入れる経路が1本しかないためです。
STEP 1:既定ではCapability 69を広告しない
ADD-PATHは、設定して初めてOPENに現れます。
R1 - R4のセッションを張り直し、R1が送ったOPENを取り出しました。
Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 75
Type: OPEN Message (1)
Version: 4
My AS: 65001
Hold Time: 180
BGP Identifier: 10.0.0.1
Optional Parameters Length: 46
Optional Parameters
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Multiprotocol extensions capability
Type: Multiprotocol extensions capability (1)
Length: 4
AFI: IPv4 (1)
Reserved: 00
SAFI: Unicast (1)
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 2
Capability: Route Refresh Capability (Cisco)
Type: Route Refresh Capability (Cisco) (128)
Length: 0
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 2
Capability: Route refresh capability
Type: Route refresh capability (2)
Length: 0
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for 4-octet AS number capability
Type: Support for 4-octet AS number capability (65)
Length: 4
AS Number: 65001
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 20
Capability: Extended Next Hop Encoding
Type: Extended Next Hop Encoding (5)
Length: 18
AFI: IPv4 (1)
SAFI: Unicast (1)
Next hop AFI: IPv6 (2)
AFI: IPv4 (1)
SAFI: Multicast (2)
Next hop AFI: IPv6 (2)
AFI: IPv4 (1)
SAFI: Labeled VPN Unicast (128)
Next hop AFI: IPv6 (2)Capabilityは5つ。Multiprotocol(1)、Route Refresh(128と2)、4-octet AS(65)、 Extended Next Hop Encoding(5)で、69はありません。
STEP 2:受信側だけでは経路は増えない
両側がReceive (1)では、送信側の条件を満たすルータがいません。
R1・R2・R3・R4のaddress-family ipv4 unicastにadditional-paths receiveだけを入れます。
router bgp 65001
bgp router-id 10.0.0.4
bgp bestpath as-path multipath-relax
address-family ipv4 unicast
additional-paths receive
maximum-paths ibgp 2
!張り直すと、両側がCapability 69を広告するようになります。
Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 83
Type: OPEN Message (1)
<snip>
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for Additional Paths
Type: Support for Additional Paths (69)
Length: 4
AFI: IPv4 (1)
SAFI: Unicast (1)
Send/Receive: Receive (1)Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 83
Type: OPEN Message (1)
<snip>
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for Additional Paths
Type: Support for Additional Paths (69)
Length: 4
AFI: IPv4 (1)
SAFI: Unicast (1)
Send/Receive: Receive (1)どちらもReceive (1)です。R4のshow bgp neighborsもAdditional-paths operation: Noneのままです。
RP/0/RP0/CPU0:R4#show bgp neighbors
Fri Sep 11 22:47:57.014 UTC
<snip>
BGP neighbor is 10.0.0.1
Remote AS 65001, local AS 65001, internal link
<snip>
AF-dependent capabilities:
Additional-paths Receive: advertised and received
Extended Nexthop Encoding: advertised and received
Route refresh request: received 0, sent 0
Policy for incoming advertisements is FROM-R1
Policy for outgoing advertisements is TO-R1
1 accepted prefixes, 1 are bestpaths
Exact no. of prefixes denied: 0
Cumulative no. of prefixes denied: 0
Number of routes received before ingress policy run: 1
Accepted prefixes unmodified: 1
Accepted prefixes (modified and unmodified): 1
Accepted prefixes (modified and unmodified) high water mark: 1 (Sep 11 22:24:55.501)
Accepted prefixes modified: 0
Accepted prefixes modified high water mark: 0 (not set)
Denied prefixes: 0
Denied prefixes high water mark: 0 (not set)
Prefix advertised 0, suppressed 0, withdrawn 0
AIGP is enabled
An EoR was received during read-only mode
Last ack version 8, Last synced ack version 0
Outstanding version objects: current 0, max 0, refresh 0
Additional-paths operation: None経路の本数もSTEP 0と変わりません。
RP/0/RP0/CPU0:R4#show bgp 192.168.100.0/24
Fri Sep 11 22:47:56.730 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 8 8
Last Modified: Sep 11 22:44:13.023 for 00:03:43
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.0.0.2 (metric 3) from 10.0.0.1 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 8
Originator: 10.0.0.2, Cluster list: 10.0.0.1STEP 3:neighbor配下に書いてもSendは広告されない
設定は受け付けられ、専用の行まで出ます。それでもCapabilityは変わりません。
R1のneighbor 10.0.0.4配下にadditional-paths sendを、address-family直下に選択ポリシーを入れます。
neighbor 10.0.0.4
remote-as 65001
description iBGP to R4
update-source Loopback0
address-family ipv4 unicast
route-policy FROM-R4 in
route-reflector-client
route-policy TO-R4 out
soft-reconfiguration inbound always
additional-paths send
!
!route-policy ADD-PATH-ALL
set path-selection all advertise
end-policy
!
router bgp 65001
bgp router-id 10.0.0.1
address-family ipv4 unicast
additional-paths receive
additional-paths selection route-policy ADD-PATH-ALL
!セッションを張り直しても、R1のOPENはReceive (1)のままです。
Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 83
Type: OPEN Message (1)
<snip>
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for Additional Paths
Type: Support for Additional Paths (69)
Length: 4
AFI: IPv4 (1)
SAFI: Unicast (1)
Send/Receive: Receive (1)R1のshow bgp neighborsにはAddpath send capability enabled by configurationが出ます。
設定は認識されています。 しかしAF-dependent capabilitiesにAdditional-paths Sendの行は無く、
Additional-paths operationもNoneのままです。
RP/0/RP0/CPU0:R1#show bgp neighbors
Fri Sep 11 23:15:48.553 UTC
<snip>
BGP neighbor is 10.0.0.4
Remote AS 65001, local AS 65001, internal link
<snip>
AF-dependent capabilities:
Additional-paths Receive: advertised and received
Extended Nexthop Encoding: advertised and received
Route refresh request: received 0, sent 0
Policy for incoming advertisements is FROM-R4
Policy for outgoing advertisements is TO-R4
0 accepted prefixes, 0 are bestpaths
Exact no. of prefixes denied: 0
Cumulative no. of prefixes denied: 0
Number of routes received before ingress policy run: 0
Accepted prefixes unmodified: 0
Accepted prefixes (modified and unmodified): 0
Accepted prefixes (modified and unmodified) high water mark: 0 (not set)
Accepted prefixes modified: 0
Accepted prefixes modified high water mark: 0 (not set)
Denied prefixes: 0
Denied prefixes high water mark: 0 (not set)
Prefix advertised 2, suppressed 0, withdrawn 0
Addpath send capability enabled by configuration
AIGP is enabled
An EoR was not received during read-only mode
Last ack version 32, Last synced ack version 0
Outstanding version objects: current 1, max 3, refresh 0
Additional-paths operation: NoneR4に届く経路も1本のままです。
RP/0/RP0/CPU0:R4#show bgp 192.168.100.0/24
Fri Sep 11 23:18:47.389 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 31 31
Last Modified: Sep 11 23:14:52.023 for 00:03:55
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.0.0.2 (metric 3) from 10.0.0.1 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 31
Originator: 10.0.0.2, Cluster list: 10.0.0.1STEP 4:address-family直下に書くと2本届く
差分はこの1行だけです。
router bgp 65001
bgp router-id 10.0.0.1
address-family ipv4 unicast
additional-paths receive
additional-paths send
additional-paths selection route-policy ADD-PATH-ALL
!R1のOPENがBoth (3)に変わります。
Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 83
Type: OPEN Message (1)
<snip>
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for Additional Paths
Type: Support for Additional Paths (69)
Length: 4
AFI: IPv4 (1)
SAFI: Unicast (1)
Send/Receive: Both (3)R4はreceiveしか設定していないのでReceive (1)のままです。
Border Gateway Protocol - OPEN Message
Marker: ffffffffffffffffffffffffffffffff
Length: 83
Type: OPEN Message (1)
<snip>
Optional Parameter: Capability
Parameter Type: Capability (2)
Parameter Length: 6
Capability: Support for Additional Paths
Type: Support for Additional Paths (69)
Length: 4
AFI: IPv4 (1)
SAFI: Unicast (1)
Send/Receive: Receive (1)3と1でRFC 7911の条件が揃い、Additional-paths Send: advertisedと
Additional-paths operation: Sendが現れます。
RP/0/RP0/CPU0:R1#show bgp neighbors
Fri Sep 11 23:33:11.361 UTC
<snip>
BGP neighbor is 10.0.0.4
Remote AS 65001, local AS 65001, internal link
<snip>
AF-dependent capabilities:
Additional-paths Send: advertised
Additional-paths Receive: advertised and received
Extended Nexthop Encoding: advertised and received
Route refresh request: received 0, sent 0
Policy for incoming advertisements is FROM-R4
Policy for outgoing advertisements is TO-R4
0 accepted prefixes, 0 are bestpaths
Exact no. of prefixes denied: 0
Cumulative no. of prefixes denied: 0
Number of routes received before ingress policy run: 0
Accepted prefixes unmodified: 0
Accepted prefixes (modified and unmodified): 0
Accepted prefixes (modified and unmodified) high water mark: 0 (not set)
Accepted prefixes modified: 0
Accepted prefixes modified high water mark: 0 (not set)
Denied prefixes: 0
Denied prefixes high water mark: 0 (not set)
Prefix advertised 2, suppressed 0, withdrawn 0
Addpath send capability enabled by configuration
AIGP is enabled
An EoR was not received during read-only mode
Last ack version 48, Last synced ack version 0
Outstanding version objects: current 1, max 3, refresh 0
Additional-paths operation: SendAddpath send capability enabled by configurationはSTEP 3にも出ていました。
この行はneighbor配下に設定があることを示すだけで、Capabilityを広告しているかどうかは
Additional-paths Sendの行で判断します。R4側はReceiveです。
RP/0/RP0/CPU0:R4#show bgp neighbors
Fri Sep 11 23:36:10.883 UTC
<snip>
BGP neighbor is 10.0.0.1
Remote AS 65001, local AS 65001, internal link
<snip>
AF-dependent capabilities:
Additional-paths Send: received
Additional-paths Receive: advertised and received
Extended Nexthop Encoding: advertised and received
Route refresh request: received 0, sent 0
Policy for incoming advertisements is FROM-R1
Policy for outgoing advertisements is TO-R1
2 accepted prefixes, 1 are bestpaths
Exact no. of prefixes denied: 0
Cumulative no. of prefixes denied: 0
Number of routes received before ingress policy run: 2
Accepted prefixes unmodified: 2
Accepted prefixes (modified and unmodified): 2
Accepted prefixes (modified and unmodified) high water mark: 2 (Sep 11 22:54:01.864)
Accepted prefixes modified: 0
Accepted prefixes modified high water mark: 0 (not set)
Denied prefixes: 0
Denied prefixes high water mark: 0 (not set)
Prefix advertised 0, suppressed 0, withdrawn 0
AIGP is enabled
An EoR was received during read-only mode
Last ack version 47, Last synced ack version 0
Outstanding version objects: current 0, max 0, refresh 0
Additional-paths operation: ReceiveR1の経路表では、Path #2にadd-pathが付きました。広告先に注目してください。
RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Fri Sep 11 23:33:11.099 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 49 49
Last Modified: Sep 11 23:32:46.023 for 00:00:25
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.4 10.0.0.3
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.4 10.0.0.3
65002, (Received from a RR-client), (received & used)
10.0.0.2 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 48
Path #2: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.2 10.0.0.4
65003, (Received from a RR-client), (received & used)
10.0.0.3 (metric 2) from 10.0.0.3 (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal, group-best, add-path
Received Path ID 0, Local Path ID 3, version 49Path #1(R2から学んだ経路)はR3とR4へ、Path #2(R3から学んだ経路)はR2とR4へ広告されています。 学んだ相手には送り返していません。RFC 7911の「unless it is a path received from that neighbor」がそのまま現れています。
R4には2本届きます。
RP/0/RP0/CPU0:R4#show bgp 192.168.100.0/24
Fri Sep 11 23:36:10.609 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 47 47
Last Modified: Sep 11 23:32:46.023 for 00:03:24
Paths: (2 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.0.0.2 (metric 3) from 10.0.0.1 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best, multipath
Received Path ID 1, Local Path ID 1, version 47
Originator: 10.0.0.2, Cluster list: 10.0.0.1
Path #2: Received by speaker 0
Not advertised to any peer
65003, (received & used)
10.0.0.3 (metric 3) from 10.0.0.1 (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal, multipath
Received Path ID 3, Local Path ID 0, version 0
Originator: 10.0.0.3, Cluster list: 10.0.0.12本はReceived Path ID 1とReceived Path ID 3で区別されています。
STEP 0ではReceived Path ID 0でした。値はR1が決めたもので、意味はありません。
パケットの中身でも確認できます。同じプレフィックスが、別々のPath Identifierを付けた2つのUPDATEで運ばれています。
frame.number bgp.nlri_path_id bgp.mp_reach_nlri_ipv4_prefix bgp.update.path_attribute.as_path_segment.as4
28 1 192.168.100.0 65002
31 3 192.168.100.0 65003NLRIの中身はこうなっています。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 85
Type: UPDATE Message (2)
<snip>
Path Attribute - MP_REACH_NLRI
Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
Type Code: MP_REACH_NLRI (14)
Length: 17
Address family identifier (AFI): IPv4 (1)
Subsequent address family identifier (SAFI): Unicast (1)
Next hop: 10.0.0.3
IPv4 Address: 10.0.0.3
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
192.168.100.0/24 PathId 3
NLRI path id: 3
Prefix Length: 24
MP Reach NLRI IPv4 prefix: 192.168.100.0ADD-PATHが無ければ、後から届いたほうが前を上書きしていました。
そして、R4の転送テーブルが2本になります。
RP/0/RP0/CPU0:R4#show route 192.168.100.0/24
Fri Sep 11 23:36:09.023 UTC
Routing entry for 192.168.100.0/24
Known via "bgp 65001", distance 200, metric 0
Tag 65002, type internal
Installed Sep 11 23:32:45.670 for 00:03:23
Routing Descriptor Blocks
10.0.0.2, from 10.0.0.1, BGP multi path
Route metric is 0
10.0.0.3, from 10.0.0.1, BGP multi path
Route metric is 0
No advertising protos. R4の設定はSTEP 0から一文字も変えていません。 maximum-paths ibgp 2は最初から入っていて、
STEP 0では1本しか入りませんでした。増えたのは、ADD-PATHで経路が2本届くようになったからです。
STEP 5:広告する経路の選び方はポリシーで決まる
backup 1 advertiseにすると、Path #2の印がbackup, add-pathに変わります。
route-policy ADD-PATH-ALL
set path-selection backup 1 advertise
end-policy
!RP/0/RP0/CPU0:R1#show bgp 192.168.100.0/24
Fri Sep 11 23:41:12.090 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 50 50
Last Modified: Sep 11 23:39:11.023 for 00:02:01
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.4 10.0.0.3
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.4 10.0.0.3
65002, (Received from a RR-client), (received & used)
10.0.0.2 (metric 2) from 10.0.0.2 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 48
Path #2: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.0.0.2 10.0.0.4
65003, (Received from a RR-client), (received & used)
10.0.0.3 (metric 2) from 10.0.0.3 (10.0.0.3)
Origin IGP, metric 0, localpref 100, valid, internal, group-best, backup, add-path
Received Path ID 0, Local Path ID 3, version 50この構成ではベスト以外が1本しか無いため、選ばれる経路はallのときと同じです。
本数が変わらなくても、どの資格で広告対象になったかが印に出ます。
set path-selectionに指定できるのは次の5つです。
RP/0/RP0/CPU0:R2(config-rpl)# set path-selection ?
all BGP all paths
backup BGP backup path
best-path BGP best path
group-best BGP group best path
multipath BGP multipath
RP/0/RP0/CPU0:R2(config-rpl)# set path-selection STEP 6:設定を外すと1本に戻る
Capability 69の合意が外れ、NLRIにPath Identifierが付かなくなります。
router bgp 65001
bgp router-id 10.0.0.1
address-family ipv4 unicast
!RP/0/RP0/CPU0:R4#show bgp 192.168.100.0/24
Fri Sep 11 23:51:10.102 UTC
BGP routing table entry for 192.168.100.0/24
Versions:
Process bRIB/RIB SendTblVer
Speaker 51 51
Last Modified: Sep 11 23:47:26.023 for 00:03:44
Paths: (1 available, best #1)
Not advertised to any peer
Path #1: Received by speaker 0
Not advertised to any peer
65002, (received & used)
10.0.0.2 (metric 3) from 10.0.0.1 (10.0.0.2)
Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
Received Path ID 0, Local Path ID 1, version 51
Originator: 10.0.0.2, Cluster list: 10.0.0.1Received Path IDも0に戻っています。転送テーブルも1本に戻ります。
RP/0/RP0/CPU0:R4#show route 192.168.100.0/24
Fri Sep 11 23:51:08.843 UTC
Routing entry for 192.168.100.0/24
Known via "bgp 65001", distance 200, metric 0
Tag 65002, type internal
Installed Sep 11 23:47:25.979 for 00:03:42
Routing Descriptor Blocks
10.0.0.2, from 10.0.0.1
Route metric is 0, Wt is 1
No advertising protos. R4のmaximum-paths ibgp 2は入ったままです。 それでも1本に戻るのは、届く経路が1本になったからです。
検証Configおよびshow結果
各STEPで6台すべてから、次の3種類をルータごとに分けて取得しています。検証Configはこの..._run.txtです(最終状態は最後のSTEPのもの)。
| ファイル | 内容 |
|---|---|
..._show.txt | show version / show interface description / show route / show route 192.168.100.0/24 / show ospf neighbor / show bgp 一式 / show bgp neighbors / show rpl route-policy |
..._log.txt | そのSTEPの範囲だけに絞ったshow logging。各STEPの開始時にlogmsgでマーカーを入れ、その時刻をshow logging startに指定して取得したもの |
..._run.txt | そのSTEP時点のshow running-config(=そのSTEPの検証Config) |
STEP 6の..._run.txtは6台ともSTEP 0と一致します(ADD-PATHの設定もルートポリシーの定義も残していません)。
STEP 0:初期状態(ADD-PATHの設定なし)
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 1:R1 - R4のセッションをリセット
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 2:R1〜R4にadditional-paths receive
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 3:R1のneighbor配下にadditional-paths sendと選択ポリシー
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 4:R1のaddress-family直下にadditional-paths send
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 5:選択ポリシーをbackup 1 advertiseに変更
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
STEP 6:ADD-PATHの設定をすべて外す(最終状態)
| ルータ | show出力 | syslog | running-config |
|---|---|---|---|
| R1 | show | log | run |
| R2 | show | log | run |
| R3 | show | log | run |
| R4 | show | log | run |
| R5 | show | log | run |
| R6 | show | log | run |
R1 - R4間のパケットキャプチャーは次の4つです。
STEP 1(ADD-PATHなし)のキャプチャー
STEP 2(receive のみ)のキャプチャー
STEP 3(neighbor 配下の send)のキャプチャー
STEP 4(address-family 直下の send)のキャプチャー
参考
| 資料 | タイトル | 概要 |
|---|---|---|
| RFC 7911 | Advertisement of Multiple Paths in BGP | ADD-PATH。Capability 69、Path Identifier(4オクテット)、Send/Receive の 1/2/3 |
| RFC 4271 | A Border Gateway Protocol 4 (BGP-4) | NLRIがプレフィックスだけで構成されるという元の仕様 |
| RFC 4456 | BGP Route Reflection | ルートリフレクタ。ベストパスしか反射しないという前提 |
関連記事
- BGP(Border Gateway Protocol)
- BGPメッセージ
- BGPネイバーの状態遷移
- iBGPとeBGPの違い
- BGP next-hop-self
- BGPルートリフレクタ
- BGPパス属性とベストパス選択
- BGP ORIGIN属性
- BGP AS_PATH属性
- BGP NEXT_HOP属性
- BGP LOCAL_PREF属性
- BGP MED属性
- BGP WEIGHT属性
- BGP COMMUNITY属性
- BGP経路集約(aggregate-address)
- MP-BGP(マルチプロトコル拡張)
- BGP Extended Community(拡張コミュニティ)
- BGPマルチパス(maximum-paths)
- BGPの4バイトAS番号(RFC 6793)
- BGPのプライベートAS番号の除去(remove-private-AS)
- BGPのADD-PATH(RFC 7911)