一、拓扑图
二、需求
1.整张网络使用192.168.1.0/24网段进行划分。
2.R1、R2、R3、R4均有两个环回来模拟用户网段
3.R5使用DHCP为PC分配IP地址
4.R2、R3、R4、R5开启Telnet功能;账号密码:admin/admin
5.完成所有路由器的静态路由配置,要求使用最简化路由表的方式、全网可达
三、需求分析及结果验证
-
划分网段
为了将192.168.1.0/24网段划分为15个子网,我们需要确定合适的子网掩码。由于原始掩码是/24,我们需要增加额外的位来创建更多的子网。
- 计算所需的子网位数
原始的 /24 加上额外的4位,得到新的网络掩码为 /28。
计算每个子网的IP范围
地址中,第一个地址是网络地址,最后一个地址是广播地址,因此每个子网有14个可用的主机地址。
- 子网的具体IP范围
下面是所有15个子网的IP范围(网络位和可用网络):
1. 子网1: 192.168.1.0/28
- 网络地址: 192.168.1.0
- 广播地址: 192.168.1.15
- 可用地址: 192.168.1.1 - 192.168.1.142. 子网2: 192.168.1.16/28
- 网络地址: 192.168.1.16
- 广播地址: 192.168.1.31
- 可用地址: 192.168.1.17 - 192.168.1.303. 子网3:192.168.1.32/28
- 网络地址: 192.168.1.32
- 广播地址: 192.168.1.47
- 可用地址: 192.168.1.33 - 192.168.1.464. 子网4:192.168.1.48/28
- 网络地址: 192.168.1.48
- 广播地址: 192.168.1.63
- 可用地址: 192.168.1.49 - 192.168.1.625. 子网5: 192.168.1.64/28
- 网络地址: 192.168.1.64
- 广播地址: 192.168.1.79
- 可用地址: 192.168.1.65 - 192.168.1.786. 子网6: 192.168.1.80/28
- 网络地址: 192.168.1.80
- 广播地址: 192.168.1.95
- 可用地址: 192.168.1.81 - 192.168.1.947. 子网7: 192.168.1.96/28
- 网络地址: 192.168.1.96
- 广播地址: 192.168.1.111
- 可用地址: 192.168.1.97 - 192.168.1.1108. 子网8: 192.168.1.112/28
- 网络地址: 192.168.1.112
- 广播地址: 192.168.1.127
- 可用地址: 192.168.1.113 - 192.168.1.1269. 子网9: 192.168.1.128/28
- 网络地址: 192.168.1.128
- 广播地址: 192.168.1.143
- 可用地址: 192.168.1.129 - 192.168.1.14210.子网10: 192.168.1.144/28
- 网络地址: 192.168.1.144
- 广播地址: 192.168.1.159
- 可用地址: 192.168.1.145 - 192.168.1.15811. 子网11: 192.168.1.160/28
- 网络地址: 192.168.1.160
- 广播地址: 192.168.1.175
- 可用地址: 192.168.1.161 - 192.168.1.17412. 子网12: 192.168.1.176/28
- 网络地址: 192.168.1.176
- 广播地址: 192.168.1.191
- 可用地址: 192.168.1.177 - 192.168.1.19013. 子网13: 192.168.1.192/28
- 网络地址: 192.168.1.192
- 广播地址: 192.168.1.207
- 可用地址: 192.168.1.193 - 192.168.1.20614. 子网14: 192.168.1.208/28
- 网络地址: 192.168.1.208
- 广播地址: 192.168.1.223
- 可用地址: 192.168.1.209 - 192.168.1.22215. 子网15: 192.168.1.224/28
- 网络地址: 192.168.1.224
- 广播地址: 192.168.1.239
- 可用地址: 192.168.1.225 - 192.168.1.238这样,我们就成功地将192.168.1.0/24网段划分为15个子网,每个子网具有14个可用的主机地址。
-
给路由器配置IP地址
AR1
AR2
AR3
AR4
AR5
-
给路由器配置静态路由
[R1]ip route-static 192.168.1.48 28 192.168.1.2 [R1]ip route-static 192.168.1.32 28 192.168.1.30 [R1]ip route-static 192.168.1.192 28 192.168.1.2 [R1]ip route-static 192.168.1.208 28 192.168.1.30 [R1]ip route-static 192.168.1.224 28 192.168.1.2 [R1]ip route-static 192.168.1.224 28 192.168.1.30 [R1]ip route-static 192.168.1.96 27 192.168.1.2 [R1]ip route-static 192.168.1.128 27 192.168.1.30 [R1]ip route-static 192.168.1.160 27 192.168.1.2 [R2]ip route-static 192.168.1.16 28 192.168.1.1 [R2]ip route-static 192.168.1.32 28 192.168.1.50 [R2]ip route-static 192.168.1.224 28 192.168.1.50 [R2]ip route-static 192.168.1.192 28 192.168.1.50 [R2]ip route-static 192.168.1.208 28 192.168.1.50 [R2]ip route-static 192.168.1.64 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.160 27 192.168.1.50 [R3]ip route-static 192.168.1.0 28 192.168.1.17 [R3]ip route-static 192.168.1.48 28 192.168.1.40 [R3]ip route-static 192.168.1.224 28 192.168.1.40 [R3]ip route-static 192.168.1.192 28 192.168.1.40 [R3]ip route-static 192.168.1.64 27 192.168.1.17 [R3]ip route-static 192.168.1.160 27 192.168.1.40 [R3]ip route-static 192.168.1.96 27 192.168.1.17 [R4]ip route-static 192.168.1.0 28 192.168.1.49 [R4]ip route-static 192.168.1.16 28 192.168.1.33 [R4]ip route-static 192.168.1.224 28 192.168.1.200 [R4]ip route-static 192.168.1.224 28 192.168.1.220 preference 90 [R4]ip route-static 192.168.1.96 27 192.168.1.49 [R4]ip route-static 192.168.1.64 27 192.168.1.49 [R4]ip route-static 192.168.1.128 27 192.168.1.33 [R5]ip route-static 192.168.1.48 28 192.168.1.193 [R5]ip route-static 192.168.1.32 28 192.168.1.193 [R5]ip route-static 192.168.1.48 28 192.168.1.210 preference 90 [R5]ip route-static 192.168.1.32 28 192.168.1.210 preference 90 [R5]ip route-static 192.168.1.0 28 192.168.1.193 [R5]ip route-static 192.168.1.16 28 192.168.1.193 [R5]ip route-static 192.168.1.0 28 192.168.1.210 preference 90 [R5]ip route-static 192.168.1.16 28 192.168.1.210 preference 90
- 浮动静态路由
当路由表中存在等价路由后,前往该目标的报文信息会从多个接口向外发送----这种数据发送方式被称 为负载均衡。---负载分担(等级越高,数越大)静态路由的默认数值是60[R4]ip route-static 192.168.1.224 28 192.168.1.200
[R4]ip route-static 192.168.1.224 28 192.168.1.220 preference 90[R5]ip route-static 192.168.1.32 28 192.168.1.193[R5]ip route-static 192.168.1.32 28 192.168.1.210 preference 90[R5]ip route-static 192.168.1.48 28 192.168.1.193[R5]ip route-static 192.168.1.32 28 192.168.1.210 preference 90[R5]ip route-static 192.168.1.0 28 192.168.1.193[R5]ip route-static 192.168.1.0 28 192.168.1.210 preference 90
[R5]ip route-static 192.168.1.16 28 192.168.1.193
[R5]ip route-static 192.168.1.16 28 192.168.1.210 preference 90
-
给R1、R2、R3、R4配置均有两个环回来模拟用户网段
R1 :配置环回接口IP
[R1-LoopBack0]ip address 192.168.1.65 28
[R1-LoopBack1]ip address 192.168.1.81 28
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/28 up up
GigabitEthernet0/0/1 192.168.1.17/28 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.65/28 up up(s)
LoopBack1 192.168.1.81/28 up up(s)
NULL0 unassigned up up(s)
[R1]
将AR1上两个环回接口的网段进行汇总
192.168.1.64/28
192.168.1.80/28汇总后为:192.168.1.64/27
后续进行添加静态路由时,目的网段只需添加汇总后的网段即可。例如:
[R2]ip route-static 192.168.1.64 27 192.168.1.1
添加成功后,即可访问这两个网段里的地址,例如:需要访问192.168.1.65、192.168.1.81
R2 配置环回接口IP
[R2-LoopBack0]ip address 192.168.1.97 28
[R2-LoopBack1]ip address 192.168.1.113 28
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.2/28 up up
GigabitEthernet0/0/1 192.168.1.49/28 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.97/28 up up(s)
LoopBack1 192.168.1.113/28 up up(s)
NULL0 unassigned up up(s)
[R2]
将AR2上两个环回接口的网段进行汇总
192.168.1.96/28
192.168.1.112/28汇总后为:192.168.1.96/27
后续进行添加静态路由时,目的网段只需添加汇总后的网段即可。例如:
[R4]ip route-static 192.168.1.96 27 192.168.1.49
添加成功后,即可访问这两个网段里的地址,例如:需要访问192.168.1.97、192.168.1.113
R3和R4也是一样,在这里就不一一示范了.
R3、R4和环回接口配置:
[R3-LoopBack0]ip address 192.168.1.129 28
[R3-LoopBack1]ip address 192.168.1.145 28
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.30/28 up up
GigabitEthernet0/0/1 192.168.1.33/28 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.1.129/28 up up(s)
LoopBack1 192.168.1.145/28 up up(s)
NULL0 unassigned up up(s)
[R3]
[R4-LoopBack0]ip address 192.168.1.161 28
[R4-LoopBack1]ip address 192.168.1.177 28
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.50/28 up up
GigabitEthernet0/0/1 192.168.1.40/28 up up
GigabitEthernet0/0/2 192.168.1.193/28 up up
GigabitEthernet4/0/0 192.168.1.210/28 up up
LoopBack0 192.168.1.161/28 up up(s)
LoopBack1 192.168.1.177/28 up up(s)
NULL0 unassigned up up(s)
[R4]
环回接口之间ping测试
R1环回接口ping
R2环回接口ping
R3环回接口ping
R4环回接口ping
-
R5使用DHCP为PC分配IP地址
DHCP服务
[R5]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R5]ip pool WWW
Info: It's successful to create an IP address pool.
[R5-ip-pool-WWW]network 192.168.1.224 mask 28
[R5-ip-pool-WWW]gateway-list 192.168.1.225
[R5-ip-pool-WWW]dns-list 8.8.8.8
[R5-ip-pool-WWW]interface GigabitEthernet 0/0/1
[R5-GigabitEthernet0/0/1]dhcp select global
成功分配的截图
-
R2、R3、R4、R5开启Telnet功能;账号密码:admin/admin (R1进行访问)
R2开启telnet功能
[R2]telnet server enable
Error: TELNET server has been enabled
[R2]user-interface vty 0 4
[R2-ui-vty0-4]au
[R2-ui-vty0-4]authentication-mode aaa
[R2-ui-vty0-4]quit
[R2-aaa]local-user www password cipher 123456
Info: Add a new user.
[R2-aaa]local-user www privilege level 15
[R2-aaa]local-user www service-type telnet
R1成功访问
R3开启telnet功能
[R3]telnet server enable
Error: TELNET server has been enabled
[R3]user-interface vty 0 4
[R3-ui-vty0-4]authentication-mode aaa
[R3-ui-vty0-4]quit
[R3]aaa
[R3-aaa]local-user mmm password cipher 123456
Info: Add a new user.
[R3-aaa]local-user mmm privilege level 15
[R3-aaa]local-user mmm service-type telnet
[R3-aaa]
R1成功访问
R4开启telnet功能
[R4]ip route-static 0.0.0.0 0 192.168.2.100
[R4]telnet server enable
Error: TELNET server has been enabled
[R4]user-interface vty 0 4
[R4-ui-vty0-4]authentication-mode aaa
[R4-ui-vty0-4]quit
[R4-aaa]local-user admin password cipher admin
[R4-aaa]local-user admin privilege level 15
[R4-aaa]local-user admin service-type telnet
R1成功访问
四、结果检测、全网可达
PC1和其他路由器完成通讯
PC1和PC2完成通讯
R1ping其他路由器
R1pingPC1 PC2
R5ping其他路由器
R2ping 其他
R3ping 其他
R4ping其他
实验结果:全网可达