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

BGP COMMUNITY属性

目次

COMMUNITYとは

COMMUNITYは、経路に「印」を付けて運ぶパス属性です(BGPパス属性とベストパス選択)。それ自体はベストパス選択に影響せず、印を見たルータが自分のポリシーで何をするかを決めて意味を持ちます。

項目内容
Type code8
属性の分類Optional Transitive(省略可能・推移的)
値32ビット(4オクテット)を1個とし、複数個を並べられる
表記AS番号:値(上位16ビット:下位16ビット)
予約範囲0x00000000〜0x0000FFFFと0xFFFF0000〜0xFFFFFFFF
ベストパス選択影響しない。印を付けるだけ
定義RFC 1997 BGP Communities Attribute(Standards Track)

Optional Transitiveなので、知らないルータも捨てずに次へ渡します。AS 65004が付けた印がAS 65001を通り抜けてAS 65002まで届きます。

表記はAS番号:値

32ビットを上位16ビットと下位16ビットに分けて65004:1000のように書きます。RFC 1997は予約範囲以外の値について上位16ビットにAS番号を入れて符号化し、下位16ビットの意味はそのASが決めると定めています。AS番号を名前空間にすることで他社の印と衝突しません。 上位が16ビットしかないため、4バイトAS番号は上位に入りません。これを解決するのが後述のラージコミュニティです。

「印を付ける側」と「印を見る側」は別のAS

使うときは必ず2つの役割がペアになります。

役割やること典型的な立場
付ける側経路にset communityで印を付けて広告する顧客・下位AS
見る側受信時にcommunity matches-anyで印を判定し、LOCAL_PREFを変えたり広告先を絞ったりする上位ISP

見る側が何もしなければ、印は運ばれるだけです。 上位ISPが「このコミュニティを付ければこう扱う」と公開することで、顧客が自分で経路制御できます。 ユーザー定義のコミュニティに強制力はありません。 意味を決めるのは受け取る側のASなので、そのASのすべての境界ルータに同じ判定を入れて初めて期待どおりに動きます。

実例:NTT(AS2914)が公開しているコミュニティ

NTTのGlobal IP Network(AS2914)がRouting Policiesで公開しているコミュニティの抜粋です。

コミュニティ意味
2914:429do not advertise to any peers(どのピアにも広告しない)
2914:421〜2914:423全ピア向けにAS_PATHを1〜3回prependする
2914:490customer default(LOCAL_PREF 120)
2914:450peer fallback(LOCAL_PREF 96)
65500:nnn指定したピアAS nnnにだけ広告しない
2914:666blackhole(該当プレフィックス宛のトラフィックを破棄)

顧客はこれを付けて広告するだけで、AS2914内のLOCAL_PREFや広告先を制御できます。STEP 8で2914:429にならった65001:429を再現します。

既知のコミュニティ(Well-known Communities)

RFC 1997はどのASでも同じ意味を持つ値を3つ定義しています(予約範囲の0xFFFFから始まる値)。

名前16進値RFC 1997の規定
NO_EXPORT0xFFFFFF01BGPコンフェデレーション境界の外へ広告してはならない
NO_ADVERTISE0xFFFFFF02他のBGPピアへ一切広告してはならない
NO_EXPORT_SUBCONFED0xFFFFFF03外部BGPピアへ広告してはならない(コンフェデレーション内の他メンバASを含む)

コンフェデレーションを使わない構成では、NO_EXPORTは「eBGPピアへ出さない。iBGPでは配る」、NO_ADVERTISEは「iBGPを含めてどこへも出さない」です(STEP 6・7)。後から追加された既知のコミュニティもあります。

名前16進値AS:値表記定義
GRACEFUL_SHUTDOWN0xFFFF000065535:0RFC 8326 Graceful BGP Session Shutdown(Standards Track)。計画メンテナンス時のパケットロスを減らす
BLACKHOLE0xFFFF029A65535:666RFC 7999 BLACKHOLE Community(Informational)。隣接ASに該当宛先のトラフィック破棄を要求する

拡張コミュニティ・ラージコミュニティ

派生が2つあります(この記事では扱いません)。

