2、修改local preference改变选路
默认情况下R4的bgp表中:
R4#sh ip bgp
BGP table version is 2, local router ID is 44.44.44.44
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 34.1.1.3 0 23 1 i
*> 24.1.1.2 0 23 1 i
修改local_preference改变选路
R4:
R4(config)#ip prefix-list 1 per 1.1.1.0/24
R4(config)#route-map local-pref per 10
R4(config-route-map)#mat ip add prefix-list 1
R4(config-route-map)#set local-preference 200
R4(config)#router bgp 4
R4(config-router)#nei 34.1.1.3 route-map local-pref in
R4 BGP表:
R4#sh ip bgp
BGP table version is 3, local router ID is 44.44.44.44
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 24.1.1.2 0 23 1 i
*> 34.1.1.3 200 0 23 1 i
如果在此基础上我们修改R2过来路由的weight,来比较weight和local-preference的优先级
R4:
R4(config)#ip prefix-list 2 per 1.1.1.0/24
R4(config)#route-map weight per 20
R4(config-route-map)#mat ip add prefix-list 2
R4(config-route-map)#set weight 100
R4(config)#router bgp 4
R4(config-router)#nei 24.1.1.2 route-map weight in
BGP表:
R4#sh ip bgp
BGP table version is 2, local router ID is 44.44.44.44
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 34.1.1.3 200 0 23 1 i
*> 24.1.1.2 100 23 1 i
Weight的优先级确实比local-preference高。
转载于:https://blog.51cto.com/dirphtay/531732
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/110638.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...