【BGP】経路集約(aggregate-address、suppress-map)

BGP では、複数の経路を 1 つにまとめて(集約して)広告できます。コマンドは aggregate-address です。この記事では、集約経路を広告するときに、集約する前の特定の経路だけ広告を止める suppress-map を確認します。

注意

aggregate-address で集約経路を作って広告するには、集約の範囲に入る個別経路が、少なくとも 1 つ BGP テーブルにある必要があります。

この記事でわかること
  1. 集約する前の個別経路を広告する
  2. 広告を止めたい経路を、ルートマップで指定する
  3. suppress-map で、特定の個別経路だけ広告を止める

検証構成

R1 に 4 つのループバックを作り、network コマンドで BGP に載せます。この経路を aggregate-address で集約して、R2 に広告します。

AS 1 AS 2 R1 R2 .1 .2 192.168.12.0/24 集約経路 + 個別経路 3 つ 172.16.0.0/22 と 172.16.1.0/24 以外の /24 Loopback100〜103 172.16.0.0/24〜172.16.3.0/24
図1 検証構成

集約する前の経路を広告する

まず、集約する前の基本設定をします。

R1

R1(config)# interface Loopback100 
R1(config-if)# ip address 172.16.0.1 255.255.255.0
R1(config-if)# interface Loopback101
R1(config-if)# ip address 172.16.1.1 255.255.255.0
R1(config-if)# interface Loopback102
R1(config-if)# ip address 172.16.2.1 255.255.255.0
R1(config-if)# interface Loopback103
R1(config-if)# ip address 172.16.3.1 255.255.255.0

R1(config)# router bgp 1
R1(config-router)# network 172.16.0.0 mask 255.255.255.0
R1(config-router)# network 172.16.1.0 mask 255.255.255.0
R1(config-router)# network 172.16.2.0 mask 255.255.255.0
R1(config-router)# network 172.16.3.0 mask 255.255.255.0
R1(config-router)# neighbor 192.168.12.2 remote-as 2

R2

R2(config)# router bgp 2
R2(config-router)# neighbor 192.168.12.1 remote-as 1

R2 の BGP テーブルを確認すると、R1 の 4 つのループバックの経路を受け取っています。

R2

R2#show ip bgp
BGP table version is 5, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  172.16.0.0/24    192.168.12.1             0             0 1 i
 *>  172.16.1.0/24    192.168.12.1             0             0 1 i
 *>  172.16.2.0/24    192.168.12.1             0             0 1 i
 *>  172.16.3.0/24    192.168.12.1             0             0 1 I
ポイント

172.16.0.0/24、172.16.1.0/24、172.16.2.0/24、172.16.3.0/24 をまとめた経路は、172.16.0.0/22 です。

aggregate-address にオプションを何も付けないと、集約経路に加えて、集約する前の個別経路も広告されます。詳しくは、次の記事を参照してください。

>> 参考:BGPにおける経路集約(aggregate-address)を徹底解説 Ciscoルータ

ポイント

集約経路を広告しつつ、特定の個別経路だけ広告を止めるには、aggregate-address の suppress-map オプションで、止めたい経路を指定します。

広告を止めたい経路を指定する

まず、広告を止めたい経路(172.16.1.0/24)をプレフィックスリストで指定します。

R1

R1(config)# ip prefix-list SUPRESS permit 172.16.1.0/24

ルートマップで、このプレフィックスリストを指定します。

R1

R1(config)# route-map SUPRESS-MAP permit 10
R1(config-route-map)# match ip address prefix-list SUPRESS
R1(config-route-map)# exit

suppress-map を設定する

ルートマップを suppress-map に指定します。

R1

R1(config)# router bgp 1
R1(config-router)# aggregate-address 172.16.0.0 255.255.252.0 suppress-map SUPRESS-MAP

R1 の BGP テーブルを確認すると、集約する前の経路のうち、172.16.1.0/24 だけに s(suppressed:広告を止めている)が付いています。

R1

R1#show ip bgp 
BGP table version is 15, local router ID is 172.16.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  172.16.0.0/24    0.0.0.0                  0         32768 i
 *>  172.16.0.0/22    0.0.0.0                            32768 i
 s>  172.16.1.0/24    0.0.0.0                  0         32768 i
 *>  172.16.2.0/24    0.0.0.0                  0         32768 i
 *>  172.16.3.0/24    0.0.0.0                  0         32768 I

R1 が R2 に広告している経路を確認します。

R1

R1# show ip bgp neighbors 192.168.12.2 advertised-routes 
BGP table version is 15, local router ID is 172.16.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  172.16.0.0/24    0.0.0.0                  0         32768 i
 *>  172.16.0.0/22    0.0.0.0                            32768 i
 *>  172.16.2.0/24    0.0.0.0                  0         32768 i
 *>  172.16.3.0/24    0.0.0.0                  0         32768 i

Total number of prefixes 4
ポイント

R1 が R2 に広告する経路に、172.16.1.0/24 が含まれていません。集約経路と、ほかの 3 つの個別経路の、合わせて 4 つを広告しています。

R2 の BGP テーブルを確認すると、172.16.1.0/24 は含まれていません。

R2

R2# show ip bgp 
BGP table version is 13, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  172.16.0.0/24    192.168.12.1             0             0 1 i
 *>  172.16.0.0/22    192.168.12.1             0             0 1 i
 *>  172.16.2.0/24    192.168.12.1             0             0 1 i
 *>  172.16.3.0/24    192.168.12.1             0             0 1 I
R1 の BGP テーブルR2 に広告する経路*> 172.16.0.0/24172.16.0.0/24s> 172.16.1.0/24suppress-map*> 172.16.2.0/24172.16.2.0/24*> 172.16.3.0/24172.16.3.0/24*> 172.16.0.0/22172.16.0.0/22
図2 suppress-map で特定の個別経路だけ広告を止める

まとめ

設定R2 に広告する経路
aggregate-address(オプションなし)集約経路と、すべての個別経路
aggregate-address … summary-only集約経路だけ
aggregate-address … suppress-map集約経路と、suppress-map で指定しなかった個別経路

suppress-map は特定の経路の広告を止め、unsuppress-map は summary-only で止めた経路のうち特定の経路だけを広告します。目的に合わせて使い分けます。

コメント