1要求:
1 除R5的环回地址已固定外,整个其他所有的网段基于192.168.1.0/24进行合理的IP地址划分。
2 R1-R4每个路由器存在两个环回接口,用于模拟链接PC的网段;地址也在192.168.1.0/24这个网络范围内。
3 R1-R4上不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问。
4 全网可达,尽量减少每台路由器,路由表条目的数量;避免环路出现。
5 R4与R5间,正常1000M链路,故通信障时自动改为100M。
原始拓扑:
分析:
1 ip地址的划分 --- 192.168.1.0/24 的划分.
2 配置路由下一跳和缺省路由
3 减少路由条目--手工汇总--空接口路由
IP地址划分:
网段划分:
192.168.1.0/27 ---直连路由 192.168.1.32/27 ---R1的环回 192.168.1.64/27 ---R2的环回 192.168.1.96/27 ---R3的环回 192.168.1.128/27 ---R4的环回 //直连路由再次划分为/30的网段 192.168.1.0/30 ---R1和R2 192.168.1.4/30 ---R2和R4 192.168.1.8/30 ---R3和R4 192.168.1.12/30---R1和R3 192.168.1.16/30---R4和R5---1000M 192.168.1.20/30---R4和R5---100M //R1的环回 192.168.1.32/28---R1的环回1 192.168.1.48/28---R1的环回2 //R2的环回 192.168.1.64/28---R2的环回1 192.168.1.80/28---R2的环回2 //R3的环回 192.168.1.96/28 ---R3的环回1 192.168.1.112/28---R3的环回2 //R4的环回 192.168.1.128/28---R4的环回1 192.168.1.144/28---R4的环回2 //R6的环回已经固定 5.5.5.0/24
配置直连,环回:
//R1的接口--网关
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
[r1-GigabitEthernet0/0/0]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.13 30
//R2的接口--网关
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip adderss 192.168.1.2 30
[r2-GigabitEthernet0/0/0]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.1.5 30
//R3的接口--网关
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.14 30
[r3-GigabitEthernet0/0/0]interface g0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.10 30
//R4的接口--网关
!!!R4需要加入一个接口
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.6 30
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.21 30
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.9 30
[r4-GigabitEthernet0/0/2]int g4/0/0
[r4-GigabitEthernet4/0/0]ip address 192.168.1.17 30
//R5的接口--网关
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]ip address 192.168.1.18 30
[r5-GigabitEthernet0/0/1]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.22 30
//R1环回
[r1-LoopBack1]int loopback 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1]int LoopBack 1
[r1-LoopBack1]undo ip address 192.168.1.49 28
//R2环回
[r2]int LoopBack 0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack0]int loopback 1
[r2-LoopBack1]ip address 192.168.1.81 28
//R3环回
[r3]int LoopBack 0
[r3-LoopBack0]ip address 192.168.1.97 28
[r3-LoopBack0]int loopback 1
[r3-LoopBack1]ip address 192.168.1.113 28
//R4环回
[r4]int LoopBack 0
[r4-LoopBack0]ip address 192.168.1.129 28
[r4-LoopBack0]int loopback 1
[r4-LoopBack1]ip address 192.168.1.125 28
//R5环回
[r5]int LoopBack 0
[r5-LoopBack0]ip address 5.5.5.0 24
分析后的拓扑:如图
配置静态路由:
//R1-----汇总+到达网段
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.128 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.96 27 192.168.1.14
[r1]ip route-static 192.168.1.8 30 192.168.1.14
//R2-----汇总+到达网段
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.96 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.128 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.32 27 192.168.1.13
[r3]ip route-static 192.168.1.0 30 192.168.1.13
[r3]ip route-static 192.168.1.0 30 192.168.1.13
[r3]ip route-static 192.168.1.64 27 192.168.1.13
[r3]ip route-static 192.168.1.128 27 192.168.1.9
[r3]ip route-static 192.168.1.4 30 192.168.1.9
//R5-----设置优先级----R5到各网段
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.4 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.0 30 192.168.1.21 preference 80
[r5]ip route-static 192.168.1.4 30 192.168.1.21 preference 80
[r5]ip route-static 192.168.1.8 30 192.168.1.21 preference 80
[r5]ip route-static 192.168.1.12 30 192.168.1.21 preference 80
//配置空接口
[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
//配置缺省路由
[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.9
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 80
[r5]ip route-static 0.0.0.0 0 5.5.5.0
验证:
存在问题:外网5.5.5.0 ping不通