eNSP-VLAN综合实验

目录

实验要求

修改PC获取IP方式为DHCP

交换机配置

配置

查看

路由器配置

DHCP配置 

查询

网络测试


实验要求

1、pc1和pc3所在接口为access;属于vlan 2;
   pc2/pc4/pc5/pc6处于同一网段;其中pc2可以访问pc4/pc5/pc6;
   pc4可以访问pc6;pc5不能访问pc6;
2、pc1/pc3与pc2/pc4/pc5/pc6不在同一个网段;
3、所有pc通过DHCP获取IP地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;

修改PC获取IP方式为DHCP

PC1到PC6配置相同:

交换机配置

分析拓扑图得知,vlan2单独为一个网段,设置为access口,而其他局域网为一个网段,但又因为具有多个vlan所以采取hybird口。又因为路由器子接口可以接收带标签的数据帧,而物理接口不能接收带标签的数据帧且在路由器与交换机连接的那个接口需要通过多个vlan的数据流,故将其PVID设置为vlan1。(vlan1默认斯标签发送)

配置

LSW1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW1
[LSW1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
May 17 2024 22:41:30-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 5, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW1]int GigabitEthernet 0/0/1	
[LSW1-GigabitEthernet0/0/1]port link-type access 
[LSW1-GigabitEthernet0/0/1]port default vlan 2
[LSW1-GigabitEthernet0/0/1]
May 17 2024 22:41:50-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the 
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/1]int g0/0/2	
[LSW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/2]
May 17 2024 22:42:20-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the 
change loop count is 0, and the maximum number of records is 4095.
[LSW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
May 17 2024 22:42:50-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the 
change loop count is 0, and the maximum number of records is 4095. 	
[LSW1-GigabitEthernet0/0/2]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type trunk 
May 17 2024 22:43:10-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
 change loop count is 0, and the maximum number of records is 4095.		
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[LSW1-GigabitEthernet0/0/3]int g0/0/4
[LSW1-GigabitEthernet0/0/4]
May 17 2024 22:43:40-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 11, the
 change loop count is 0, and the maximum number of records is 4095.	
[LSW1-GigabitEthernet0/0/4]port hybrid pvid vlan 1
May 17 2024 22:44:00-08:00 LSW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 12, the
 change loop count is 0, and the maximum number of records is 4095.	
[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6

LSW2:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW2
[LSW2]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW2]int g0/0/1
May 17 2024 22:47:59-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 6, the 
change loop count is 0, and the maximum number of records is 4095.		
[LSW2-GigabitEthernet0/0/1]port link-type access 
[LSW2-GigabitEthernet0/0/1]port default vlan 2
[LSW2-GigabitEthernet0/0/1]int g0/0/2
May 17 2024 22:48:20-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
May 17 2024 22:48:40-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[LSW2-GigabitEthernet0/0/2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]
May 17 2024 22:48:50-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW2-GigabitEthernet0/0/3]port link-type trunk 
[LSW2-GigabitEthernet0/0/3]
May 17 2024 22:49:00-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
 change loop count is 0, and the maximum number of records is 4095.	
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
May 17 2024 22:49:20-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 11, the
 change loop count is 0, and the maximum number of records is 4095.	
[LSW2-GigabitEthernet0/0/3]int g0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk 
May 17 2024 22:49:40-08:00 LSW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 12, the
 change loop count is 0, and the maximum number of records is 4095.6	
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6

LSW3:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname LSW3
May 17 2024 22:51:51-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 4, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW3]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
May 17 2024 22:52:01-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 5, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW3]int GigabitEthernet 0/0/1	
[LSW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
May 17 2024 22:52:31-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 6, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5
[LSW3-GigabitEthernet0/0/1]int g0/0/2
May 17 2024 22:52:41-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 7, the 
change loop count is 0, and the maximum number of records is 4095.		
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
May 17 2024 22:53:01-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 8, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6
[LSW3-GigabitEthernet0/0/2]
May 17 2024 22:53:11-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 9, the 
change loop count is 0, and the maximum number of records is 4095.	
[LSW3-GigabitEthernet0/0/2]int g0/0/4
[LSW3-GigabitEthernet0/0/4]port link-type trunk 
May 17 2024 22:53:32-08:00 LSW3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2
5.191.3.1 configurations have been changed. The current change number is 10, the
 change loop count is 0, and the maximum number of records is 4095.	
[LSW3-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6

因为路由器需要通过vlan2的数据帧,故在LSW1上加一条:

[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port hybrid tagged  vlan 2

 

查看

LSW1:

LSW2:

LSW3:

 

路由器配置

DHCP配置 

因为6个vlan,两个网段,一个子接口只能配置一个vlan,故将该子接口用于接管vlan2,其余的使用物理口接管。

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
May 17 2024 23:01:33-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0.1 has entered the UP state. 
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]q
[R1]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 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/0.1            192.168.2.1/24       up         down      
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R1]
[R1]dhcp enable 
[R1]ip pool a
[R1-ip-pool-a]network 192.168.1.0 mask 24
[R1-ip-pool-a]gateway-list 192.168.1.1
[R1-ip-pool-a]dns-list 8.8.8.8
[R1-ip-pool-a]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global 
[R1-GigabitEthernet0/0/0]q
[R1]ip pool b
[R1-ip-pool-b]network 192.168.2.0 mask 24
[R1-ip-pool-b]gateway-list 192.168.2.1
[R1-ip-pool-b]dns-list 8.8.8.8
[R1-ip-pool-b]q
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global 

查询

PC1:

PC2:

PC3:

PC4:

PC5:

PC6:

网络测试

PC2访问PC4/5/6:

PC4访问PC6:

PC5访问PC6:

PC1访问PC2/4/5/6:

 

 

 

PC3访问PC2/4/5/6:

 

 

 

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值