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

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

aggregate-addressで指定する集約後のルート情報を広告するには、集約前の経路情報が少なくとも一つが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として定義し、ネイバー設定へ適用します。

 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を設定します。オプションを何もつけないと、集約ルートに加えて、集約前のルートも広告されます。以下の記事を参照してください。

全てのプレフィックスの集約ルートと特定のプレフィックだけ、広告したい場合は、unsupress-mapを使います。

まず、特定ルート(172.16.1.0/24)をプレフィックスリストで設定します。

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

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

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

 aggregate-addressコマンドのsummary-onlyオプションを指定し、集約ルートのみを送信する設定をします。そして、ネイバー単位にunsuppress-mapで、抑制しない集約前ルートを指定します。

unsuppress-mapは、neighborコマンドのオプションとして指定します。

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# 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# 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# 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

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

コメント