BGP経路集約(aggregate-address、summary-only)の設定を解説 Ciscoルータ

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

注意

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

この記事でわかること
  1. 集約する前の個別経路を広告する
  2. オプションなしの aggregate-address では、集約経路と個別経路の両方を広告する
  3. summary-only を付けると、集約経路だけを広告する

検証構成

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

AS 1 AS 2 R1 R2 .1 .2 192.168.12.0/24 集約経路 172.16.0.0/22 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 です。3 オクテット目の 0〜3 は、2 進数で下位 2 ビットだけが違うので、プレフィックス長を 24 から 2 減らした /22 でまとめられます。

オプションなしで集約する

R1 で、aggregate-address にオプションを付けずに 172.16.0.0/22 を設定します。

R1

R1(config)# router bgp 1
R1(config-router)# aggregate-address 172.16.0.0 255.255.252.0

オプションを何も付けないと、集約経路 172.16.0.0/22 に加えて、集約する前の個別経路(4 つの /24)も R2 に広告されます。このときの BGP テーブルの様子は、次の記事で確認しています。

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

ポイント

集約経路だけを広告して、個別経路の広告を止めるには、aggregate-address に summary-only を付けます。

summary-only で集約経路だけを広告する

R1 で、aggregate-address に summary-only を付けて設定し直します。

R1

R1(config)# router bgp 1
R1(config-router)# aggregate-address 172.16.0.0 255.255.252.0 summary-only

R1 の BGP テーブルを確認すると、集約経路 172.16.0.0/22 ができ、4 つの個別経路すべてに s(suppressed:広告を止めている)が付いています。

R1

R1#show ip bgp
BGP table version is 10, 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 に広告している経路を確認します。

R1

R1# show ip bgp neighbors 192.168.12.2 advertised-routes 
BGP table version is 10, 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

Total number of prefixes 1
ポイント

R1 から R2 へは、集約経路 172.16.0.0/22 の 1 つだけを広告しています。s が付いた個別経路は、BGP テーブルには残っていますが、ネイバーには広告されません。

R2 の BGP テーブルを確認すると、集約経路 172.16.0.0/22 だけを学習しています。

R2

R2#show ip bgp
BGP table version is 10, 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.0.0/22172.16.0.0/24172.16.1.0/24172.16.2.0/24172.16.3.0/24集約経路と個別経路の 5 つを広告summary-only172.16.0.0/22172.16.0.0/24(広告しない)172.16.1.0/24(広告しない)172.16.2.0/24(広告しない)172.16.3.0/24(広告しない)集約経路だけを広告
図2 オプションなしと summary-only の違い
補足

summary-only は、集約の範囲に入る個別経路をすべて止めます。止める経路を一部だけにしたいときは、summary-only の代わりに suppress-map で止めたい経路を指定します。

>> 参考:【BGP】経路集約(aggregate-address、suppress-map)

まとめ

設定R2 に広告する経路
集約なし172.16.0.0/24〜172.16.3.0/24 の 4 つ
aggregate-address(オプションなし)集約経路と、すべての個別経路
aggregate-address … summary-only集約経路だけ

summary-only を付けると、ネイバーに広告する経路の数を減らせます。今回の例では、R2 が受け取る経路が 4 つから 1 つになりました。

コメント