一、浮动静态路由
1.拓扑图
2.路由器基本配置
R1:
<Huawei>sys # 进入系统视图
[Huawei]un in en # 关闭信息中心
[Huawei]sys R1 # 命名
[R1]int s1/0/1 # 进入接口
[R1-Serial1/0/1]ip add 10.10.10.1 24 # 配置接口IP地址
[R1-Serial1/0/1]q # 退出
[R1]int s1/0/0 # 进入接口
[R1-Serial1/0/0]ip add 20.20.20.1 24 # 配置接口IP地址
[R1-Serial1/0/0]q # 退出
[R1]int g0/0/0 # 进入接口
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24 # 配置接口IP地址
[R1-GigabitEthernet0/0/0]q # 退出
R2:
<Huawei>sys # 进入系统视图
[Huawei]sys R2 # 命名
[R2]un in en # 关闭信息中心
[R2]int s1/0/0 # 进入接口
[R2-Serial1/0/0]ip add 10.10.10.2 24 # 配置接口IP地址
[R2-Serial1/0/0]q # 退出
[R2]int s1/0/1 # 进入接口
[R2-Serial1/0/1]ip add 20.20.20.2 24 # 配置接口IP地址
[R2-Serial1/0/1]q # 退出
[R2]int g0/0/0 # 进入接口
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24 # 配置接口IP地址
[R2-GigabitEthernet0/0/0]q # 退出
3.配置浮动静态路由
R1:
[R1]ip route-static 192.168.2.0 24 10.10.10.2 preference 100
# 配置浮动静态路由,100为优先值(优先值越小,路由优先通过)
[R1]ip route-static 192.168.2.0 24 20.20.20.2 preference 120
# 配置浮动静态路由,120为优先值
R2:
[R2]ip route-static 192.168.1.0 24 10.10.10.1 preference 100
# 配置浮动静态路由,100为优先值(优先值越小,路由优先通过)
[R2]ip route-static 192.168.2.0 24 20.20.20.1 preference 120
# 配置浮动静态路由,120为优先值
4.测试
pc1:
tracert 192.168.2.1 # 查看发包路径
可以看到路由选择了优先级最低的路,成功!!!