一.图示
二.要求
1.全网用192.168.1.0/24进行ip地址分划
2.RS作为dhcp服务器
3.路由器上均有俩个环回
4.R4和R5之间有浮动静态路由
5.全网尽量负载均衡
6.减少路由表数量
7.全网可达
三.具体代码
1.配置ip及环回
r1:[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]
[r1-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[r1-GigabitEthernet0/0/1]q
[r1]interface loopback 0
[r1-LoopBack0]ip add 192.168.1.33 28
[r1]interface loopback 1
[r1-LoopBack1]ip add 192.168.1.49 28
r2:[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[r2-GigabitEthernet0/0/0]q
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.9 30
[r2-GigabitEthernet0/0/1]
[r2-GigabitEthernet0/0/1]q
[r2]interface loopback 0
[r2-LoopBack0]ip add 192.168.1.65 28
[r2-LoopBack0]q
[r2]interface loopback 1
[r2-LoopBack1]ip add 192.168.1.81 28
[r2-LoopBack1]q
r3:[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.5 30
[r3-GigabitEthernet0/0/0]q
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[r3-GigabitEthernet0/0/1]q
[r3]interface loopback 0
[r3-LoopBack0]ip add 192.168.1.97 28
[r3-LoopBack0]q
[r3]interface loopback 1
[r3-LoopBack1]ip add 192.168.1.113 28
[r3-LoopBack1]q
r4:[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[r4-GigabitEthernet0/0/0]q
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
[r4-GigabitEthernet0/0/1]q
[r4]interface g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4-GigabitEthernet0/0/2]interface g4/0/0
[r4-GigabitEthernet4/0/0]ip add 192.168.1.21 30
[r4-GigabitEthernet4/0/0]q
[r4]interface loopback 0
[r4-LoopBack0]ip add 192.168.1.129 28
[r4-LoopBack0]int l 1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]q
r5:
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.22 30
[r5-GigabitEthernet0/0/1]q
[r5]interface loopback 0
[r5-LoopBack0]ip add 192.168.1.161 28
[r5-LoopBack0]int l 1
[r5-LoopBack1]ip add 192.168.1.177 28
[r5-LoopBack1]q
[r5]interface g0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.193 27
2.静态路由
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.6
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.6
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.6
r2:
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.4 30 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.10
[r2]ip route-static 0.0.0.0 0 192.168.1.10
r3:
[r3]ip route-static 192.168.1.32 27 192.168.1.1
[r3]ip route-static 192.168.1.0 30 192.168.1.1
[r3]ip route-static 192.168.1.64 27 192.168.1.1
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 0.0.0.0 0 192.168.1.14
r4:
[r4]ip route-static 192.168.1.32 27 192.168.1.9
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.4 30 192.168.1.13
[r4]ip route-static 192.168.1.64 27 192.168.1.9
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 0.0.0.0 0 192.168.1.18
[r4]ip route-static 0.0.0.0 0 192.168.1.22
r5:
[r5]ip route-static 192.168.1.0 24 192.168.1.17
[r5]ip route-static 192.168.1.0 24 192.168.1.21
[r5]dhcp enable
[r5]ip pool 1
[r5-ip-pool-1]network 192.168.1.192 mask 27
[r5-ip-pool-1]gateway-list 192.168.1.193
[r5-ip-pool-1]dns-list 114.114.114..114
[r5-ip-pool-1]q
[r5]interface g0/0/2
[r5-GigabitEthernet0/0/2]dhcp select global
[r5-GigabitEthernet0/0/2]q
3.防环回
r1:
[r1]ip route-static 192.168.1.32 27 NULL 0
r2:
[r2]ip route-static 192.168.1.64 27 NULL 0
r3:
[r3]ip route-static 192.168.1.96 27 NULL 0
r4:
[r4]ip route-static 192.168.1.128 27 NULL 0
r5:
[r5]ip route-static 192.168.1.24 29 NULL 0
[r5]ip route-static 192.168.1.224 27 NULL 0
四.结果