属性Type code1個あたりの長さ構造定義
COMMUNITY84オクテット16ビット+16ビットRFC 1997
Extended Community168オクテットType/Sub-Type+値。MPLS-VPNのRoute Targetなどに使うRFC 4360
Large Community3212オクテット32ビット×3(Global Administrator+Local Data Part 1・2)RFC 8092

ラージコミュニティは4バイトAS番号をそのまま名前空間に使え、64500:1:2のように2つの値を運べます。

IOS XRでの設定方法

RPL(Routing Policy Language)で扱います。

付ける

route-policy TO-UPSTREAM
  if destination in (192.168.6.0/24) then
    set community (65004:1000)
  endif
  pass
end-policy

set communityは既にある値を置き換えます。残して追加するにはadditiveを付けます(STEP 3・4)。

  set community (65001:100) additive

見る

community-setで値の集合を定義し、community matches-any(どれか1つ)またはmatches-every(すべて)で照合します。

community-set CS-FROM-CUSTOMER
  65004:1000
end-set
!
route-policy FROM-CUSTOMER
  if community matches-any CS-FROM-CUSTOMER then
    set local-preference 200
  endif
  pass
end-policy

判定はポリシーに入ってきた時点の値に対して行われます。 同じポリシー内のset communityはif community matches-anyの結果を変えません。

消す

  delete community all                  ! すべて削除
  delete community in CS-FROM-CUSTOMER  ! community-setに載っているものだけ削除

eBGPへ送るにはsend-community-ebgpが要る

IOS XRはiBGPピアへは既定で送りますが、eBGPピアへは送りません。eBGPで運ぶにはsend-community-ebgpが要ります。

router bgp 65004
 neighbor 10.1.6.1
  address-family ipv4 unicast
   send-community-ebgp
   route-policy TO-UPSTREAM out

show bgp neighborのCommunity attribute sent to this neighborで確認できます。

実機での検証

XRd 26.1.1を6台使い、9つのSTEPで確認します。

COMMUNITY検証ラボのトポロジ。AS 65001のR1・R2がAS 65002のR4とeBGPで接続し、R4はAS 65003のR5とも接続する。R5はAS 65004のR6と、R6はR1とも接続する。R6が192.168.6.0/24にコミュニティを付けてR1へ広告する
ASルータ役割
65001R1・R2AS境界。R3とiBGPフルメッシュ(Loopback0、next-hop-self)+OSPF area 0
65001R3AS内部。eBGPピアを持たない
65002R4R1・R2・R5とeBGP
65003R5R4・R6とeBGP。192.168.5.0/24を広告
65004R6R5・R1とeBGP。192.168.6.0/24を広告

観測対象はR6が広告する 192.168.6.0/24 で、R6 →(eBGP)→ R1 →(iBGP)→ R2・R3、R1 →(eBGP)→ R4 と流れます。eBGPとiBGPの両方を通るので、1本でどこまで運ばれるかを追えます。

STEP操作見たいこと
0ポリシーなしコミュニティが付いていない状態
1R6がset community (65004:1000)eBGPで値が届き、iBGPを越えてR2・R3・R4まで伝わる
2R1がmatches-anyでLOCAL_PREF 200印を見て動く側の実装
3R1がset community (65001:100)(additiveなし)元の65004:1000が消える
4additiveを付ける2つ並ぶ
5R1の入方向をPASS-ALLに戻す元の値だけに戻る
6R6がNO_EXPORTを付けるR1・R2がeBGPへ出さなくなる。iBGPでは配られる
7R6がNO_ADVERTISEを付けるR1がiBGPにも出さず、R2・R3へWITHDRAWを送る
8R6が65001:429、R1がTO-R4でdropユーザー定義コミュニティによる広告先制御

全eBGPネイバーにsend-community-ebgpと、ネイバーごとに別名の出方向ポリシー(TO-R1/TO-R4など、中身はpass)を入れてあります。別名にするのはupdate-groupの構成をSTEP間で固定するためで、各STEPではポリシーの中身だけを書き換えます。

STEP 0:初期状態

R1が受け取った192.168.6.0/24です。

