如上图,XRV1的loopback0地址为10.255.255.1/32,XRV5的loopback0地址为10.255.255.5/32,整个网络环境运行OSPF协议,默认XRV1到XRV5路由负载,采用PBR后,强制让走XRV2-XRV4的链路,为保证XRV2-XRV4的链路故障后走XRV2-XRV3的链路,配置如下:
NQA配置:
# nqa entry pbr pbr type icmp-echo destination ip 10.185.2.2 frequency 5 reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only # nqa schedule pbr pbr start-time now lifetime forever #
PBR配置:
# acl advanced 3000 rule 0 permit ip source 10.255.255.1 0 destination 10.255.255.5 0 #
policy-based-route pbr permit node 10
if-match acl 3000
apply next-hop 10.185.2.2 track 1
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.201.1.2 255.255.255.252
ospf network-type p2p
ip policy-based-route pbr
#
测试如下:
1)未调用策略路由时访问路径
2)调用策略路由时访问路径
3)模拟XRV2-XRV4的链路故障