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

 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を設定します。

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

 設定後、R2のBGPテーブルを確認すると、172.16.0.0/22が登録されています。

R2# show ip bgp   
BGP table version is 6, 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.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/22の詳細を確認します。

R2# show ip bgp 172.16.0.0 255.255.252.0
BGP routing table entry for 172.16.0.0/22, version 6
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  1, (aggregated by 1 172.16.3.1)
    192.168.12.1 from 192.168.12.1 (172.16.3.1)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best

集約されたルートのBGP属性値を確認しておく必要があります。特にatomic-aggregate属性が付与されていることを確認してください。これは、集約されたルートであることを示すフラグです。

aggregate-address でオプションを設定しないと、集約前の経路も合わせて広告されます。集約経路のみを配信する場合、summary-onlyオプションを追加する必要があります。

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

コメント