R1 show bgp 192.168.6.0/24(STEP 0)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 05:50:59.631 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  7            7
Last Modified: Sep  9 05:14:11.774 for 00:36:47
Paths: (1 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 7
      Origin-AS validity: (disabled)

Community:の行はありません。

STEP 1:R6が192.168.6.0/24に65004:1000を付ける

R6のTO-R1を書き換えます。

R6 show rpl route-policy TO-R1(STEP 1)
RP/0/RP0/CPU0:R6#show rpl route-policy TO-R1

Wed Sep  9 06:14:29.887 UTC
route-policy TO-R1
  if destination in (192.168.6.0/24) then
    set community (65004:1000)
  endif
  pass
end-policy
!

R1にCommunity:の行が現れます。

R1 show bgp 192.168.6.0/24(STEP 1)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:12:17.878 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  9            9
Last Modified: Sep  9 06:10:23.774 for 00:01:54
Paths: (1 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 9
      Community: 65004:1000
      Origin-AS validity: (disabled)

eBGPキャプチャーのNo.213がR6からR1へのUPDATEです。

No.213 UPDATE(R6 → R1)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 67
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 44
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.1.6.6
                IPv4 Address: 10.1.6.6
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - COMMUNITIES: 65004:1000
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: 65004:1000
                Community: 65004:1000
                    Community AS: 65004
                    Community value: 1000

Flags: 0xc0, Optional, TransitiveがOptional Transitiveの印です。

上のtshark出力のパケット(No.213 UPDATE)のpcapをダウンロード

iBGPホップを越えて伝わる

R1はこの経路をiBGPでR2・R3へ渡し、値はそのまま届きます。

R2 show bgp 192.168.6.0/24(STEP 1)
RP/0/RP0/CPU0:R2#show bgp 192.168.6.0/24

Wed Sep  9 06:12:46.531 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  9            9
Last Modified: Sep  9 06:10:23.774 for 00:02:22
Paths: (1 available, best #1)
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.2.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.2.4.4        
  65004, (received & used)
    10.0.0.1 (metric 3) from 10.0.0.1 (10.0.0.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 9
      Community: 65004:1000

iBGPキャプチャーのNo.427がそのUPDATEです。

iBGPキャプチャーのNo.427 UPDATE(R1 → R3)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 74
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 51
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.0.0.1
                IPv4 Address: 10.0.0.1
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - LOCAL_PREF: 100
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: LOCAL_PREF (5)
            Length: 4
            Local preference: 100
        Path Attribute - COMMUNITIES: 65004:1000
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: 65004:1000
                Community: 65004:1000
                    Community AS: 65004
                    Community value: 1000
上のtshark出力のパケット(No.427 UPDATE)のpcapをダウンロード

R1はR4へもeBGPで広告するので、AS 65004が付けた印がAS 65001を素通りしてAS 65002まで届きます。

R4 show bgp community 65004:1000(STEP 1)
RP/0/RP0/CPU0:R4#show bgp community 65004:1000

Wed Sep  9 06:13:36.383 UTC
BGP router identifier 10.0.0.4, local AS number 65002
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000   RD version: 11
BGP main routing table version 11
BGP NSR Initial initsync version 4 (Reached)
BGP NSR/ISSU Sync-Group versions 0/0
BGP scan interval 60 secs

Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 192.168.6.0/24     10.1.4.1                               0 65001 65004 i
*                     10.2.4.2                               0 65001 65004 i

Processed 1 prefixes, 2 paths

STEP 2:R1がコミュニティを見てLOCAL_PREFを上げる

R1側に「印を見て動く」設定を入れます。

R1 show rpl community-set CS-FROM-R6(STEP 2)
RP/0/RP0/CPU0:R1#show rpl community-set CS-FROM-R6

Wed Sep  9 06:17:48.295 UTC
community-set CS-FROM-R6
  65004:1000
end-set
!
R1 show rpl route-policy FROM-R6(STEP 2)
RP/0/RP0/CPU0:R1#show rpl route-policy FROM-R6

Wed Sep  9 06:17:48.790 UTC
route-policy FROM-R6
  if community matches-any CS-FROM-R6 then
    set local-preference 200
  endif
  pass
end-policy
!

R6向けネイバーの入方向に適用すると、localprefが200になります。

R1 show bgp 192.168.6.0/24(STEP 2)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:17:43.938 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 10           10
Last Modified: Sep  9 06:17:31.774 for 00:00:12
Paths: (2 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 200, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 10
      Community: 65004:1000
      Origin-AS validity: (disabled)
  Path #2: Received by speaker 0
  Not advertised to any peer
  65004, (received-only)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external
      Received Path ID 0, Local Path ID 0, version 0
      Community: 65004:1000
      Origin-AS validity: (disabled)

(received-only)のPath #2は入方向ポリシー適用前のコピー(localpref 100)、Path #1が適用後(localpref 200)です。

STEP 3:set communityにadditiveを付けないと元の値が消える

FROM-R6にadditiveなしのset community (65001:100)を足します。

R1 show rpl route-policy FROM-R6(STEP 3)
RP/0/RP0/CPU0:R1#show rpl route-policy FROM-R6

Wed Sep  9 06:27:05.372 UTC
route-policy FROM-R6
  if community matches-any CS-FROM-R6 then
    set local-preference 200
  endif
  set community (65001:100)
  pass
end-policy
!
R1 show bgp 192.168.6.0/24(STEP 3)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:26:59.651 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 12           12
Last Modified: Sep  9 06:26:26.774 for 00:00:32
Paths: (2 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 200, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 12
      Community: 65001:100
      Origin-AS validity: (disabled)
  Path #2: Received by speaker 0
  Not advertised to any peer
  65004, (received-only)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external
      Received Path ID 0, Local Path ID 0, version 0
      Community: 65004:1000
      Origin-AS validity: (disabled)

Path #1(適用後)が65001:100だけになり、65004:1000が消えています。localpref 200は付いたままで、判定はset communityが動く前の値に対して行われています。このset communityはifの外にあるので、R6から受け取るすべての経路(192.168.5.0/24も)に付きます。

iBGPキャプチャーのNo.559が置き換わった値をR3へ運ぶUPDATEです。

iBGPキャプチャーのNo.559 UPDATE(R1 → R3)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 74
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 51
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.0.0.1
                IPv4 Address: 10.0.0.1
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - LOCAL_PREF: 200
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: LOCAL_PREF (5)
            Length: 4
            Local preference: 200
        Path Attribute - COMMUNITIES: 65001:100
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: 65001:100
                Community: 65001:100
                    Community AS: 65001
                    Community value: 100
上のtshark出力のパケット(No.559 UPDATE)のpcapをダウンロード

STEP 4:additiveを付けると両方残る

同じ行にadditiveを足します。

R1 show rpl route-policy FROM-R6(STEP 4)
RP/0/RP0/CPU0:R1#show rpl route-policy FROM-R6

Wed Sep  9 06:32:15.350 UTC
route-policy FROM-R6
  if community matches-any CS-FROM-R6 then
    set local-preference 200
  endif
  set community (65001:100) additive
  pass
end-policy
!
R1 show bgp 192.168.6.0/24(STEP 4)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:32:09.384 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 13           13
Last Modified: Sep  9 06:31:52.774 for 00:00:16
Paths: (2 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 200, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 13
      Community: 65001:100 65004:1000
      Origin-AS validity: (disabled)
  Path #2: Received by speaker 0
  Not advertised to any peer
  65004, (received-only)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external
      Received Path ID 0, Local Path ID 0, version 0
      Community: 65004:1000
      Origin-AS validity: (disabled)

Community: 65001:100 65004:1000と2つ並びました。顧客の印を残して自分の印を足すにはadditiveが要ります。

iBGPキャプチャーのNo.605 UPDATE(R1 → R2)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 78
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 55
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.0.0.1
                IPv4 Address: 10.0.0.1
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - LOCAL_PREF: 200
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: LOCAL_PREF (5)
            Length: 4
            Local preference: 200
        Path Attribute - COMMUNITIES: 65001:100 65004:1000
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 8
            Communities: 65001:100 65004:1000
                Community: 65001:100
                    Community AS: 65001
                    Community value: 100
                Community: 65004:1000
                    Community AS: 65004
                    Community value: 1000
上のtshark出力のパケット(No.605 UPDATE)のpcapをダウンロード

Length: 8で、4オクテットが2個入っています。

STEP 5:R1の入方向ポリシーを外す

R1のR6向け入方向をPASS-ALLに戻します。

R1 show bgp 192.168.6.0/24(STEP 5)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:34:55.670 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 15           15
Last Modified: Sep  9 06:34:43.774 for 00:00:12
Paths: (1 available, best #1)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.1.4.4        
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 15
      Community: 65004:1000
      Origin-AS validity: (disabled)

localpref 100、コミュニティは65004:1000だけに戻りました。

STEP 6:NO_EXPORTは自ASの外へ出さない

R6のTO-R1をset community (no-export)に変更します。

R6 show rpl route-policy TO-R1(STEP 6)
RP/0/RP0/CPU0:R6#show rpl route-policy TO-R1

Wed Sep  9 06:37:59.186 UTC
route-policy TO-R1
  if destination in (192.168.6.0/24) then
    set community (no-export)
  endif
  pass
end-policy
!
R1 show bgp 192.168.6.0/24(STEP 6)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:38:46.975 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 16           16
Last Modified: Sep  9 06:37:22.774 for 00:01:24
Paths: (2 available, best #2, not advertised to EBGP peer)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Path #1: Received by speaker 0
  Not advertised to any peer
  65002 65003 65004, (received & used)
    10.1.4.4 from 10.1.4.4 (10.0.0.4)
      Origin IGP, localpref 100, valid, external, group-best
      Received Path ID 0, Local Path ID 0, version 0
      Origin-AS validity: (disabled)
  Path #2: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 16
      Community: no-export
      Origin-AS validity: (disabled)

R1のPaths:行に not advertised to EBGP peer が付き、R4向けの広告から192.168.6.0/24が消えています。

R1 show bgp neighbors 10.1.4.4 advertised-routes(STEP 6)
RP/0/RP0/CPU0:R1#show bgp neighbors 10.1.4.4 advertised-routes

Wed Sep  9 06:38:50.455 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.1.4.1        Local           65001i
192.168.2.0/24     10.1.4.1        10.0.0.2        65001i
192.168.3.0/24     10.1.4.1        10.0.0.3        65001i

Processed 3 prefixes, 3 paths

iBGPには配られ、受け取ったR2も同じようにeBGPへ出さなくなります。

R2 show bgp neighbors 10.2.4.4 advertised-routes(STEP 6)
RP/0/RP0/CPU0:R2#show bgp neighbors 10.2.4.4 advertised-routes

Wed Sep  9 06:39:19.485 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.2.4.2        10.0.0.1        65001i
192.168.2.0/24     10.2.4.2        Local           65001i
192.168.3.0/24     10.2.4.2        10.0.0.3        65001i

Processed 3 prefixes, 3 paths

R2には何も設定していません。 R1がiBGPでNO_EXPORTごと渡したためで、AS単位で効いています。R4は192.168.6.0/24をR5経由(65003 65004)だけで受け取ります。

R4 show bgp 192.168.6.0/24(STEP 6)
RP/0/RP0/CPU0:R4#show bgp 192.168.6.0/24

Wed Sep  9 06:39:59.467 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 16           16
Last Modified: Sep  9 06:37:22.774 for 00:02:36
Paths: (1 available, best #1)
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.2.4.2        10.1.4.1        
  Path #1: Received by speaker 0
  Advertised IPv4 Unicast paths to peers (in unique update groups):
    10.2.4.2        10.1.4.1        
  65003 65004, (received & used)
    10.4.5.5 from 10.4.5.5 (10.0.0.5)
      Origin IGP, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 16
      Origin-AS validity: (disabled)

eBGPキャプチャーのNo.321がNO_EXPORTを運んだUPDATEです。

No.321 UPDATE(R6 → R1)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 67
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 44
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.1.6.6
                IPv4 Address: 10.1.6.6
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - COMMUNITIES: NO_EXPORT
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: NO_EXPORT
                Community Well-known: NO_EXPORT (0xffffff01)

NO_EXPORT (0xffffff01)とRFC 1997の値がそのまま入っています。

上のtshark出力のパケット(No.321 UPDATE)のpcapをダウンロード

STEP 7:NO_ADVERTISEはiBGPにも出さない

TO-R1をset community (no-advertise)に変えます。

R6 show rpl route-policy TO-R1(STEP 7)
RP/0/RP0/CPU0:R6#show rpl route-policy TO-R1

Wed Sep  9 06:40:52.536 UTC
route-policy TO-R1
  if destination in (192.168.6.0/24) then
    set community (no-advertise)
  endif
  pass
end-policy
!

R1ではnot advertised to any peerになります。

R1 show bgp 192.168.6.0/24(STEP 7)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:41:35.790 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 17           17
Last Modified: Sep  9 06:40:35.774 for 00:01:00
Paths: (3 available, best #3, not advertised to any peer)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  65002 65003 65004, (received & used)
    10.0.0.2 (metric 3) from 10.0.0.2 (10.0.0.2)
      Origin IGP, localpref 100, valid, internal
      Received Path ID 0, Local Path ID 0, version 0
  Path #2: Received by speaker 0
  Not advertised to any peer
  65002 65003 65004, (received & used)
    10.1.4.4 from 10.1.4.4 (10.0.0.4)
      Origin IGP, localpref 100, valid, external, group-best
      Received Path ID 0, Local Path ID 0, version 0
      Origin-AS validity: (disabled)
  Path #3: Received by speaker 0
  Not advertised to any peer
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 17
      Community: no-advertise
      Origin-AS validity: (disabled)

iBGPピア向けの広告からも消えました。

R1 show bgp neighbors 10.0.0.2 advertised-routes(STEP 7)
RP/0/RP0/CPU0:R1#show bgp neighbors 10.0.0.2 advertised-routes

Wed Sep  9 06:41:38.012 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.0.0.1        Local           i
192.168.4.0/24     10.0.0.1        10.1.4.4        65002i
192.168.5.0/24     10.0.0.1        10.1.4.4        65002 65003i

Processed 3 prefixes, 3 paths

R1はすでに送ってあった経路をWITHDRAWで取り消します(iBGPキャプチャーのNo.681)。

iBGPキャプチャーのNo.681 UPDATE(R1 → R3、WITHDRAW)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 27
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 4
    Withdrawn Routes
        192.168.6.0/24
            Withdrawn route prefix length: 24
            Withdrawn prefix: 192.168.6.0
    Total Path Attribute Length: 0
上のtshark出力のパケット(No.681 WITHDRAW)のpcapをダウンロード

R3は192.168.6.0/24を失うのではなく、R2経由の別経路(65002 65003 65004)に切り替わります。

R3 show bgp 192.168.6.0/24(STEP 7)
RP/0/RP0/CPU0:R3#show bgp 192.168.6.0/24

Wed Sep  9 06:42:28.378 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 17           17
Last Modified: Sep  9 06:40:36.774 for 00:01:51
Paths: (1 available, best #1)
  Not advertised to any peer
  Path #1: Received by speaker 0
  Not advertised to any peer
  65002 65003 65004, (received & used)
    10.0.0.2 (metric 2) from 10.0.0.2 (10.0.0.2)
      Origin IGP, localpref 100, valid, internal, best, group-best
      Received Path ID 0, Local Path ID 1, version 17

NO_ADVERTISEは経路そのものを消すのではなく、そのパスの配布を止めるだけです。

eBGPキャプチャーのNo.335がNO_ADVERTISEを運んだUPDATEです。

No.335 UPDATE(R6 → R1)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 67
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 44
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.1.6.6
                IPv4 Address: 10.1.6.6
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - COMMUNITIES: NO_ADVERTISE
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: NO_ADVERTISE
                Community Well-known: NO_ADVERTISE (0xffffff02)
上のtshark出力のパケット(No.335 UPDATE)のpcapをダウンロード

STEP 8:ユーザー定義コミュニティで広告先を絞る(最終状態)

NTTの2914:429と同じ形を作ります。AS 65001が65001:429を「R4へは広告しない」の意味で公開し、R6がそれを付ける想定です。R6はset community (65001:429)に変えるだけで、上位に置くのは意味を決めるAS 65001の番号です。

R6 show rpl route-policy TO-R1(STEP 8)
RP/0/RP0/CPU0:R6#show rpl route-policy TO-R1

Wed Sep  9 06:44:06.630 UTC
route-policy TO-R1
  if destination in (192.168.6.0/24) then
    set community (65001:429)
  endif
  pass
end-policy
!

R1にコミュニティの判定とdropを入れます。

R1 show rpl community-set CS-NO-ADV-R4(STEP 8)
RP/0/RP0/CPU0:R1#show rpl community-set CS-NO-ADV-R4

Wed Sep  9 06:44:56.006 UTC
community-set CS-NO-ADV-R4
  65001:429
end-set
!
R1 show rpl route-policy TO-R4(STEP 8)
RP/0/RP0/CPU0:R1#show rpl route-policy TO-R4

Wed Sep  9 06:44:54.180 UTC
route-policy TO-R4
  if community matches-any CS-NO-ADV-R4 then
    drop
  endif
  pass
end-policy
!

既知のコミュニティではないので、R1のBGPテーブルに特別な表示は出ません。

R1 show bgp 192.168.6.0/24(STEP 8)
RP/0/RP0/CPU0:R1#show bgp 192.168.6.0/24

Wed Sep  9 06:44:49.322 UTC
BGP routing table entry for 192.168.6.0/24
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                 18           18
Last Modified: Sep  9 06:43:35.774 for 00:01:13
Paths: (2 available, best #2)
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  Path #1: Received by speaker 0
  Not advertised to any peer
  65002 65003 65004, (received & used)
    10.1.4.4 from 10.1.4.4 (10.0.0.4)
      Origin IGP, localpref 100, valid, external, group-best
      Received Path ID 0, Local Path ID 0, version 0
      Origin-AS validity: (disabled)
  Path #2: Received by speaker 0
  Advertised IPv4 Unicast paths to update-groups (with more than one peer):
    0.2 
  65004, (received & used)
    10.1.6.6 from 10.1.6.6 (10.0.0.6)
      Origin IGP, metric 0, localpref 100, valid, external, best, group-best
      Received Path ID 0, Local Path ID 1, version 18
      Community: 65001:429
      Origin-AS validity: (disabled)

R4向けの広告からは落ちています。

R1 show bgp neighbors 10.1.4.4 advertised-routes(STEP 8)
RP/0/RP0/CPU0:R1#show bgp neighbors 10.1.4.4 advertised-routes

Wed Sep  9 06:44:51.989 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.1.4.1        Local           65001i
192.168.2.0/24     10.1.4.1        10.0.0.2        65001i
192.168.3.0/24     10.1.4.1        10.0.0.3        65001i

Processed 3 prefixes, 3 paths

iBGPには通常どおり流れます。 R1がR4向け出方向ポリシーで落としているだけだからです。

ユーザー定義コミュニティは全境界ルータに入れないと漏れる

もう1つの境界ルータR2にはdropを入れていません。

R2 show bgp neighbors 10.2.4.4 advertised-routes(STEP 8)
RP/0/RP0/CPU0:R2#show bgp neighbors 10.2.4.4 advertised-routes

Wed Sep  9 06:45:21.155 UTC
Network            Next Hop        From            AS Path
192.168.1.0/24     10.2.4.2        10.0.0.1        65001i
192.168.2.0/24     10.2.4.2        Local           65001i
192.168.3.0/24     10.2.4.2        10.0.0.3        65001i
192.168.6.0/24     10.2.4.2        10.0.0.1        65001 65004i

Processed 4 prefixes, 4 paths

192.168.6.0/24がR4へ広告され、コミュニティ付きで届いています。

NO_EXPORTはプロトコルの規定ですが、ユーザー定義コミュニティは各ルータのポリシー次第です。公開するなら全境界ルータに同じ判定が要ります。

eBGPキャプチャーのNo.347が65001:429を運んだUPDATEです。

No.347 UPDATE(R6 → R1)tshark -V
Border Gateway Protocol - UPDATE Message
    Marker: ffffffffffffffffffffffffffffffff
    Length: 67
    Type: UPDATE Message (2)
    Withdrawn Routes Length: 0
    Total Path Attribute Length: 44
    Path attributes
        Path Attribute - MP_REACH_NLRI
            Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
<snip>
            Type Code: MP_REACH_NLRI (14)
            Length: 13
            Address family identifier (AFI): IPv4 (1)
            Subsequent address family identifier (SAFI): Unicast (1)
            Next hop: 10.1.6.6
                IPv4 Address: 10.1.6.6
            Number of Subnetwork points of attachment (SNPA): 0
            Network Layer Reachability Information (NLRI)
                192.168.6.0/24
                    MP Reach NLRI prefix length: 24
                    MP Reach NLRI IPv4 prefix: 192.168.6.0
        Path Attribute - ORIGIN: IGP
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: ORIGIN (1)
            Length: 1
            Origin: IGP (0)
        Path Attribute - AS_PATH: 65004
            Flags: 0x40, Transitive, Well-known, Complete
<snip>
            Type Code: AS_PATH (2)
            Length: 6
            AS Path segment: 65004
                Segment type: AS_SEQUENCE (2)
                Segment length (number of ASN): 1
                AS4: 65004
        Path Attribute - MULTI_EXIT_DISC: 0
            Flags: 0x80, Optional, Non-transitive, Complete
<snip>
            Type Code: MULTI_EXIT_DISC (4)
            Length: 4
            Multiple exit discriminator: 0
        Path Attribute - COMMUNITIES: 65001:429
            Flags: 0xc0, Optional, Transitive, Complete
<snip>
            Type Code: COMMUNITIES (8)
            Length: 4
            Communities: 65001:429
                Community: 65001:429
                    Community AS: 65001
                    Community value: 429
上のtshark出力のパケット(No.347 UPDATE)のpcapをダウンロード

検証のまとめ

STEPR6が付けたコミュニティR1の挙動R2・R3(iBGP)R4(AS 65002)
165004:1000そのまま中継届く届く
3(R1が65001:100で上書き)元の値を破棄65001:100のみ65001:100のみ
4(R1がadditiveで追加)両方保持2つとも届く2つとも届く
6NO_EXPORTeBGPへ出さない届く。R2もeBGPへ出さなくなる届かない
7NO_ADVERTISEどこへも出さない届かない(WITHDRAWを受ける)届かない
865001:429TO-R4でdrop届くR1からは届かない。R2からは漏れる

検証Configおよびshow結果

各STEPで6台すべてから、次の3種類をルータごとに取得しています。検証Configはこの..._run.txtです(最終状態はSTEP 8)。

ファイル内容
..._show.txtshow version / show interface description / show route / show bgp / show bgp community <値> / show bgp neighbors <ピア> advertised-routes・routes・received routes / show rpl route-policy など
..._log.txtそのSTEPの範囲に絞ったshow logging(logmsgのマーカー時刻をshow logging startに指定)
..._run.txtそのSTEP時点のshow running-config

STEP 0:初期状態

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

STEP 1:R6が192.168.6.0/24に65004:1000を付ける

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

STEP 2:R1がコミュニティを見てLOCAL_PREFを上げる

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

STEP 3:set communityにadditiveを付けない

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

STEP 4:additiveを付ける

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

STEP 5:R1の入方向ポリシーを外す

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

STEP 6:R6がNO_EXPORTを付ける

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

STEP 7:R6がNO_ADVERTISEを付ける

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

STEP 8:ユーザー定義コミュニティ65001:429で広告先を絞る(最終状態)

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

R1-R6間(eBGP)のキャプチャー全体をダウンロード

R1-R3間(iBGP)のキャプチャー全体をダウンロード

参考

資料タイトル概要
RFC 1997BGP Communities AttributeCOMMUNITY属性の定義。Type code 8、optional transitive、4オクテット、予約範囲、NO_EXPORT/NO_ADVERTISE/NO_EXPORT_SUBCONFEDの規定。
RFC 4360BGP Extended Communities Attribute拡張コミュニティ(Type code 16、8オクテット)の定義。
RFC 8092BGP Large Communities Attributeラージコミュニティ(Type code 32、12オクテット、32ビット×3)の定義。4バイトAS番号を名前空間に使える。
RFC 7999BLACKHOLE Community65535:666(0xFFFF029A)の定義。Informational。
RFC 8326Graceful BGP Session ShutdownGRACEFUL_SHUTDOWN(65535:0/0xFFFF0000)の定義。
NTTRouting - NTT-GINAS2914が顧客向けに公開しているコミュニティ一覧。2914:429や65500:nnnなど、実運用での使われ方が分かる。

関連記事