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

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

集約ルートを広告し、かつ、集約前の特定ルートを抑制するには、aggregate-addressコマンドのオプションのsupress-mapで抑制したい特定のルート情報を指定します。

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

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

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

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

 ルートマップをsuppress-mapとして指定します。

R1(config)# router bgp 1
R1(config-router)# aggregate-address 172.16.0.0 255.255.252.0 suppress-map SUPRESS-MAP

 R1のBGPテーブルを確認すると、集約前ルートは172.16.1.0/24のみs(suppressed)と表記されて、抑制されていることがわかります。

R1#show ip bgp 
BGP table version is 15, 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/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
 *>  172.16.2.0/24    0.0.0.0                  0         32768 i
 *>  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 15, 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/24    0.0.0.0                  0         32768 i
 *>  172.16.0.0/22    0.0.0.0                            32768 i
 *>  172.16.2.0/24    0.0.0.0                  0         32768 i
 *>  172.16.3.0/24    0.0.0.0                  0         32768 i

Total number of prefixes 4

実際に、R1がR2に広告するルートに172.16.1.0/24が含まれていないことが確認できます。

R2のBGPテーブルを確認します。

R2# show ip bgp 
BGP table version is 13, 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.2.0/24    192.168.12.1             0             0 1 i
 *>  172.16.3.0/24    192.168.12.1             0             0 1 I

R2のBGPテーブルを確認すると、172.16.1.0/24が含まれていないことが確認できます。

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

コメント