HCIP-BGP路由选路

  |   0 评论   |   0 浏览

image.png

1.修改优选协议首选值(PrefVal)本地有效(不穿邻居),默认为0,越大越优先

[R6]acl 2011
[R6-acl-basic-2011]rule permit source 10.1.11.1 0.0.0.0
[R6]acl 2001
[R6-acl-basic-2001]rule permit source 10.1.1.0 0.0.0.255
[R6]route-policy Pre_Val permit node 10  
[R6-route-policy]if-match acl 2011     匹配ACL 2011  其他默认deny
[R6-route-policy]apply preferred-value 20
[R6]route-policy Pre_Val2 permit node 10
[R6-route-policy]if-match acl 2001
[R6-route-policy]apply preferred-value 15
[R6]route-policy Pre_Val permit node 20        放行其他路由
[R6]route-policy Pre_Val2 permit node 20
[R6]bgp 200
[R6-bgp]peer 200.1.26.2 route-policy Pre_Val import
[R6-bgp]peer 200.1.36.3 route-policy Pre_Val2 import

image.png

image.png

image.png
2.优选本地优先级(Local_Pref),默认优先级为100,只在IBGP邻居间有效。它表明路由的BGP优先级,用于判断流量离开AS时的最佳路由。

[R7]acl 2000
[R7-acl-basic-2000]rule permit source 10.1.1.1 0.0.0.0
[R7]route-policy local_pre permit node 10
[R7-route-policy]if-match acl 2000
[R7-route-policy]apply local-preference 200
[R7]route-policy local_pre permit node 20
[R7-bgp]peer 200.1.37.3 route-policy local_pre import

image.png
3.修改AS路径(AS_Path)

[R2]ip ip-prefix 11 permit 10.1.11.1 32 greater-equal 32 less-equal 32
[R2]route-policy as_path permit node 10
[R2-route-policy]if-match ip-prefix 11
[R2-route-policy]apply as-path 100 110 800 additive 
[R2]route-policy as_path permit node 20
[R2-bgp]peer 200.1.27.7 route-policy as_path export

image.png
4.修改MED值,默认值为0,越小越优先