浮动静态路由
首先我们知道静态路由的默认优先级是60,然后手动添加一条静态路由优先级为80的路由作为备份路由。
当主路由失效的备份路由就会启动。
一、拓扑图
二、基本配置
1.R1:
<Huawei>system-view
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[R1-GigabitEthernet0/0/1]int e 0/0/1
[R1-Ethernet0/0/1]ip add 192.168.1.1 24
[R1-Ethernet0/0/1]quit
[R1]ip route-static 192.168.4.0 255.255.255.255 192.168.2.2 #静态路由默认的preference是60
[R1]ip route-static 192.168.4.0 255.255.255.0 192.168.3.2 preference 80 #手动设置该条静态路由的preference为80
注:
2.R2:
<Huawei>system-view
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.3.2 24
[R2-GigabitEthernet0/0/1]int e 0/0/1
[R2-Ethernet0/0/1]ip add 192.168.4.1 24
[R2-Ethernet0/0/1]q
[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1 #静态路由默认的preference是60
[R2]ip route-static 192.168.1.0 255.255.255.0 192.168.3.1 preference 80 #手动设置该条静态路由的preference为80
3.终端配置
三 、测试