メインコンテンツへスキップ
  1. ネットワーク 記事一覧/
  2. BGP記事一覧/

BGPのADD-PATH(RFC 7911)

目次

ADD-PATHとは

BGPは同じプレフィックスについて、ピアごとに1本しか広告できません。 UPDATEのNLRIが「プレフィックス長+プレフィックス」だけでできているため、 同じプレフィックスを2回送ると、後から送ったほうが前のものを置き換えてしまうからです。

RFC 7911(Proposed Standard)は、 NLRIの前にPath Identifierを足して経路を区別できるようにし、この制限を外します。

ADD-PATH での NLRI の符号化
+--------------------------------+
| Path Identifier (4 octets)     |
+--------------------------------+
| Length (1 octet)               |
+--------------------------------+
| Prefix (variable)              |
+--------------------------------+

Capabilityで合意する

使うかどうかはOPENメッセージのCapabilityで決めます。

項目
Capability Code69
<AFI, SAFI, Send/Receive>の並び
Send/Receive1=受信できる/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には、advertiseinstall という別々のキーワード があり、 この違いがそのままコマンドに現れています。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 receiveCapability 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 sendaddress-familyの直下に置く

additional-paths sendneighbor配下のaddress-familyにも同じ名前で存在し、 どちらのヘルプにも出てきます

address-family 直下のヘルプ(XRd 26.1.1)
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 configurationneighbor配下additional-paths sendが書いてある
Additional-paths Send: advertisedaddress-family直下の設定により、Capabilityを実際に広告している

前者だけが出ていて後者が出ていない状態が存在します。設定した覚えがあるのに経路が増えないときは、 前者ではなく後者を見てください

実機での検証

XRd 26.1.1のルータ6台で確認します。ルートリフレクタ構成にしているのは、ADD-PATHが実際に必要になるのがこの形だからです。

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本
1R1 - R4のセッションをリセット既定のOPENにCapability 69が無い
2R1〜R4にadditional-paths receive両側ともReceive (1)。それだけでは増えない
3R1のneighbor配下にadditional-paths sendと選択ポリシーそれでもSendは広告されない
4R1のaddress-family直下にadditional-paths sendここでBoth (3)。R4に2本届き、転送も2本になる
5選択ポリシーをbackup 1 advertiseに変更広告する経路の選び方はポリシーで決まる
6ADD-PATHの設定をすべて外す1本に戻る

STEP 3とSTEP 4の違いは、additional-paths sendをどこに書いたかだけです

R4には最初からmaximum-paths ibgp 2bgp bestpath as-path multipath-relaxを入れてあり、 全STEPを通して一度も変更していません。R4の転送エントリが増減する理由をADD-PATHだけに限定するためです。

R4 の running-config(STEP 0 時点。最後まで変更しない)
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本だけです

STEP 0:R1 の show bgp 192.168.100.0/24
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と出ています。

STEP 0:R4 の show bgp 192.168.100.0/24
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.1

R4は外部セッションを持たないので、この1本はR1が反射したものです。 転送テーブルも当然1本です。

STEP 0:R4 の show route 192.168.100.0/24
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を取り出しました。

STEP 1:No.16 OPEN(R1 → R4)tshark -V
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)
上のtshark出力のパケット(No.16 OPEN)のpcapをダウンロード

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 unicastadditional-paths receiveだけを入れます。

STEP 2:R4 の running-config(抜粋)
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を広告するようになります。

STEP 2:No.16 OPEN(R1 → R4)の 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)
上のtshark出力のパケット(No.16 OPEN)のpcapをダウンロード
STEP 2:No.19 OPEN(R4 → R1)の 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)
上のtshark出力のパケット(No.19 OPEN)のpcapをダウンロード

どちらもReceive (1)です。R4のshow bgp neighborsAdditional-paths operation: Noneのままです。

STEP 2:R4 の show bgp neighbors(10.0.0.1 の部分)
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と変わりません。

STEP 2:R4 の show bgp 192.168.100.0/24
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.1

STEP 3:neighbor配下に書いてもSendは広告されない

設定は受け付けられ、専用の行まで出ます。それでもCapabilityは変わりません

R1のneighbor 10.0.0.4配下にadditional-paths sendを、address-family直下に選択ポリシーを入れます。

STEP 3:R1 の neighbor 10.0.0.4(抜粋)
 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
  !
 !
STEP 3:R1 の route-policy と address-family(抜粋)
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)のままです。

STEP 3:No.19 OPEN(R1 → R4)の 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)
上のtshark出力のパケット(No.19 OPEN)のpcapをダウンロード

R1のshow bgp neighborsにはAddpath send capability enabled by configurationが出ます。 設定は認識されています。 しかしAF-dependent capabilitiesAdditional-paths Sendの行は無く、 Additional-paths operationNoneのままです。

