核心思想更改cost值达到改变最优路径
使用策略路由进行双向重发布(经典面试题)
AR2
步骤1:用前缀列表,来选择各个路由条目
ip ip-prefix shengchan-zhuji permit 192.168.10.0 24
ip ip-prefix bangong-zhuji permit 192.168.20.0 24
ip ip-prefix shengchan-fwq permit 100.0.0.1 32
ip ip-prefix bangong-fwq permit 200.0.0.1 32
步骤2:用路由策略,给不同的路由条目,设置不同的cost,影响优先级
route-policy 100-to-10 permit node 10
if-match ip-prefix shengchan-fwq
apply cost 1000
route-policy 100-to-10 permit node 20
if-match ip-prefix bangong-fwq
apply cost 2000
route-policy 10-to-100 permit mode 10
if-match ip-prefix shengchan-zhuji
apply cost 1000
route-policy 10-to-100permit node 20
if-match ip-prefix bangong-zhuji
apply cost 2000
步骤3:把ospf 100的路由,引入ospf 10,调用刚才做好的路由策略
ospf 10
import-route ospf 100 route-policy 100-to-10
ospf 100
import-route ospf 10 route-policy 10-to-100
AR3
步骤1:用前缀列表,来选择各个路由条目
ip ip-prefix shengchan-zhuji permit 192.168.10.0 24
ip ip-prefix bangong-zhuji permit 192.168.20.0 24
ip ip-prefix shengchan-fwq permit 100.0.0.1 32
ip ip-prefix bangong-fwq permit 200.0.0.1 32
步骤2:用路由策略,给不同的路由条目,设置不同的cost,影响优先级
route-policy 100-t0-10 permit node 10
if-match ip-prefix shengchan-fwq
apply cost 2000
route-policy 100-to-10 permit node 20
if-match ip-prefix bangong-fwq
apply cost 1000
route-policy 10-to-100 permit node 10
if-match ip-prefix shengchan-zhuji
apply cost 2000
route-policy 10-to-100 permit node 20
if-match ip-prefix bangong-zhuji
apply cost 1000
步骤3:把ospf 100的路由,引入ospf 10,调用刚才做好的路由策略
ospf 10
import-route ospf 100 route-policy 100-to-10
ospf 100
import-route ospf 10 route-policy 10-to-100