BGP属性:MED、 METRIC属性 |
您所在的位置:网站首页 › igp协议的作用范围 › BGP属性:MED、 METRIC属性 |
BGP属性:MED、 METRIC属性 也就是常说的BGP METRIC,这个METRIC跟IGP的度量值不一样。IGP是用来计算最短路径,BGP是用来影响对端邻居AS对自己AS的选路(假设两个AS之间有多个入口)。 MED值是可选非传递的,能在对端的AS内传播,但不能夸AS传播。 MED的取值范围是0~4294967295(32位),CISCO默认均为0。 做route-map修改指定路由的MED值 route-map MED permit 10 match ip address prefix-list 33 set metric 100 route-map MED permit 20在BGP进程中,对指定邻居调用route-map neighbor 14.1.1.1 route-map MED out如果BGP路由接收到来自不同AS关于一条路由的MED值,默认情况下,是不会去比较大小的,只有来自同一个AS的MED才会去比较;但假如要强制比较,可以使用R1(config-router)#bgp always-compare-med 另外,有一条兼容性的命令 R1(config-router)bgp bestpath med missing-as-worst如果从邻居收到一条BGP路由,没有携带MED值,CISCO默认将它置为0,也可以使用这条命令将其置为4294967294(32位全1) MED属性是BGP路由的metric,MED在AS之间交换,AS使用本地优先级属性来影响自己的出站选择,而用MED来影响另一个AS的出站选择。与其他路由协议的metric相同,MED值越小,优先级越高。 在本实验中,R1在将1.1.1.0网段通告给R2时,将MED属性设置为100,而通告给R3时,将MED设置为50,这样,AS 200中的路由器会选择从R3到达1.1.1.0网络。 在R1中的配置如下: access-list 1 permit 1.1.1.0 0.0.0.255 ! route-map med2 permit 10 match ip address 1 set metric 100 ! route-map med2 permit 20 set metric ! route-map med permit 10 match ip address 1 set metric 50 route-map med permit 20 set metric router bgp 100 no synchronization bgp log-neighbor-changes network 1.1.1.0 mask 255.255.255.0 network 2.2.2.0 mask 255.255.255.0 neighbor 12.1.1.2 remote-as 200 neighbor 12.1.1.2 route-map med2 out neighbor 13.1.1.2 remote-as 200 neighbor 13.1.1.2 route-map med out no auto-summary经过如上的配置后,使用 clear ip bgp *重新建立BGP邻居间的TCP连接,之后,在R2和R3上分别查看BGP路由表的结果如下: R2#show ip bgp BGP table version is 4, local router ID is 24.1.1.1 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 *> 1.1.1.0/24 12.1.1.1 100 0 100 i *>i5.5.5.0/24 45.1.1.2 0 100 0 300 i R3#show ip bgp BGP table version is 14, local router ID is 34.1.1.1 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 *> 1.1.1.0/24 13.1.1.1 50 0 100 i *>i5.5.5.0/24 45.1.1.2 0 100 0 300 i在R4上查看路由表,可见R4访问1.1.1.0网段的下一跳是13.1.1.1,也就是R3,metric为50: B 1.1.1.0 [200/50] via 13.1.1.1, 00:10:28 但MED属性的值并不继续向其他的AS传递,此时,在AS 300中的R5上查看路由表1.1.1.0的metric为0: B 1.1.1.0 [20/0] via 45.1.1.1, 00:00:58 var code = “b97711f8-2975-44d1-97b9-6fc342ed65a9” |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |