配置静态路由时, 若路由下一跳所在设备跟本设备直连的,则当线路中断时,本端端口会down掉,路由会失效,其它等价或浮动路由会自动切换。
若路由的下一条所在设备跟本设备并非直连的(中间有经过其它交换机二层透传),则当非直连的线路中断时,本端端口仍然是up的,路由不会失效,即使有配置等价或浮动路由,也会出现网络问题。此时可以通过静态路由关联track来解决。
例如华为华三的nqa,思科的sla,锐捷的rns,相关配置如下。
HUAWEI
nqa test-instance xxx xxx
test-type icmp
destination-address ipv4 x.x.x.x
source-address ipv4 x.x.x.x
probe-failtimes 5
timeout 1
frequency 10
start now
H3C
nqa entry admin xxx
type icmp-echo
destination ip x.x.x.x
frequency 500
reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only
source ip x.x.x.x
track 1 nqa entry admin xxx reaction 1
nqa schedule admin xxx start-time now lifetime forever
CISCO
ip sla 1
icmp-echo x.x.x.x source-ip x.x.x.x
threshold 10
timeout 1000
frequency 3
ip sla schedule 1 life forever start-time now
track 1 ip sla 1 reachability
RUIJIE
ip rns 1
icmp-echo x.x.x.x source-ipaddr x.x.x.x
threshold 10
timeout 500
frequency 1000
ip rns schedule 1 start-time now life forever
ip rns reaction-configuration 1 react allfail action-type Track
track 1 rns 1
此外,track 关联bfd也可以解决此类问题,以H3C为例
bfd echo-source-ip 192.168.1.1(随便配置,可以是不存在的地址,探测源地址以track里的为准)
track 1 bfd echo interface Vlan-interface100 remote ip 172.16.1.1 local ip 172.16.1.2