経路集約とは
経路集約は、複数のプレフィックスを1つの短いプレフィックスにまとめて広告することです。
172.16.0.0/24から172.16.3.0/24までの4本は、172.16.0.0/22の1本にまとめられます。
| 目的 | 内容 |
|---|---|
| テーブルを小さくする | 4本が1本になる |
| 変動を外に見せない | 構成要素が1本でも残っていれば集約経路は広告され続け、フラップが自AS内で止まる |
RFC 4271は9.1.4と9.2.2.2で集約を扱っており、 集約するルータが、自分を起点とする新しい経路を1本作り出します。
集約で失われるものと、それを示す2つの属性
集約経路は元の4本とは別の経路です。IOS XRの既定(as-setなし)では、構成要素のAS_PATHは集約経路に引き継がれず、
AS_PATHは集約したASから始まります(COMMUNITYも同様。この記事では構成要素に付けていないため未観測)。
RFC 4271の9.2.2.2は複数のAS_PATHを1本にまとめる手順(共通する先頭をAS_SEQUENCEに、残りをAS_SETに)を定めていますが、
AS_SETには後述の副作用があるため、実装の既定では使いません。かわりに、情報を落としたことを示す属性を2つ付けます。
| 属性 | RFC 4271 4.3 | 内容 |
|---|---|---|
ATOMIC_AGGREGATE | Type code 6、Well-known discretionary、長さ0 | 「細かい経路をまとめ、元のAS_PATH情報が失われた」印。受け取った側はこの経路をより細かいプレフィックスに分割してはならず(MUST NOT)、再広告時に落とすべきでない(SHOULD NOT) |
AGGREGATOR | Type code 7、Optional transitive | 集約したルータのAS番号とBGP識別子。「誰が集約したか」 |
AGGREGATORの長さは、4バイトAS番号(RFC 6793)に対応したピア間では8オクテット(AS 4 + IP 4)、非対応ピアへは6オクテットです。
集約したASが65536以上のときだけ、非対応ピア向けにはAS_TRANS(23456)とAS4_AGGREGATOR(Type code 18)を使います。
as-set:AS_SETを残す方法と、使わない理由
aggregate-addressにas-setを付けると、9.2.2.2の手順で構成要素のASがAS_SET(順序を持たない集合。{65002, 65003, 65004}と表示)に残ります。
AS_PATH長の比較ではAS_SETは中身が何個でも1です。
このときATOMIC_AGGREGATEは付きません。9.1.4は「AS_SETに全ASを含めるか、ATOMIC_AGGREGATEを付けるかのどちらか」としているためです。
| 副作用 | 内容 |
|---|---|
| AS_SETに載ったASは受け取れない | ループ検出はAS_PATHに自ASを含む経路を捨てる。AS_SETの中身も対象 |
| 構成要素の増減で書き換わる | AS_SETが変わるたびにUPDATEが飛び、「変動を外に見せない」効果が薄れる |
| 実在しない経路を表す | 複数の経路を混ぜたAS_PATHなので、パケットが通るASの並びとは限らない(5.1.6) |
RFC 6472(BCP 172)は、AS_SETとAS_CONFED_SETを含む新しい広告を生成しないよう推奨しています。
経路の出所を検証しにくくなることが主な理由です。実運用ではas-setは付けません。
IOS XRでの設定
router bgp 65001
address-family ipv4 unicast
aggregate-address 172.16.0.0/22 as-set summary-only route-policy <名前>| オプション | 意味 |
|---|---|
| なし | 集約経路を生成する。構成要素もそのまま広告され続ける |
summary-only | 構成要素を抑制し、集約経路だけを広告する |
as-set | AS_PATHにAS_SETを入れる(通常は使わない) |
route-policy | 集約経路に属性を付ける |
| 挙動 | 内容 |
|---|---|
| 生成条件 | 範囲内の経路がBGPテーブルに1本以上あるときだけ生成される。ゼロになれば消え、戻れば復活する。設定はshow bgp aggregate-addressに残る |
| RIB | 集約したルータ自身ではNull0を向く。範囲内の存在しない宛先をデフォルトルートで転送し続けないため |
ORIGIN | 9.2.2.2の規定は「1本でもINCOMPLETEならINCOMPLETE、1本でもEGPならEGP、それ以外はIGP」。この記事では全構成要素がnetwork文由来のためIGP |
実機での検証
XRd 26.1.1のルータ6台で確認します。
- AS 65001はR1・R2が境界、R3が内部(iBGPフルメッシュ、
next-hop-self、OSPF)。AS 65002はR4、AS 65003はR5、AS 65004はR6 - R5が
172.16.0.0/24と.1.0/24を、R6が.2.0/24と.3.0/24をnetwork文で広告する - R1が
aggregate-address 172.16.0.0/22で集約する。eBGPの出方向ポリシーはネイバーごとに別名(中身はpassのみ)
R1には構成要素が2種類のAS_PATHで届きます。R5発の2本はR4経由で65002 65003、R6発の2本は65004です。
as-setを付けたときのAS_SETが{65002, 65003, 65004}になるのはこのためです。
各STEPの概要
| STEP | R1の操作 | 確認したこと | 結果 | 主な根拠 |
|---|---|---|---|---|
| 0 | 集約なし | 4本の/24の届き方 | .0と.1はR4経由、.2と.3はR6経由がベスト | R1 show bgp |
| 1 | aggregate-address | 集約経路の属性。構成要素は広告され続けるか | AS_PATH空・ATOMIC_AGGREGATE・AGGREGATOR 65001 10.0.0.1・RIBはNull0。構成要素も広告される。iBGPにも属性がそのまま伝わる | R1 show bgp 172.16.0.0/22、pcap No.93・No.166 |
| 2 | summary-only追加 | 構成要素の抑制 | 4本にsが付き、R6へWITHDRAWが飛ぶ | R1 show bgp、pcap No.111 |
| 3 | as-set追加 | AS_SETの副作用 | {65002,65003,65004}が付きATOMIC_AGGREGATEが消える。R4・R5・R6の3台とも捨てる(到達性は元の/24で保たれる) | R4・R5・R6 show bgp 172.16.0.0/22、pcap No.133 |
| 4 | (R6のLo2・Lo3をshutdown) | 構成要素が減ったときのAS_SET | 65002 65003に縮む。過渡状態65002 65003 {65004}も記録。R1がR4へ広告せず、R5は捨て、R6だけ受け取る | R1 show bgp 172.16.0.0/22、pcap No.160・No.162 |
| 5 | (R5のLo2・Lo3もshutdown) | 構成要素ゼロ | 集約経路が消えWITHDRAWが飛ぶ。設定は残る | R1 show bgp、pcap No.187 |
| 6 | Loopback復旧、as-setを外す(最終) | RFC 6472推奨の形 | ATOMIC_AGGREGATEが戻り、3台とも受け取る。R4→R5の中継でもAGGREGATORは不変 | R4 show bgp 172.16.0.0/22、pcap No.208・R4-R5 No.93 |
STEP 0:集約なし
R1のBGPテーブルには4本の/24が個別に載っています。
RP/0/RP0/CPU0:R1#show bgp
Wed Sep 9 09:42:35.140 UTC
BGP router identifier 10.0.0.1, local AS number 65001
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000 RD version: 12
BGP main routing table version 12
BGP NSR Initial initsync version 11 (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
* i172.16.0.0/24 10.0.0.2 100 0 65002 65003 i
*> 10.1.4.4 0 65002 65003 i
* 10.1.6.6 0 65004 65003 i
* i172.16.1.0/24 10.0.0.2 100 0 65002 65003 i
*> 10.1.4.4 0 65002 65003 i
* 10.1.6.6 0 65004 65003 i
*> 172.16.2.0/24 10.1.6.6 0 0 65004 i
*> 172.16.3.0/24 10.1.6.6 0 0 65004 i
*> 192.168.1.0/24 0.0.0.0 0 32768 i
*>i192.168.2.0/24 10.0.0.2 0 100 0 i
*>i192.168.3.0/24 10.0.0.3 0 100 0 i
* i192.168.4.0/24 10.0.0.2 0 100 0 65002 i
*> 10.1.4.4 0 0 65002 i
* 10.1.6.6 0 65004 65003 65002 i
* i192.168.5.0/24 10.0.0.2 100 0 65002 65003 i
*> 10.1.4.4 0 65002 65003 i
* 10.1.6.6 0 65004 65003 i
*> 192.168.6.0/24 10.1.6.6 0 0 65004 i
Processed 10 prefixes, 18 paths.0と.1はR4経由(65002 65003)、.2と.3はR6経由(65004)がベストです。
前者はR6経由(65004 65003)とIGPメトリックまで同点で、IOS XRは同点のeBGP経路では先に選ばれていたベストパスを維持するため、
先にセッションが確立したR4経由が残っています(bgp bestpath compare-routeridを設定しない限りRouter ID比較には進みません)。
この選択がAS_SETの中身を決めます。
STEP 1:aggregate-addressで集約経路を作る
router bgp 65001
address-family ipv4 unicast
aggregate-address 172.16.0.0/22RP/0/RP0/CPU0:R1#show bgp 172.16.0.0/22
Wed Sep 9 10:06:29.711 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 14 14
Last Modified: Sep 9 10:04:41.774 for 00:01:48
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 10.1.6.6
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 10.1.6.6
Local, (aggregated by 65001 10.0.0.1)
0.0.0.0 from 0.0.0.0 (10.0.0.1)
Origin IGP, localpref 100, weight 32768, valid, aggregated, atomic-aggregate, best, group-best
Received Path ID 0, Local Path ID 1, version 14(aggregated by 65001 10.0.0.1)がAGGREGATOR、atomic-aggregateがATOMIC_AGGREGATEです。
Next Hop 0.0.0.0・Weight 32768で、R1が自分で生成した経路として扱われ、RIBではNull0を向きます。
RP/0/RP0/CPU0:R1#show route bgp
Wed Sep 9 10:06:28.343 UTC
B 172.16.0.0/22 [200/0] via 0.0.0.0, 00:01:46, Null0
B 172.16.0.0/24 [20/0] via 10.1.4.4, 00:26:45
B 172.16.1.0/24 [20/0] via 10.1.4.4, 00:26:45
B 172.16.2.0/24 [20/0] via 10.1.6.6, 00:26:45
B 172.16.3.0/24 [20/0] via 10.1.6.6, 00:26:45
B 192.168.2.0/24 [200/0] via 10.0.0.2, 00:26:45
B 192.168.3.0/24 [200/0] via 10.0.0.3, 00:26:45
B 192.168.4.0/24 [20/0] via 10.1.4.4, 00:26:45
B 192.168.5.0/24 [20/0] via 10.1.4.4, 00:26:45
B 192.168.6.0/24 [20/0] via 10.1.6.6, 00:26:45summary-onlyが無いので、R6へは集約経路と構成要素の両方を広告しています。
RP/0/RP0/CPU0:R1#show bgp neighbors 10.1.6.6 advertised-routes
Wed Sep 9 10:06:34.085 UTC
Network Next Hop From AS Path
172.16.0.0/22 10.1.6.1 Local Aggregate 65001i
172.16.0.0/24 10.1.6.1 10.1.4.4 65001 65002 65003i
172.16.1.0/24 10.1.6.1 10.1.4.4 65001 65002 65003i
192.168.1.0/24 10.1.6.1 Local 65001i
192.168.2.0/24 10.1.6.1 10.0.0.2 65001i
192.168.3.0/24 10.1.6.1 10.0.0.3 65001i
192.168.4.0/24 10.1.6.1 10.1.4.4 65001 65002i
192.168.5.0/24 10.1.6.1 10.1.4.4 65001 65002 65003i
Processed 8 prefixes, 8 pathsこのUPDATEがR1-R6間キャプチャーのNo.93です。
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.1
IPv4 Address: 10.1.6.1
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: 65001
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 6
AS Path segment: 65001
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 1
AS4: 65001
Path Attribute - ATOMIC_AGGREGATE
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: ATOMIC_AGGREGATE (6)
Length: 0
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1AS_PATHは65001だけで、構成要素の65002 65003も65004も残っていません。
AGGREGATORのLength: 8は、両端が4バイトAS capabilityを交換しているためです。
iBGPでの見え方
R3へのiBGP UPDATE(R1-R3間キャプチャーのNo.166)でも、ATOMIC_AGGREGATEとAGGREGATORはそのまま伝わります。
iBGPではASを足さないのでAS_PATHは空です。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 68
Type: UPDATE Message (2)
Withdrawn Routes Length: 0
Total Path Attribute Length: 45
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)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: empty
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 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 - ATOMIC_AGGREGATE
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: ATOMIC_AGGREGATE (6)
Length: 0
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1STEP 2:summary-onlyで構成要素を抑制する
router bgp 65001
address-family ipv4 unicast
no aggregate-address 172.16.0.0/22
aggregate-address 172.16.0.0/22 summary-onlyRP/0/RP0/CPU0:R1#show bgp
Wed Sep 9 10:10:44.459 UTC
BGP router identifier 10.0.0.1, local AS number 65001
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000 RD version: 19
BGP main routing table version 19
BGP NSR Initial initsync version 11 (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
*> 172.16.0.0/22 0.0.0.0 32768 i
s i172.16.0.0/24 10.0.0.2 100 0 65002 65003 i
s> 10.1.4.4 0 65002 65003 i
s 10.1.6.6 0 65004 65003 i
s i172.16.1.0/24 10.0.0.2 100 0 65002 65003 i
s> 10.1.4.4 0 65002 65003 i
s 10.1.6.6 0 65004 65003 i
s i172.16.2.0/24 10.0.0.2 100 0 65002 65003 65004 i
s 10.1.4.4 0 65002 65003 65004 i
s> 10.1.6.6 0 0 65004 i
s i172.16.3.0/24 10.0.0.2 100 0 65002 65003 65004 i
s 10.1.4.4 0 65002 65003 65004 i
s> 10.1.6.6 0 0 65004 i
*> 192.168.1.0/24 0.0.0.0 0 32768 i
*>i192.168.2.0/24 10.0.0.2 0 100 0 i
*>i192.168.3.0/24 10.0.0.3 0 100 0 i
* i192.168.4.0/24 10.0.0.2 0 100 0 65002 i
*> 10.1.4.4 0 0 65002 i
* 10.1.6.6 0 65004 65003 65002 i
* i192.168.5.0/24 10.0.0.2 100 0 65002 65003 i
*> 10.1.4.4 0 65002 65003 i
* 10.1.6.6 0 65004 65003 i
*> 192.168.6.0/24 10.1.6.6 0 0 65004 i
Processed 11 prefixes, 23 paths4本の/24にs(suppressed)が付きました。経路はテーブルに残り、広告だけが止まります。
切り替わった瞬間にR1が送った構成要素のWITHDRAWがNo.111です。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 31
Type: UPDATE Message (2)
Withdrawn Routes Length: 8
Withdrawn Routes
172.16.1.0/24
Withdrawn route prefix length: 24
Withdrawn prefix: 172.16.1.0
172.16.0.0/24
Withdrawn route prefix length: 24
Withdrawn prefix: 172.16.0.0
Total Path Attribute Length: 0STEP 3:as-setでAS_SETを付ける
router bgp 65001
address-family ipv4 unicast
no aggregate-address 172.16.0.0/22 summary-only
aggregate-address 172.16.0.0/22 as-set summary-onlyRP/0/RP0/CPU0:R1#show bgp 172.16.0.0/22
Wed Sep 9 10:15:54.193 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 21 21
Last Modified: Sep 9 10:14:05.774 for 00:01:48
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 10.1.6.6
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 10.1.6.6
{65002,65003,65004}, (aggregated by 65001 10.0.0.1)
0.0.0.0 from 0.0.0.0 (10.0.0.1)
Origin IGP, localpref 100, weight 32768, valid, aggregated, best, group-best
Received Path ID 0, Local Path ID 1, version 21AS_PATHが{65002,65003,65004}になり、atomic-aggregateが消えました。
キャプチャー(No.133)ではAS_SEQUENCEとAS_SETの2セグメントです。
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.1.6.1
IPv4 Address: 10.1.6.1
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: 65001 {65002, 65003, 65004}
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 20
AS Path segment: 65001
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 1
AS4: 65001
AS Path segment: {65002, 65003, 65004}
Segment type: AS_SET (1)
Segment length (number of ASN): 3
AS4: 65002
AS4: 65003
AS4: 65004
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1副作用がそのまま出ます。AS_SETに載ったAS 65002・65003・65004の3台は、この集約経路を受け取れません。
RP/0/RP0/CPU0:R4#show bgp 172.16.0.0/22
Wed Sep 9 10:17:40.415 UTC
%% Network not in tableRP/0/RP0/CPU0:R5#show bgp 172.16.0.0/22
Wed Sep 9 10:18:27.589 UTC
%% Network not in tableRP/0/RP0/CPU0:R6#show bgp 172.16.0.0/22
Wed Sep 9 10:19:06.961 UTC
%% Network not in tableNo.133のとおりR1は送っているので、捨てているのは受信側です。ループ検出で捨てた経路はreceived routesにも現れません。
ただし到達性は失われていません。3つのASは元の/24を互いに直接交換しているため、見えなくなったのはAS 65001発の集約経路だけです。
STEP 4:構成要素が減るとAS_SETも変わる
R6のLoopback2・Loopback3を落とし、172.16.2.0/24と172.16.3.0/24を消します。
interface Loopback2
shutdown
!
interface Loopback3
shutdownRP/0/RP0/CPU0:R1#show bgp 172.16.0.0/22
Wed Sep 9 10:21:55.225 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 30 30
Last Modified: Sep 9 10:20:02.774 for 00:01:52
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.6.6
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.6.6
65002 65003, (aggregated by 65001 10.0.0.1)
0.0.0.0 from 0.0.0.0 (10.0.0.1)
Origin IGP, localpref 100, weight 32768, valid, aggregated, best, group-best
Received Path ID 0, Local Path ID 1, version 30AS_SETが消えて素のAS_SEQUENCEに戻る
AS_PATHが{65002,65003,65004}から65002 65003に変わりました。
残った2本はどちらも65002 65003で、9.2.2.2の「全経路のAS_PATHが同一なら集約経路も同じAS_PATH」のとおりです。
その手前の過渡状態もキャプチャーに残っています。STEP 2以降、R1は.2と.3をR4経由(65002 65003 65004)でも持っているため、
R6直接の経路が先に消えた瞬間は構成要素が65002 65003×2と65002 65003 65004×2になり、
共通する先頭65002 65003+残り{65004}の形で、65001 65002 65003 {65004}を持つUPDATE(No.160)が先に飛びます。
30秒後にR4経由も消え、AS_SETの無いNo.162になります。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 72
Type: UPDATE Message (2)
Withdrawn Routes Length: 0
Total Path Attribute Length: 49
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.1
IPv4 Address: 10.1.6.1
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: 65001 65002 65003
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 14
AS Path segment: 65001 65002 65003
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 3
AS4: 65001
AS4: 65002
AS4: 65003
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1ATOMIC_AGGREGATEは付いていません。5.1.6が求めるのは「AS_SETを落とした結果ASが抜けたとき」で、65002 65003は構成要素のASをすべて含むためです。
AS_PATHにAS 65002が入ったので、R4への広告が止まります。advertised-routesにもshow bgp 172.16.0.0/22の広告先にもR4が現れません。
IOS XRは受信した経路なら相手のASを含んでいても送る(BGP(Border Gateway Protocol)のR4→R1の広告など)ので、これは自分で生成した集約経路に固有の扱いです。
RP/0/RP0/CPU0:R1#show bgp neighbors 10.1.4.4 advertised-routes
Wed Sep 9 10:22:26.926 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
192.168.6.0/24 10.1.4.1 10.1.6.6 65001 65004i
Processed 4 prefixes, 4 pathsAS_PATHから65004が抜けたR6は受け取れるようになりました。
RP/0/RP0/CPU0:R6#show bgp 172.16.0.0/22
Wed Sep 9 10:25:15.552 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 19 19
Last Modified: Sep 9 10:20:32.774 for 00:04:42
Paths: (1 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.5.6.5
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.5.6.5
65001 65002 65003, (aggregated by 65001 10.0.0.1), (received & used)
10.1.6.1 from 10.1.6.1 (10.0.0.1)
Origin IGP, localpref 100, valid, external, best, group-best
Received Path ID 0, Local Path ID 1, version 19
Origin-AS validity: (disabled)R6はこれをR5へ65004 65001 65002 65003で広告しますが、R5(AS 65003)は自ASを含むため捨てます。
このSTEPで集約経路が見えるのはR6だけです。構成要素の一部が落ちただけで、集約経路の到達範囲が変わりました。
STEP 5:構成要素がゼロになると集約経路も消える
R5のLoopback2・Loopback3も落とします。
interface Loopback2
shutdown
!
interface Loopback3
shutdownRP/0/RP0/CPU0:R1#show bgp
Wed Sep 9 10:28:02.381 UTC
BGP router identifier 10.0.0.1, local AS number 65001
BGP generic scan interval 60 secs
Non-stop routing is enabled
BGP table state: Active
Table ID: 0xe0000000 RD version: 38
BGP main routing table version 38
BGP NSR Initial initsync version 11 (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.1.0/24 0.0.0.0 0 32768 i
*>i192.168.2.0/24 10.0.0.2 0 100 0 i
*>i192.168.3.0/24 10.0.0.3 0 100 0 i
* i192.168.4.0/24 10.0.0.2 0 100 0 65002 i
*> 10.1.4.4 0 0 65002 i
* 10.1.6.6 0 65004 65003 65002 i
* i192.168.5.0/24 10.0.0.2 100 0 65002 65003 i
*> 10.1.4.4 0 65002 65003 i
* 10.1.6.6 0 65004 65003 i
*> 192.168.6.0/24 10.1.6.6 0 0 65004 i
Processed 6 prefixes, 10 paths172.16.0.0/22も4本の/24もテーブルから消え、R1はR6へ/22のWITHDRAW(No.187)を送っています。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 27
Type: UPDATE Message (2)
Withdrawn Routes Length: 4
Withdrawn Routes
172.16.0.0/22
Withdrawn route prefix length: 22
Withdrawn prefix: 172.16.0.0
Total Path Attribute Length: 0設定はshow bgp aggregate-addressに残っており、構成要素が戻れば集約経路も復活します。
RP/0/RP0/CPU0:R1#show bgp aggregate-address
Wed Sep 9 10:28:02.928 UTC
Address-Family: IPv4 Unicast
Total time spent processing aggregates: 0.0 seconds
Maximum time taken to process aggregates: 0.0 seconds run on ---
Total number times we have process aggregates: 8
172.16.0.0/22
Last time aggregate was run: Sep 9 10:26:08.485
Longest time aggregate taken: 0.0 seconds was run on ---
Total number of runs: 8
Total time of all runs: 0.0 secondsSTEP 6:as-setを外す(最終状態)
Loopbackを戻し、R1のas-setを外します。RFC 6472が推奨する形です。
interface Loopback2
no shutdown
!
interface Loopback3
no shutdownrouter bgp 65001
address-family ipv4 unicast
no aggregate-address 172.16.0.0/22 as-set summary-only
aggregate-address 172.16.0.0/22 summary-onlyRP/0/RP0/CPU0:R1#show bgp 172.16.0.0/22
Wed Sep 9 10:34:32.736 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 45 45
Last Modified: Sep 9 10:32:30.774 for 00:02:02
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 10.1.6.6
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 10.1.6.6
Local, (aggregated by 65001 10.0.0.1)
0.0.0.0 from 0.0.0.0 (10.0.0.1)
Origin IGP, localpref 100, weight 32768, valid, aggregated, atomic-aggregate, best, group-best
Received Path ID 0, Local Path ID 1, version 45AS_SETが無くなり、atomic-aggregateが戻りました(No.208)。
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.1
IPv4 Address: 10.1.6.1
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: 65001
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 6
AS Path segment: 65001
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 1
AS4: 65001
Path Attribute - ATOMIC_AGGREGATE
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: ATOMIC_AGGREGATE (6)
Length: 0
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1AS_PATHに自ASが載らないので、R4・R5・R6のすべてが受け取れます。
RP/0/RP0/CPU0:R4#show bgp 172.16.0.0/22
Wed Sep 9 10:36:20.921 UTC
BGP routing table entry for 172.16.0.0/22
Versions:
Process bRIB/RIB SendTblVer
Speaker 30 30
Last Modified: Sep 9 10:32:34.774 for 00:03:46
Paths: (2 available, best #1)
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.4.5.5
Path #1: Received by speaker 0
Advertised IPv4 Unicast paths to peers (in unique update groups):
10.4.5.5
65001, (aggregated by 65001 10.0.0.1), (received & used)
10.1.4.1 from 10.1.4.1 (10.0.0.1)
Origin IGP, localpref 100, valid, external, atomic-aggregate, best, group-best
Received Path ID 0, Local Path ID 1, version 30
Origin-AS validity: (disabled)
Path #2: Received by speaker 0
Not advertised to any peer
65001, (aggregated by 65001 10.0.0.1), (received & used)
10.2.4.2 from 10.2.4.2 (10.0.0.2)
Origin IGP, localpref 100, valid, external, atomic-aggregate
Received Path ID 0, Local Path ID 0, version 0
Origin-AS validity: (disabled)R4がR5へ中継したUPDATE(R4-R5間キャプチャーのNo.93)では、AS_PATHに65002が積まれる一方、
ATOMIC_AGGREGATEとAGGREGATORは集約したR1のもののままです。
Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 71
Type: UPDATE Message (2)
Withdrawn Routes Length: 0
Total Path Attribute Length: 48
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.4.5.4
IPv4 Address: 10.4.5.4
Number of Subnetwork points of attachment (SNPA): 0
Network Layer Reachability Information (NLRI)
172.16.0.0/22
MP Reach NLRI prefix length: 22
MP Reach NLRI IPv4 prefix: 172.16.0.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: 65002 65001
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: AS_PATH (2)
Length: 10
AS Path segment: 65002 65001
Segment type: AS_SEQUENCE (2)
Segment length (number of ASN): 2
AS4: 65002
AS4: 65001
Path Attribute - ATOMIC_AGGREGATE
Flags: 0x40, Transitive, Well-known, Complete
<snip>
Type Code: ATOMIC_AGGREGATE (6)
Length: 0
Path Attribute - AGGREGATOR: AS: 65001 origin: 10.0.0.1
Flags: 0xc0, Optional, Transitive, Complete
<snip>
Type Code: AGGREGATOR (7)
Length: 8
Aggregator AS: 65001
Aggregator origin: 10.0.0.1検証のまとめ
summary-onlyを付けないと構成要素も広告され続け、相手のテーブルは小さくならないas-setは付けない。 RFC 6472が非推奨としており、実機でも構成要素の出所ASが集約経路を受け取れなくなる- 集約経路は構成要素に依存する。 常に広告したい場合は
Null0向きのスタティックルートをnetwork文で出す
検証Configおよびshow結果
各STEPで6台すべてから、次の3種類をルータごとに取得しています。検証Configはこの..._run.txtです(最終状態はSTEP 6)。
| ファイル | 内容 |
|---|---|
..._show.txt | show version / show interface description / show route / show bgp / show bgp aggregate-address / show bgp 172.16.0.0/22と4本の構成要素 / show bgp neighbors <ピア> advertised-routes・routes・received routes / show bgp update-group / show rpl route-policy |
..._log.txt | そのSTEPの範囲に絞ったshow logging(logmsgのマーカー時刻をshow logging startに指定) |
..._run.txt | そのSTEP時点のshow running-config |
STEP 0:集約なし
| ルータ | 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:aggregate-address 172.16.0.0/22
| ルータ | 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:summary-onlyを追加
| ルータ | 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:as-setを追加
| ルータ | 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:R6のLoopback2・Loopback3をshutdown
| ルータ | 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:R5のLoopback2・Loopback3もshutdown
| ルータ | 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:Loopbackを復旧しas-setを外す(最終状態)
| ルータ | 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-R6間(eBGP)のキャプチャー全体をダウンロード
R1-R3間(iBGP)のキャプチャー全体をダウンロード
R4-R5間(eBGP)のキャプチャー全体をダウンロード
参考
| 資料 | タイトル | 概要 |
|---|---|---|
| RFC 4271 | A Border Gateway Protocol 4 (BGP-4) | ATOMIC_AGGREGATEとAGGREGATORの定義(4.3・5.1.6・5.1.7)、集約の扱い(9.1.4・9.2.2.2) |
| RFC 6472 | Recommendation for Not Using AS_SET and AS_CONFED_SET in BGP | BCP 172。AS_SETを含む新しい広告を生成しないことを推奨 |
| RFC 6793 | BGP Support for Four-Octet Autonomous System (AS) Number Space | 4バイトAS番号。AGGREGATORの8オクテット化とAS4_AGGREGATOR |
| RFC 1930 | Guidelines for creation, selection, and registration of an Autonomous System (AS) | BCP 6。集約を前提としたアドレス割り当ての考え方 |