【實驗要求】RouterA通過配置靜态路由,經由RouterB與外部相連,其中RouterA與RouterB之間通過二層交換機SwitchC互連。現要求RouterA能正常通路外部網絡,且要在RouterA和RouterB之間實作毫秒級故障感覺,提高收斂速度。
【Router-A配置】
interface GigabitEthernet1/0/0
ip address 1.1.1.1 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.1.1 255.255.255.0
#
bfd aa bind peer-ip 1.1.1.2
discriminator local 10
discriminator remote 20
commit
#
ip route-static 0.0.0.0 0.0.0.0 1.1.1.2 track bfd-session aa
#
【Router-B配置】
interface GigabitEthernet1/0/0
ip address 1.1.1.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 2.2.2.2 255.255.255.0
#
bfd bb bind peer-ip 1.1.1.1
discriminator local 20
discriminator remote 10
commit
#
ip route-static 192.168.1.0 255.255.255.0 1.1.1.1
#
【驗證結果】
l 在RouterA和RouterB上執行display bfd session all
<Router-A>display bfd session all
---------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
---------------------------------------------------------------------
10 20 1.1.1.2 Up S_IP_PEER -
---------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
<Router-B>display bfd session all
---------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
---------------------------------------------------------------------
20 10 1.1.1.1 Up S_IP_PEER -
---------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
l 路由驗證
[Router-A]display ip routing-table | exclude 127.0.0.1
Route Flags: R - relay, D - download to fib
---------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 1.1.1.2 GigabitEthernet1/0/0
1.1.1.0/24 Direct 0 0 D 1.1.1.1 GigabitEthernet1/0/0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet2/0/0
對RouterB的GE1/0/0接口執行shutdown指令模拟鍊路故障。然後檢視RouterA的路由表,發現除了直連路由,靜态預設路由不存在了。
<Router-A>display ip routing-table | exclude 127.0.0.1
Route Flags: R - relay, D - download to fib
---------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 GigabitEthernet1/0/0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet2/0/0