【BGP】AS-PATH属性 動作確認 Cisco

スポンサーリンク

AS-PATH属性とは

 あるプレフィックスに到達するために通過すべきAS番号の順序付きリストです。宛先に到達するために最短のASパスの経路を優先します。ASパスを設定により付加(プリペンド)することで、AS-PATHを長く見せ、経路を操作することができます。

スポンサーリンク

検証

構成と設定

 R2とR3にループバックで同じプレフィックス23.23.23.23/32を設定し、R6にアドバタイズします。 ここで、R2のAS-PATHをプリペンドして、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)# bgp router-id 2.2.2.2
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)# bgp router-id 3.3.3.3
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

確認

 R6のBGPテーブルを確認します。R2とR3ともにAS-PATHは 23 を経由していることがわかります。

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

 R2とR3で全ての属性値が同じのため、ルータIDの小さいR2(2.2.2.2)をベストパスとして認識しています。

ASプリペンド

 では、R2で、AS-PATHを付加して、R3の方をベストパスにしてみます。R2でAS1から5までを追加(プリペンド)してみます。

R2(config)# route-map ASPREPEND permit 10
R2(config-route-map)# set as-path prepend 1 2 3 4 5

R2(config)# router bgp 23
R2(config-router)# neighbor 192.168.26.6 route-map ASPREPEND out

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

R6# show ip bgp 23.23.23.23
BGP routing table entry for 23.23.23.23/32, version 3
Paths: (2 available, best #1, table default)
  Advertised to update-groups:
     1         
  23
    192.168.36.3 from 192.168.36.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0
  23 1 2 3 4 5
    192.168.26.2 from 192.168.26.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0

 R2の方のルートではAS1〜5が追加されています。AS番号は左から順番に自身より近い番号となります。 そのため、R2はまず、AS1〜AS5を追加して、それからAS23を追加して、AS6へ送信しています。 R3よりR2からのルートの方が、AS-PATHが長いため、R3からのルートをベストパスとして認識します。

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

コメント