【BGP】経路集約(aggregate-address、summary-only)

 BGPでは、複数の経路情報を集約することができます。コマンドはaggregate-addressを使用します。

aggregate-addressで指定する集約後のルート情報を広告するには、集約前の経路情報が少なくとも一つがBGPテーブルに存在する必要があります。

 R1に4つのループバックアドレスを設定し、networkコマンドを設定します。これからの経路をaggregate-addressコマンドで集約して、R2に広告します。まず、集約前の基本設定をします。

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(config)# router bgp 2
R2(config-router)#  neighbor 192.168.12.1 remote-as 1

R2のBGPテーブルを確認すると、R1の4つのループバックへの経路が確認できます。

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となります。

 では、R1でaggregate-addressコマンドにより172.16.0.0/22を設定します。オプションを何もつけないと、集約ルートに加えて、集約前のルートも広告されます。以下の記事を参照してください。

集約ルートのみを広告する場合は、オプションとしてsummary-onlyをつけます。

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が登録されています。 また、集約前の個別ルートの個別ルートが s(suppressed) として抑制されています。

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# 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のみ広告されていることが確認できます。

 R2のBGPテーブルを確認しても集約ルート(172.16.0.0/22)のみであることが確認できます。

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

summary-onlyオプションを使用すると、全ての集約前プレフィックスが抑制されます。特定のプレフィックスのみ抑制したい場合は、追加でsuppress-mapを使用します。

その他 BGP関連記事は   >>  ルーティングプロトコル(BGP)まとめ << より参照できます。

コメント