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

 前回の記事の続きとして、ルータで集約ルートにBGPコミュニティを付与し、ネイバーへ広告します。それをattribute-mapでどのように設定するのかを確認します。

 基本設定など、前回の記事は以下を参照してください。

 以下の構成で、R1が生成する集約ルートに対して、特定のコミュニティ値(今回は1:1)を割り当て、R2に広告します。

 まず、ip bgp-community new-format でコミュニティのフォーマットを2バイト:2バイト表記に変更します。

R1(config)# ip bgp-community new-format

 次にコミュニティ値を設定するルートマップを作成します。

R1(config)# route-map SET-COMMUNITY-1:1 permit 10
R1(config-route-map)# set community 1:1

 集約ルートにコミュニティを付与し、R2に広告するには、 aggregate-addressコマンドのオプションであるattribute-mapを使用し、上で設定したルートマップを指定します。

R2にコミュニティを広告するため、neighborコマンドでsend-communityを忘れずに設定します。

R1(config)# router bgp 1
R1(config-router)# aggregate-address 172.16.0.0 255.255.252.0 summary-only attribute-map SET-COMMUNITY-1:1
R1(config-router)# neighbor 192.168.12.2 send-community

 R1のBGPテーブルを確認すると、172.16.0.0/22にコミュニティとして1:1が付与されています。

R1# show ip bgp 172.16.0.0 255.255.252.0
BGP routing table entry for 172.16.0.0/22, version 38
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     4         
  Refresh Epoch 1
  Local, (aggregated by 1 172.16.3.1)
    0.0.0.0 from 0.0.0.0 (172.16.3.1)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best
      Community: 1:1

 R2で集約ルートにコミュニティが付与されているか確認します。確認する前に、R2のコミュニティのフォーマットを変更します。

R2(config)# ip bgp-community new-format

 R2のBGPテーブルを見ると、集約ルートのみ学習されていることがわかります。

R2# show ip bgp
BGP table version is 46, 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
R2# show ip bgp 172.16.0.0 255.255.252.0
BGP routing table entry for 172.16.0.0/22, version 46
Paths: (1 available, best #1, table default)
  Advertised to update-groups:
     1         
  Refresh Epoch 2
  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
      Community: 1:1

R2の集約ルートの詳細を確認すると、コミュニティ1:1が付与されています。

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

コメント