STEP 3:R1 の show bgp neighbors(10.0.0.4 の部分)
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: None

R4に届く経路も1本のままです。

STEP 3:R4 の show bgp 192.168.100.0/24
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.1

STEP 4:address-family直下に書くと2本届く

差分はこの1行だけです

STEP 4:R1 の address-family(抜粋)
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)に変わります。

STEP 4:No.23 OPEN(R1 → R4)の 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: Both (3)
上のtshark出力のパケット(No.23 OPEN)のpcapをダウンロード

R4はreceiveしか設定していないのでReceive (1)のままです。

STEP 4:No.20 OPEN(R4 → R1)の 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)
上のtshark出力のパケット(No.20 OPEN)のpcapをダウンロード

3と1でRFC 7911の条件が揃い、Additional-paths Send: advertisedAdditional-paths operation: Sendが現れます。

STEP 4:R1 の show bgp neighbors(10.0.0.4 の部分)
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: Send

Addpath send capability enabled by configurationはSTEP 3にも出ていました。 この行はneighbor配下に設定があることを示すだけで、Capabilityを広告しているかどうかは Additional-paths Sendの行で判断します。R4側はReceiveです。

STEP 4:R4 の show bgp neighbors(10.0.0.1 の部分)
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: Receive

R1の経路表では、Path #2にadd-pathが付きました。広告先に注目してください。

STEP 4:R1 の show bgp 192.168.100.0/24
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 49

Path #1(R2から学んだ経路)はR3とR4へ、Path #2(R3から学んだ経路)はR2とR4へ広告されています。 学んだ相手には送り返していません。RFC 7911の「unless it is a path received from that neighbor」がそのまま現れています。

R4には2本届きます。

STEP 4:R4 の show bgp 192.168.100.0/24
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.1

2本はReceived Path ID 1Received Path ID 3で区別されています。 STEP 0ではReceived Path ID 0でした。値はR1が決めたもので、意味はありません

パケットの中身でも確認できます。同じプレフィックスが、別々のPath Identifierを付けた2つのUPDATEで運ばれています。

tshark -r bgp-add-path-step4-r1r4.pcap -Y bgp.nlri_path_id -T fields -E header=y -e frame.number -e bgp.nlri_path_id -e bgp.mp_reach_nlri_ipv4_prefix -e bgp.update.path_attribute.as_path_segment.as4
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	65003

NLRIの中身はこうなっています。

STEP 4:No.31 の UPDATE(R1 → R4)tshark -V
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.0
上のtshark出力のパケット(No.31 UPDATE)のpcapをダウンロード

ADD-PATHが無ければ、後から届いたほうが前を上書きしていました。

そして、R4の転送テーブルが2本になります。

STEP 4:R4 の show route 192.168.100.0/24
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に変わります

STEP 5:R1 の route-policy
route-policy ADD-PATH-ALL
  set path-selection backup 1 advertise
end-policy
!
STEP 5:R1 の show bgp 192.168.100.0/24
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つです。

set path-selection のヘルプ(XRd 26.1.1)
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が付かなくなります

STEP 6:R1 の running-config(抜粋)
router bgp 65001
 bgp router-id 10.0.0.1
 address-family ipv4 unicast
 !
STEP 6:R4 の show bgp 192.168.100.0/24
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.1

Received Path IDも0に戻っています。転送テーブルも1本に戻ります。

STEP 6:R4 の show route 192.168.100.0/24
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.txtshow 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出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 1:R1 - R4のセッションをリセット

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 2:R1〜R4にadditional-paths receive

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 3:R1のneighbor配下にadditional-paths sendと選択ポリシー

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 4:R1のaddress-family直下にadditional-paths send

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 5:選択ポリシーをbackup 1 advertiseに変更

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

STEP 6:ADD-PATHの設定をすべて外す(最終状態)

ルータshow出力syslogrunning-config
R1showlogrun
R2showlogrun
R3showlogrun
R4showlogrun
R5showlogrun
R6showlogrun

R1 - R4間のパケットキャプチャーは次の4つです。

STEP 1(ADD-PATHなし)のキャプチャー

STEP 2(receive のみ)のキャプチャー

STEP 3(neighbor 配下の send)のキャプチャー

STEP 4(address-family 直下の send)のキャプチャー

参考

資料タイトル概要
RFC 7911Advertisement of Multiple Paths in BGPADD-PATH。Capability 69、Path Identifier(4オクテット)、Send/Receive の 1/2/3
RFC 4271A Border Gateway Protocol 4 (BGP-4)NLRIがプレフィックスだけで構成されるという元の仕様
RFC 4456BGP Route Reflectionルートリフレクタ。ベストパスしか反射しないという前提

関連記事