拓扑图
需求分析
1.全网用192.168.1.0/24进行IP地址划分
2.R5作为DHCP服务器
3.路由器上均有两个环回
4.R4和R5之间有浮动静态路由
5.全网尽量负载均衡
6.减少路由表数量
7.全网可达
配置内容
1.网段分配
r1
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
May 5 2023 00:29:12-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
May 5 2023 00:31:23-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack0]q
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.49 28
r2
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
May 5 2023 00:36:00-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
May 5 2023 00:36:39-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.1.65 28
[r2-LoopBack0]q
[r2]interface LoopBack 1
[r2-LoopBack1]ip address 192.168.1.81 28
r3
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
May 5 2023 00:40:17-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]q
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
May 5 2023 00:41:07-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.1.97 28
[r3-LoopBack0]int l1
[r3-LoopBack1]ip address 192.168.1.113 28
r4
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
May 5 2023 00:43:30-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.14 30
May 5 2023 00:44:18-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]q
[r4]interface GigabitEthernet 0/0/2
[r4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
[r4-GigabitEthernet0/0/2]
May 5 2023 00:45:02-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int g 4/0/0
[r4-GigabitEthernet4/0/0]ip address 192.168.1.21 30
[r4-GigabitEthernet4/0/0]
May 5 2023 00:46:05-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]q
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.1.129 28
[r4-LoopBack0]q
[r4]interface LoopBack 1
[r4-LoopBack1]ip address 192.168.1.145 28
r5
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 192.168.1.18 30
May 5 2023 00:51:04-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]q
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]ip address 192.168.1.22 30
May 5 2023 00:51:45-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]q
[r5]interface GigabitEthernet 0/0/2
[r5-GigabitEthernet0/0/2]ip address 192.168.1.193 27
[r5-GigabitEthernet0/0/2]
May 5 2023 00:52:33-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]int l 0
[r5-LoopBack0]ip address 192.168.1.161 28
[r5-LoopBack0]int l 1
[r5-LoopBack1]ip address 192.168.1.177 28
[r5-LoopBack1]q
[r5]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.18/30 up up
GigabitEthernet0/0/1 192.168.1.22/30 up up
GigabitEthernet0/0/2 192.168.1.193/27 up up
GigabitEthernet4/0/0 unassigned down down
LoopBack0 192.168.1.161/28 up up(s)
LoopBack1 192.168.1.177/28 up up(s)
NULL0 unassigned up up(s)
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.5
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[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
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 90
Info: Succeeded in modifying route.
May 5 2023 01:34:00-08:00 r4 %%01RM/4/IPV4_DEFT_RT_CHG(l)[0]:IPV4 default Route
is changed. (ChangeType=Delete, InstanceId=0, Protocol=Static, ExitIf=GigabitEt
hernet4/0/0, Nexthop=192.168.1.22, Neighbour=0.0.0.0, Preference=1509949440, Lab
el=NULL, Metric=0)
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]ip route-static 192.168.1.0 24 192.168.1.21 preference 90
Info: Succeeded in modifying route.
3.配置DHCP
[r5]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r5]ip policy-based-route
[r5]ip pool 11
Info: It's successful to create an IP address pool.
[r5-ip-pool-11]network 192.168.1.192 mask 27
[r5-ip-pool-11]gateway-list 192.168.1.193
[r5-ip-pool-11]dns-list 114.114.114.114
[r5-ip-pool-11]q
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]int g 0/0/2
[r5-GigabitEthernet0/0/2]dhcp select global
[r5-GigabitEthernet0/0/2]q
测试结果
r1可以ping通pc1
[r1]ping -a 192.168.1.33 192.168.1.222
PING 192.168.1.222: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.1.222: bytes=56 Sequence=2 ttl=125 time=80 ms
Reply from 192.168.1.222: bytes=56 Sequence=3 ttl=125 time=70 ms
Reply from 192.168.1.222: bytes=56 Sequence=4 ttl=125 time=60 ms
Reply from 192.168.1.222: bytes=56 Sequence=5 ttl=125 time=70 ms
--- 192.168.1.222 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 60/70/80 ms
r1可以ping通r2的环回
[r1]ping -a 192.168.1.33 192.168.1.65
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=255 time=10 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 192.168.1.65 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/20/30 ms
pc1可以ping通r1和r2的环回