划分子网,然后使用eNSP为路由器配置静态路由,使PC能够通信

一、实验内容

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.11100000255.255.255.224

划分出来的子网为(加粗的是借的位数):

二进制十进制
子网111111111.11111111.11111111.00000000192.168.1.0/27
子网211111111.11111111.11111111.00100000192.168.1.32/27
子网311111111.11111111.11111111.01000000192.168.1.64/27
子网411111111.11111111.11111111.01100000192.168.1.96/27
可用IP范围广播地址
子网1192.168.1.1-192.168.1.30192.168.1.31
子网2192.168.1.33-192.168.1.62192.168.1.63
子网3192.168.1.65-192.168.1.94192.168.1.95
子网4192.168.1.97-192.168.1.126192.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通,配置成功。

在这里插入图片描述

  • 6
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值