BGP MEDの設定





条件
R1,R2,R3 を AS123, R4 を AS400、R1-R4,R2-R4 をEBGP としてネイバーにします。
R4 の Lo100 に 44.44.44.44/24 を設定し AS400 へ広報します。
R3 から 44.44.44.0 へアクセスするために R1 or R2 を通りますが、どちらの経路を優先させるか
を MED にて設定したいと思います。(R2 を通るようにしたいと思います。)


R1
interface f0/1
ip add 14.14.14.1 255.255.255.0
no shut

interface f0/0
ip add 13.13.13.1 255.255.255.0
no shut

interface lo0
ip add 1.1.1.1 255.255.255.255

router bgp 123
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 next-hop-self
neighbor 14.14.14.4 remote-as 400

ip route 2.2.2.2 255.255.255.255 13.13.13.3
ip route 3.3.3.3 255.255.255.255 13.13.13.3
ip route 23.23.23.0 255.255.255.0 13.13.13.3

R2
interface f0/0
ip add 24.24.24.2 255.255.255.0
no shut

interface f0/1
ip add 23.23.23.2 255.255.255.0
no shut

interface lo0
ip add 2.2.2.2 255.255.255.255

router bgp 123
neighbor 3.3.3.3 remote-as 123
neighbor 3.3.3.3 update-source lo0
neighbor 3.3.3.3 next-hop-self
neighbor 24.24.24.4 remote-as 400

ip route 1.1.1.1 255.255.255.255 23.23.23.3
ip route 3.3.3.3 255.255.255.255 23.23.23.3
ip route 23.23.23.0 255.255.255.0 23.23.23.3

R3
interface f0/0
ip add 23.23.23.3 255.255.255.0
no shut

interface f0/1
ip add 13.13.13.3 255.255.255.0
no shut

interface lo0
ip add 3.3.3.3 255.255.255.255

router bgp 123
neighbor 1.1.1.1 remote-as 123
neighbor 1.1.1.1 update-source lo0
neighbor 2.2.2.2 remote-as 123
neighbor 2.2.2.2 update-source lo0
network 13.13.13.0 mask 255.255.255.0
network 23.23.23.0 mask 255.255.255.0
network 33.33.33.0 mask 255.255.255.0

ip route 1.1.1.1 255.255.255.255 13.13.13.1
ip route 2.2.2.2 255.255.255.255 23.23.23.2

R4
interface f0/0
ip add 14.14.14.4 255.255.255.0
no shut

interface f0/1
ip add 24.24.24.4 255.255.255.0
no shut

interface lo100
ip add 44.44.44.44 255.255.255.0

router bgp 400
neighbor 14.14.14.1 remote-as 123
neighbor 24.24.24.2 remote-as 123
network 14.14.14.0 mask 255.255.255.0
network 24.24.24.0 mask 255.255.255.0
network 44.44.44.0 mask 255.255.255.0



上記設定でAS123 と AS400 がネイバーになりました。
R4 にて sh ip bgp を見てみます。

R3#sh ip bgp
BGP table version is 16, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 13.13.13.0/24    0.0.0.0                  0         32768 i
*>i14.14.14.0/24    1.1.1.1                  0    100      0 400 i
* i                 2.2.2.2                  0    100      0 400 i
*> 23.23.23.0/24    0.0.0.0                  0         32768 i
*>i24.24.24.0/24    1.1.1.1                  0    100      0 400 i
* i                 2.2.2.2                  0    100      0 400 i

* i44.44.44.0/24    2.2.2.2                  0    100      0 400 i
*>i                 1.1.1.1                  0    100      0 400 i



44.44.44.0 へのルートは 1.1.1.1 経由と 2.2.2.2 経由があり、
経路選択の属性に違いがないことがわかります。
ではどちらの経路が使用されるかと言うと、、属性に違いがない場合
ルータIDの小さいピアを優先するとのことです。
ルータIDは sh ip bgp neighbor で確認してください。

参考:
http://atnetwork.info/ccnp1/bgp57.html

実際ルーティングを見てみます。


Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
S       1.1.1.1 [1/0] via 13.13.13.1
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 [1/0] via 23.23.23.2
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, FastEthernet0/0
     24.0.0.0/24 is subnetted, 1 subnets
B       24.24.24.0 [200/0] via 1.1.1.1, 00:02:29
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, FastEthernet0/1

     44.0.0.0/24 is subnetted, 1 subnets
B       44.44.44.0 [200/0] via 1.1.1.1, 00:02:00

     14.0.0.0/24 is subnetted, 1 subnets
B       14.14.14.0 [200/0] via 1.1.1.1, 00:02:30


ルータIDの小さいほうの 1.1.1.1 (R1) が選択されていることがわかりますね。
この経路を MED 属性を変更して 2.2.2.2 経由になるようにします。

デフォルトの MED は 0 となっており、小さい値が優先されます。
そのため R4 → R1 に広報されるMED値を上げて対応してみたい
と思います。

R4
access-list 1 permit 44.44.44.0 0.0.0.255

route-map MED permit 10
match ip address 1
set metric 100
route-map MED permit 20

router bgp 123
neighbor 14.14.14.1 route-map MED in

R4 から R1 へ ルートを広報する際、44.44.44.0 へのルートについては
MED を 100 に設定するというものです。
設定後 clear ip bgp * で BGPピアをリセットして再確立させます。

で、再度 sh ip bgp を見てみます。


R3#sh ip bgp
BGP table version is 17, local router ID is 33.33.33.33
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 13.13.13.0/24    0.0.0.0                  0         32768 i
* i14.14.14.0/24    2.2.2.2                  0    100      0 400 i
*>i                 1.1.1.1                  0    100      0 400 i
*> 23.23.23.0/24    0.0.0.0                  0         32768 i
* i24.24.24.0/24    2.2.2.2                  0    100      0 400 i
*>i                 1.1.1.1                  0    100      0 400 i

*>i44.44.44.0/24    2.2.2.2                  0    100      0 400 i
* i                 1.1.1.1                100    100      0 400 i




1.1.1.1 から来た 44.44.44.0 へのルート情報が Metric 100
となっていることがわかります。また sh ip route でも 2.2.2.2 経由が
優先されていることがわかります。


Gateway of last resort is not set

     1.0.0.0/32 is subnetted, 1 subnets
S       1.1.1.1 [1/0] via 13.13.13.1
     2.0.0.0/32 is subnetted, 1 subnets
S       2.2.2.2 [1/0] via 23.23.23.2
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.23.23.0 is directly connected, FastEthernet0/0
     24.0.0.0/24 is subnetted, 1 subnets
B       24.24.24.0 [200/0] via 1.1.1.1, 00:11:49
     13.0.0.0/24 is subnetted, 1 subnets
C       13.13.13.0 is directly connected, FastEthernet0/1

     44.0.0.0/24 is subnetted, 1 subnets
B       44.44.44.0 [200/0] via 2.2.2.2, 00:02:51

     14.0.0.0/24 is subnetted, 1 subnets
B       14.14.14.0 [200/0] via 1.1.1.1, 00:11:50




更新日:2013/4/25
TOPに戻る