一、实验内容
1、将网段192.168.1.0/25
按需划分成四个子网
2、为路由器配置静态ip,使PC1和PC2能ping通.
二、实验拓扑
三、实验过程
(一)子网划分
对于给定子网192.168.1.0/25
,根据拓扑要求需划分为4个网段。子网192.168.1.0/25
,这是已经划分过子网的网段,借了1位主机位来划分子网。我们要想划分四个网段(2^2=4),需要再往下借两位主机位来划分子网,那么子网掩码的位数为25+2=27
位。
二进制 | 十进制 | |
---|---|---|
子网掩码 | 11111111.11111111.11111111.11100000 | 255.255.255.224 |
划分出来的子网为(加粗的是借的位数):
二进制 | 十进制 | |
---|---|---|
子网1 | 11111111.11111111.11111111.00000000 | 192.168.1.0/27 |
子网2 | 11111111.11111111.11111111.00100000 | 192.168.1.32/27 |
子网3 | 11111111.11111111.11111111.01000000 | 192.168.1.64/27 |
子网4 | 11111111.11111111.11111111.01100000 | 192.168.1.96/27 |
可用IP范围 | 广播地址 | |
---|---|---|
子网1 | 192.168.1.1-192.168.1.30 | 192.168.1.31 |
子网2 | 192.168.1.33-192.168.1.62 | 192.168.1.63 |
子网3 | 192.168.1.65-192.168.1.94 | 192.168.1.95 |
子网4 | 192.168.1.97-192.168.1.126 | 192.168.1.127 |
(二)配置静态路由,使PC1和PC2能通信
1、配置两台PC的IP,网关和子网掩码。
2、为路由器端口配置IP地址
R1:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysnam R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add
[R1-GigabitEthernet0/0/1]ip address 192.168.1.1 27
Apr 7 2023 20:47:30-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.34 27
Apr 7 2023 20:48:03-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]
[R1-GigabitEthernet0/0/0]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.34/27 up up
GigabitEthernet0/0/1 192.168.1.1/27 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[R1-GigabitEthernet0/0/0]
R2:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.1.33 27
Apr 7 2023 20:49:38-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]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 192.168.1.66 27
Apr 7 2023 20:50:05-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R2-GigabitEthernet0/0/2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.33/27 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 192.168.1.66/27 up up
NULL0 unassigned up up(s)
[R2-GigabitEthernet0/0/2]
R3:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysnam R3
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.1.65 27
Apr 7 2023 20:52:09-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R3-GigabitEthernet0/0/2]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.1.98 27
Apr 7 2023 20:52:42-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]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 192.168.1.98/27 up up
GigabitEthernet0/0/2 192.168.1.65/27 up up
NULL0 unassigned up up(s)
[R3-GigabitEthernet0/0/1]
3、此时使PC1ping网关和PC2,发现,可以ping通网关,因为网关和PC1直连,但无法ping通PC2,因为PC2和PC1不在同一网段,需配置静态路由。
3、配置静态路由。
R1:
[R1]ip route-static 192.168.1.64 27 192.168.1.33
[R1]ip route-static 192.168.1.96 27 192.168.1.33
[R1]
R2:
[R2]ip route-static 192.168.1.0 27 192.168.1.34
[R2]ip route-static 192.168.1.96 27 192.168.1.65
[R2]
R3:
[R3]ip route-static 192.168.1.32 27 192.168.1.66
[R3]ip route-static 192.168.1.0 27 192.168.1.66
[R3]
4、尝试在PC1 ping PC2,可以ping通,配置成功。文章来源:https://www.toymoban.com/news/detail-735087.html
文章来源地址https://www.toymoban.com/news/detail-735087.html
到了这里,关于划分子网,然后使用eNSP为路由器配置静态路由,使PC能够通信的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!