【BGP】MED属性 動作確認 Cisco

スポンサーリンク

MED属性とは

 MULTI_EXIT_DISC(MED)はメトリックとも呼ばれ、自ASへのインバウンドトラフィックに対して、複数のパスの中からどのパスを選択させるかを隣接ASルータにメトリック値として通知します。 MEDは小さい値のルートの方が優先されます。 ネイバーAS内のすべてのルータに伝播されますが、他の自律システムには伝播されません。

スポンサーリンク

検証

構成と設定

 R2とR3にループバックで同じプレフィックス23.23.23.23/32をR6にアドバタイズします。 MEDは自律システム間で交換され、それを使用して、AS23へ入るときのパスをAS6にメトリックとして通知します。R2は200のMEDとしてAS6に通知し、R3は100のMEDとしてA6に通知します。AS6はより低いメトリックを優先し、AS23のすべてのトラフィックをR3に送信します。

R2(config)# int loopback 23
R2(config-if)# ip add 23.23.23.23 255.255.255.255
!
R2(config)# router bgp 23
R2(config-router)# neighbor 192.168.26.6 remote-as 6
R2(config-router)# network 23.23.23.23 mask 255.255.255.255
R3(config)# int loopback 23
R3(config-if)# ip add 23.23.23.23 255.255.255.255
!
R3(config)# router bgp 23
R3(config-router)# neighbor 192.168.36.6 remote-as 6
R3(config-router)# network 23.23.23.23 mask 255.255.255.255
R6(config)# router bgp 6
R6(config-router)# neighbor 192.168.26.2 remote-as 23
R6(config-router)# neighbor 192.168.36.3 remote-as 23

 MEDの設定はまだしていません。R6のBGPテーブルを確認します。ルータIDの小さいR2をベストパスとして認識しています。

R6# show ip bgp
BGP table version is 2, local router ID is 6.6.6.6
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
 *   23.23.23.23/32   192.168.36.3             0             0 23 i
 *>                            192.168.26.2             0             0 23 i

 デフォルトのMEDの値は0です。

MEDの変更

 そこで、R2はMEDを200として、AS6へ通知、R3はMEDを100としてAS6に通知し、R3がベストパスになることを確認します。

R2(config)# route-map SETMED permit 10
R2(config-route-map)# set metric 200

R2(config)# router bgp 23
R2(config-router)# neighbor 192.168.26.6 route-map SETMED out
R3(config)# route-map SETMED permit 10
R3(config-route-map)# set metric 100

R3(config)# router bgp 23
R3(config-router)# neighbor 192.168.36.6 route-map SETMED out

 BGPプロセスをクリアして、R6のBGPテーブルを確認します。

R6# show ip bgp
BGP table version is 4, local router ID is 6.6.6.6
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
 *>  23.23.23.23/32   192.168.36.3           100             0 23 i
 *                                192.168.26.2           200             0 23 i
R6# show ip bgp 23.23.23.23
BGP routing table entry for 23.23.23.23/32, version 4
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     2         
  23
    192.168.36.3 from 192.168.36.3 (3.3.3.3)
      Origin IGP, metric 100, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
  23
    192.168.26.2 from 192.168.26.2 (2.2.2.2)
      Origin IGP, metric 200, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0

 メトリック値が変更され、R3からのルートがベストパスになっていることが確認できます。

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

コメント