配置命令如下
- [AR6]ip route-static 0.0.0.0 0 100.1.1.2
- [AR6-ospf-1]default-route-advertise type 1
- [AR7]ip route-static 0.0.0.0 0 200.1.1.2 preference 200
- [AR7-ospf-1]default-route-advertise permit-calculate-other type 2
由于ospf防环机制所以需在AR7上配置permit-calculate-other
让其AR7计算AR6的缺省,不让AR6计算AR7的缺省,
且AR6的路由优先级为150而AR7的为200 所以AR6的加表
<AR7>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 O_ASE 150 2 D 67.1.1.6 GigabitEthernet
BFD主备切换
[AR6]bfd
[AR6]bfd 1 bind peer-ip 100.1.1.2 interface GigabitEthernet 0/0/2 one-arm-echo
[AR6-bfd-session-1]discriminator local 10
[AR6-bfd-session-1]detect-multiplier 4
[AR6-bfd-session-1]min-echo-rx-interval 1001
[AR6-bfd-session-1]commit
[AR6-bfd-session-1]q
[AR6]ip route-static 0.0.0.0 0 100.1.1.2 track bfd-session 1
当BFD检测到100.1.1.2故障或链路故障时使之静态路由时效,而ospf缺省未加always因此缺省失效
从而达到网络中只有1个缺省,则AR6计算AR7的缺省进行加表,备用路线切换成功