静态路由+默认路由+浮动路由联合设置

什么是默认路由 ?

默认路由是一种特殊的静态路由,指的是当路由表中与包的目的地址之间没有匹配的表项时路由器能够做出的选择。如果没有默认路由,那么目的地址在路由表中没有匹配表项的包将被丢弃· 默认路由在某些时候非常有效,当存在末梢网络时,默认路由会大大简化路由器的配置,减轻管理员的工作负担,提高网络性能。

什么是浮动路由 ?

路由表的管理距离越低,优先级越高。浮动路由,举个简单的例子,比如将动态路由的管理距离优先级修改为低,手动添加的静态路由优先级修改为高。当动态路由出现问题时,原有的路由会失效,路由器会自动选择静态路由,保证网络不中断,实现冗余备份!
在这里插入图片描述

基本配置

R1

<Huawei>undo terminal monitor
[Huawei] user-interface console 0
[Huawei]idle-timeout 0 0
[Huawei]sysname R1
[R1]int LoopBack 0
[R1-LoopBack0]ip address 172.16.1.1 24
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24

R2

<Huawei>undo terminal monitor
[Huawei] user-interface console 0
[Huawei]idle-timeout 0 0
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.2.1 24

R3

<Huawei>undo terminal monitor
[Huawei] user-interface console 0
[Huawei]idle-timeout 0 0
[Huawei]sysname R3
[R3]int LoopBack 0
[R3-LoopBack0]ip address 172.16.2.1 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/1]ip address 192.168.2.2 24

添加静态路由

R1

[R1]ip route-static 192.168.2.0 24 192.168.1.2
[R1]ip route-static 172.16.2.0 24 192.168.1.2

R2

[R2]ip route-static 172.16.1.0 24 192.168.1.1
[R2]ip route-static 172.16.2.0 24 192.168.2.2

R3

[R3]ip route-static 192.168.1.0 24 192.168.2.1
[R3]ip route-static 172.16.1.0 24 192.168.2.1

默认路由

  • 默认路由是静态路由的一种特殊方式,它属于静态路由的一种。
  • 使用条件:只能使用在末梢网络中使用

R1

[R1]ip route-static 192.168.2.0 24 192.168.1.2
[R1]ip route-static 172.16.2.0 24 192.168.1.2
可以将俩条路由合并成一条默认路由,减少路由条目

1先删除这俩条静态路由

[R1]undo ip route-static 172.16.2.0 255.255.255.0 192.168.1.2
[R1]undo ip route-static 192.168.2.0 255.255.255.0 192.168.1.2

2修改为默认路由
在这里插入图片描述

[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
[R3]ip route-static 192.168.1.0 24 192.168.2.1
[R3]ip route-static 172.16.1.0 24 192.168.2.1

可以将俩条路由合并成一条默认路由,减少路由条目
1先删除这俩条静态路由

[R3]undo ip route-static 192.168.1.0 24 192.168.2.1
[R3]undo ip route-static 172.16.1.0 24 192.168.2.1

2修改为默认路由
在这里插入图片描述

浮动路由

在这里插入图片描述

[R1]int e0/0/0
[R1-Ethernet0/0/0]ip address 192.168.3.1 24
[R2]int e0/0/0	
[R2-Ethernet0/0/0]ip address 192.162.3.2 24

设置这条路由的优先级为61(静态路由优先级为60)所以链路正常时不会走这条路

[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.3.2 preference 61
[R2]ip route-static 0.0.0.0 0.0.0.0 192.168.3.1 preference 61
效果:
[R1]tracert 172.16.2.1
 traceroute to  172.16.2.1(172.16.2.1), max hops: 30 ,packet length: 40,press CT
RL_C to break 

 1 192.168.1.2 30 ms  50 ms  30 ms 

 2 192.168.2.2 80 ms  80 ms  40 ms 

当g0/0/0这条链路不正常时

在这里插入图片描述

[R1]tracert 172.16.2.1

 traceroute to  172.16.2.1(172.16.2.1), max hops: 30 ,packet length: 40,press CT
RL_C to break 

 1 192.168.3.2 50 ms  30 ms  40 ms 

 2 192.168.2.2 70 ms  60 ms  60 ms 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值