静态路由实验
一、拓扑
二、需求分析
1、全网用192.168.1.0/24进行IP地址的划分----按广播域划分和汇总
2、R5作为DHCP服务器-----用DHCP协议给PC分配IP
3、路由器上均有两个环回
4、R4和R5之间有浮动静态路由
5、全网尽量负载均衡
6、减少路由表数量----可以利用缺省路由
7、全网可达
三、所有配置内容
一、网段分配
二、配IP
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
3、配置静态路由
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
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
4、配置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
四、测试
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
PC1 ping R1 R2环回