浮动路由又称为路由备份
两条或多条链路组成浮动路由
相同的目的地址,不同的下一跳地址,另一条下一跳的优先级低
路由表的管理距离越低,优先级越高。浮动路由,举个简单的例子,比如将动态路由的管理距离优先级修改为低,手动添加的静态路由优先级修改为高。当动态路由出现问题时,原有的路由会失效,路由器会自动选择静态路由,保证网络不中断,实现冗余备份!
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router0
Router0(config)#int gi 0/0
Router0(config-if)#ip add 192.168.0.1 255.255.255.0
Router0(config-if)#no shut
Router0(config-if)#exit
Router0(config)#int se 0/1/0
Router0(config-if)#ip add 192.168.1.1 255.255.255.0
Router0(config-if)#clock rate 19200 #配置时钟速率为19200
Router0(config-if)#no shut
Router0(config-if)#exit
Router0(config)#int loopback0 #进入并开启loopback0
Router0(config-if)#ip add 1.1.1.1 255.255.255.0
Router0(config-if)#no shut
Router0(config-if)#exit
Router0(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2 130
#管理距离设置为130
Router0(config)#router rip
Router0(config-router)#version 2 #更改RIP版本
Router0(config-router)#no auto-summary
Router0(config-router)#network 1.0.0.0
Router0(config-router)#network 192.168.0.0
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#int gi 0/0
Router1(config-if)#ip add 192.168.0.2 255.255.255.0
Router1(config-if)#no shut
Router1(config-if)#exit
Router1(config)#int se 0/1/0
Router1(config-if)#ip add 192.168.1.2 255.255.255.0
Router1(config-if)#no shut
Router1(config-if)#exit
Router1(config)#int loopback0 #进入并开启loopback0
Router1(config-if)#ip add 2.2.2.2 255.255.255.0
Router1(config-if)#no shut
Router1(config-if)#exit
Router1(config)#ip route 1.1.1.0 255.255.255.0 192.168.1.1 130
#管理距离设置为130
Router1(config)#router rip
Router1(config-router)#version 2 #更改RIP版本
Router1(config-router)#no auto-summary
Router1(config-router)#network 192.168.0.0
Router1(config-router)#network 2.0.0.0
Router0#show ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0/24 [120/1] via 192.168.0.2, 00:00:27, GigabitEthernet0/0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, GigabitEthernet0/0
L 192.168.0.1/32 is directly connected, GigabitEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Serial0/1/0
L 192.168.1.1/32 is directly connected, Serial0/1/0
Router1#show ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0/24 [120/1] via 192.168.0.1, 00:00:03, GigabitEthernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, GigabitEthernet0/0
L 192.168.0.2/32 is directly connected, GigabitEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Serial0/1/0
L 192.168.1.2/32 is directly connected, Serial0/1/0
Router0(config)#int gi 0/0
Router0(config-if)#shutdown
Router0#show ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0/24 [130/0] via 192.168.1.2
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Serial0/1/0
L 192.168.1.1/32 is directly connected, Serial0/1/0
#主路由故障,备份静态路由生效
Router0(config)#int gi0/0
Router0(config-if)#no shut
Router0#show ip route
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0/24 [120/1] via 192.168.0.2, 00:00:07, GigabitEthernet0/0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, GigabitEthernet0/0
L 192.168.0.1/32 is directly connected, GigabitEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Serial0/1/0
L 192.168.1.1/32 is directly connected, Serial0/1/0
#主路由恢复后,静态路由又恢复到备份地位