本文共 3182 字,大约阅读时间需要 10 分钟。
【实验要求】
在 AS1 中配置 BGP MED 值,
确保R3上由155.1.37.0/24 网络到155.1.5.0 网络的流量走R1
interface FastEthernet0/0
ip address 155.1.146.1 255.255.255.0
ip address 155.1.13.1 255.255.255.0
neighbor 155.1.13.3 remote-as 2
neighbor 155.1.13.3 next-hop-self
neighbor 155.1.146.4 remote-as 1
ip address 155.1.13.3 255.255.255.0
ip address 155.1.0.3 255.255.255.0
encapsulation frame-relay
frame-relay map ip 155.1.0.5 305 broadcast
no frame-relay inverse-arp
ip add 155.1.37.3 255.255.255.0 network 155.1.37.0 mask 255.255.255.0
neighbor 155.1.0.5 remote-as 1
neighbor 155.1.13.1 remote-as 2
neighbor 155.1.13.1 next-hop-self
interface FastEthernet0/0
ip address 155.1.146.4 255.255.255.0
ip address 155.1.45.4 255.255.255.0
neighbor 155.1.45.5 remote-as 1
neighbor 155.1.45.5 next-hop-self
neighbor 155.1.146.1 remote-as 2
ip address 155.1.0.5 255.255.255.0
encapsulation frame-relay
frame-relay map ip 155.1.0.3 503 broadcast
no frame-relay inverse-arp
ip address 155.1.5.5 255.255.255.0 ip address 155.1.45.5 255.255.255.0
network 155.1.5.0 mask 255.255.255.0
neighbor 155.1.0.3 remote-as 2
neighbor 155.1.45.4 remote-as 1
neighbor 155.1.45.4 next-hop-self
BGP table version is 3, local router ID is 155.1.37.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 155.1.5.0/24 155.1.0.5 0 0 1 i * i 155.1.13.1 0 100 0 1 i
*> 155.1.37.0/24 0.0.0.0 0 32768 i
在未配置weight时R3的bgp路由表,我们发现到达155.1.5.0 的网络下一跳为155.1.0.5,为什么呢?我们回顾一下BGP选路原则, 是不是比较到7步就比较出来了 1.权重:Prefer highest weight (local to router). 2.优先级:Prefer highest local preference (global within AS). 3.起源于本地:Prefer route originated by the local router (next hop = 0.0.0.0). 4.最短AS路径:Prefer shortest AS path. 5.最低的起源属性:Prefer lowest origin code (IGP < EGP < incomplete). 6.最低的MED:Prefer lowest MED. 7.EBGP优于IBGP:Prefer EBGP path over IBGP path. 8.最近的IGP邻居:Prefer the path through the closest IGP neighbor. 9.生存最长的路由:Prefer oldest route for EBGP paths. 10.最低的router-id:Prefer the path with the lowest neighbor BGP router ID. 11.最低的IP地址:Prefer the path with the lowest neighbor IP address. neighbor 155.1.146.1 route-map MED out neighbor 155.1.0.3 route-map MED out R3#show ip bgp 下面验证了配置是正确的,BGP选择metric(MED)更小的路由。 BGP table version is 5, local router ID is 155.1.37.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i155.1.5.0/24 155.1.13.1 100 100 0 1 i
*> 155.1.37.0/24 0.0.0.0 0 32768 i
本文转自zcm8483 51CTO博客,原文链接:http://blog.51cto.com/haolun/992842
转载地址:http://bvhea.baihongyu.com/