bgp bestpath med missing-as-worst

BGP路由决择6(MED)

bgp bestpath med missing-as-worst

IOS Version 12.4(13b)

默认情况下,Cisco路由器BGP设置没有的MED值为0

相应配置如下:

R4

router bgp 4

no synchronization

bgp log-neighbor-changes

network 4.4.4.4 mask 255.255.255.255

neighbor 14.0.0.1 remote-as 1

neighbor 34.0.0.3 remote-as 3

no auto-summary

R1

router bgp 1

no synchronization

bgp router-id 1.1.1.1

bgp log-neighbor-changes

neighbor 12.0.0.2 remote-as 2

neighbor 12.0.0.2 route-map xx out

neighbor 14.0.0.4 remote-as 4

no auto-summary

neighbor  12.0.0.2 route-map xx out

route-map xx  permit 10

match ip address 1

set metric 20

access-list 1  permit 4.4.4.4

R3

router bgp 3

no synchronization

bgp router-id 3.3.3.3

bgp log-neighbor-changes

neighbor 23.0.0.2 remote-as 2

neighbor 34.0.0.4 remote-as 4

no auto-summary

R2

router bgp 2

no synchronization

bgp always-compare-med

bgp log-neighbor-changes

bgp bestpath as-path ignore

neighbor 12.0.0.1 remote-as 1

neighbor 23.0.0.3 remote-as 3

no auto-summary

路由器R2正在接收路由器R1R3对网络4.4.4.4/32的广播

R2#show ip bgp 

BGP table  version is 12, 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

Origin codes: i  - IGP, e - EGP, ? - incomplete

Network                        Next Hop                     Metric       LocPrf          Weight        Path

*4.4.4.4/32                   12.0.0.1                       20                                         0              1 4 i

*>23.0.0.3                                                                                                       0               3 4 i

最好的路径选择算法已经选择了从路由器R3来的路由作为最好的路由,因为我们比较了它们的MED,路由器R1没有发送网络4.4.4.4/32MED值。默认情况下,BGP设置从路由器R3来的前缀MED值为0

现在,修改路由器R2上的BGP配置,把没有的MED(注意是没有,不是为”0”)值当作无穷大:

R2

router bgp 2

bgp bestpath med missing-as-worst

证实

进一步证实最好路径选择算法已经选择了从路由器R1来的路由作为最好的路由,因为它有更低的MED

R2

R2#show ip bgp

BGP table  version is 2, 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

Origin codes: i  - IGP, e - EGP, ? - incomplete

Network               Next Hop             Metric         LocPrf      Weight       Path

*> 4.4.4.4/32       12.0.0.1                20                                          0          1 4 i

*23.0.0.3                             4294967295                                        0          3 4 i

 

你可能感兴趣的:(Cisco,路由器,BGP,MED)