静态路由与浮动路由

在这里插入图片描述

浮动路由:配置两条静态路由,链路最优的作为主路径,主路径出现故障,带宽较小的备用路由会顶替,保证网络不中断

第一步配置IP地址

R1:

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:

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:

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:

[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修改为默认路由

即:[R3]ip route-static 0.0.0.0 0.0.0.0 192.168.2.1

浮动路由

[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

[R1]ip route-static 0.0.0.0 0.0.0.0 192.168.3.2 preference 61

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

[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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值