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

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

注意

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

たとえば、172.16.0.0/24〜172.16.3.0/24 の集約経路(172.16.0.0/22)を広告するときに、172.16.1.0/24 も一緒に広告したいとします。この場合、172.16.1.0/24 を unsuppress-map で指定し、ネイバーの設定に適用します。

この記事でわかること
  1. 集約する前の個別経路を広告する
  2. 一緒に広告したい経路を、ルートマップで指定する
  3. summary-only と unsuppress-map で、集約経路と特定の経路を広告する

検証構成

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

AS 1 AS 2 R1 R2 .1 .2 192.168.12.0/24 集約経路 + 個別経路 1 つ 172.16.0.0/22、172.16.1.0/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ルータ

ポイント

集約経路と、特定の個別経路だけを広告したいときは、summary-only ですべての個別経路の広告を止めたうえで、unsuppress-map で広告したい経路だけを戻します。

広告したい経路を指定する

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

R1

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

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

R1

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

summary-only と unsuppress-map を設定する

aggregate-address に summary-only を付けて、集約経路だけを送る設定にします。そして、ネイバーごとに unsuppress-map で、広告を止めない個別経路を指定します。

ポイント

unsuppress-map は、aggregate-address ではなく、neighbor コマンドのオプションとして指定します。そのため、ネイバーごとに広告する個別経路を変えられます。

R1

R1(config)# router bgp 1   
R1(config-router)#  aggregate-address 172.16.0.0 255.255.252.0 summary-only
R1(config-router)#  neighbor 192.168.12.2 unsuppress-map UNSUPRESS-MAP

R1 の BGP テーブルを確認すると、集約経路(172.16.0.0/22)以外には s(suppressed:広告を止めている)が付いています。

R1

R1# show ip bgp  
BGP table version is 20, 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
 s>  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
 s>  172.16.2.0/24    0.0.0.0                  0         32768 i
 s>  172.16.3.0/24    0.0.0.0                  0         32768 I

ただし、R1 から R2 に広告している経路を確認すると、集約経路(172.16.0.0/22)と一緒に、unsuppress-map で指定した 172.16.1.0/24 も広告しています。

R1

R1# show ip bgp neighbors 192.168.12.2 advertised-routes 
BGP table version is 20, 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/22    0.0.0.0                            32768 i
 s>  172.16.1.0/24    0.0.0.0                  0         32768 i

Total number of prefixes 2

R2 の BGP テーブルを確認すると、集約経路(172.16.0.0/22)と一緒に、172.16.1.0/24 も学習しています。

R2

R2# show ip bgp
BGP table version is 17, 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/22    192.168.12.1             0             0 1 i
 *>  172.16.1.0/24    192.168.12.1             0             0 1 I
R1 の BGP テーブルR2 に広告する経路s> 172.16.0.0/24広告しない(suppressed)s> 172.16.1.0/24unsuppress-map172.16.1.0/24s> 172.16.2.0/24広告しない(suppressed)s> 172.16.3.0/24広告しない(suppressed)*> 172.16.0.0/22172.16.0.0/22
図2 unsuppress-map で特定の個別経路だけを広告する

まとめ

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

コメント