静态路由的扩展配置
负载均衡:
当访问相同目标,具有多条开销相似路径时,可以让设备将流量拆分后延多条路径同时传输,起到带宽叠加的作用。
环回接口:
创建后,可用于路由器测试TCP/IP协议组件是否能够封装与解封装。 同时,可用于实验环境中,模拟连接PC终端的用户接口,来减少实际设备成本需求。 LoopBack接口为逻辑接口
[R1]interface LoopBack ?
<0-1023> LoopBack interface number
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 1.1.1.1 24
手工汇总:
若路由器需要访问多个连续子网,且具有相同的下一跳,可以将这些网段进行汇总计算,之后进编写到达汇总网段路由即可。 节省路由表条目数量。
路由黑洞:
汇总地址中包含了,网络实际不存在的网段时,将导致流量有去无回,浪费链路资源。建议合理的ip地址规划(便于无黑洞汇总),尽量精确汇总。
缺省路由:
一条不限定目标的路由,代表所有网段,路由表查表时在查询完本地所有的直连、静态、动态路由后若依然没有可达路径,才使用该条目。
[R1]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
空接口:
当路由黑洞与缺省路由相遇时,将必然出现环路。
措施:在黑洞路由上,配置一条到达汇总网段的空接口路由,空接口及丢弃流量,来避免环路的产生。
[R1]ip route-static 1.1.0.0 22 NULL 0
浮动静态:
不同方式产生到路由表中条目,其优先级不同:直连=0 静态=60
优先级取值范围:0-255 越小越好
访问相同目标,具有多条路径时,将加载优先级最小到表中使用,若优先级相同将同时加表(负载均衡),因此修改部分路由的优先级,可以实现静态备份的效果。
[R1]ip route-static 100.100.100.0 24 13.1.1.2 preference ?
INTEGER<1-255> Preference value range
[R1]ip route-static 100.100.100.0 24 13.1.1.2 preference 61
实验需求
1.按如图所示完成拓扑。
2.除R5的环回地址已固定外,整个其他所有的网段基于192.168.1.0/24进行合理的IP地址划。
3.R1-R4每天路由器存在两个环回接口,用于模拟连接pc的网段,地址也在192.168.1.0/24这个网络范围内。
4.R1-R4上不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问。
5.全网可达,尽量减少每台路由器,路由表条目的数量;避免环路出现。
6.R4与R5间,正常100en链路通信,故障时自动改为100M。
实验步骤
一、首先完成子网划分
192.168.1.0/24
路由间连接的网段
192.168.1.0/27 192.168.1.0/30 192.168.1.4/30 192.168.1.8/30 192.168.1.12/30 192.168.1.16/30 192.168.1.20/30 192.168.1.24/30 192.168.1.28/30
路由的环回接口分配
192.168.1.32/27 R1 192.168.1.32/28 192.168.1.48/28
192.168.1.64/27 R2 192.168.1.64/28 192.168.1.80/28
192.168.1.96/27 R3 192.168.1.96/28 192.168.1.112/28
192.168.1.128/27 R4 192.168.1.128/28 192.168.1.144/28
多余的
192.168.1.160/27
192.168.1.192/27
192.168.1.224/27
二、配置各路由下的环回接口,以及路由各接口ip
[R1]interface LoopBack 0
[R1-LoopBack1]ip address 192.168.1.33 28
[R1]interface LoopBack 1
[R1-LoopBack2]ip address 192.168.1.49 28
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip a 192.168.1.1 30
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip a 192.168.1.13 30
R2、R3、R4同理如上配置
三、配置静态路由
R1
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.96 27 192.168.1.2
[R1]ip route-static 192.168.1.4 30 192.168.1.2
[R1]ip route-static 192.168.1.128 27 192.168.1.13
[R1]ip route-static 192.168.1.8 30 192.168.1.13
R2
[R2]ip route-static 192.168.1.32 27 192.168.1.1
[R2]ip route-static 192.168.1.128 27 192.168.1.1
[R2]ip route-static 192.168.1.12 30 192.168.1.1
[R2]ip route-static 192.168.1.96 27 192.168.1.6
[R2]ip route-static 192.168.1.8 30 192.168.1.6
R3
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.32 27 192.168.1.5
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.128 27 192.168.1.10
[R3]ip route-static 192.168.1.12 30 192.168.1.10
R4
[R4]ip route-static 192.168.1.96 27 192.168.1.9
[R4]ip route-static 192.168.1.4 30 192.168.1.9
[R4]ip route-static 192.168.1.32 27 192.168.1.14
[R4]ip route-static 192.168.1.64 27 192.168.1.14
[R4]ip route-static 192.168.1.0 30 192.168.1.14
R5
[R5]ip route-static 192.168.1.96 27 192.168.1.17
[R5]ip route-static 192.168.1.64 27 192.168.1.17
[R5]ip route-static 192.168.1.32 27 192.168.1.17
[R5]ip route-static 192.168.1.128 27 192.168.1.17
[R5]ip route-static 192.168.1.4 30 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.8 30 192.168.1.17
[R5]ip route-static 192.168.1.12 30 192.168.1.17
[R5]ip route-static 192.168.1.96 27 192.168.1.21
[R5]ip route-static 192.168.1.64 27 192.168.1.21
[R5]ip route-static 192.168.1.32 27 192.168.1.21
[R5]ip route-static 192.168.1.128 27 192.168.1.21
[R5]ip route-static 192.168.1.0 30 192.168.1.21
[R5]ip route-static 192.168.1.4 30 192.168.1.21
[R5]ip route-static 192.168.1.8 30 192.168.1.21
[R5]ip route-static 192.168.1.12 30 192.168.1.21
四、配置缺省路由
[R1]ip route-static 0.0.0.0 0 192.168.1.2
[R2]ip route-static 0.0.0.0 0 192.168.1.6
[R3]ip route-static 0.0.0.0 0 192.168.1.18
[R3]ip route-static 0.0.0.0 0 192.168.1.22 preference 70 //根据题目要求,该接口配置浮动静态
[R4]ip route-static 0.0.0.0 0 192.168.1.9
五、配置空接口,防止回环
[R1]ip route-static 192.168.1.32 27 NULL 0
[R2]ip route-static 192.168.1.64 27 NULL 0
[R3]ip route-static 192.168.1.96 27 NULL 0
[R4]ip route-static 192.168.1.128 27 NULL 0
实验测试
对于空接口防环,则可以去掉一个环回接口再ping然后抓包查看。
对于故障改为100M,则可以断开一条再ping。