VLAN实验

题目要求如下:

构建拓扑图:

实验分析:
1、划分VLAN,由实验要求可知,PC1和PC3在VLAN2,PC2在VLAN3,PC4在vlan4和PC5在VLAN5,PC6在VLAN6,并且将接口设置为access
2、创建VLAN并修改接口模式,VLAN2的接口模式为access,其他VLAN接口模式为hybird,交换机相连的接口为trunk
3、R1创建子接口给VLAN3/4/5/6使用,物理接口给VLAN2 

1.实验步骤

1、交换机配置

(1).sw1
[Huawei]sysname sw1  
[sw1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.

[sw1]int g0/0/2   
[sw1-GigabitEthernet0/0/2]port link-type access 

[sw1-GigabitEthernet0/0/2]port default vlan 2
[sw1-GigabitEthernet0/0/2]q
[sw1]int g0/0/1  
[sw1-GigabitEthernet0/0/1]port hybrid  pvid vlan 3
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 6

[sw1-GigabitEthernet0/0/1]int g0/0/1   
[sw1-GigabitEthernet0/0/1]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 6
[sw1-GigabitEthernet0/0/1]int g0/0/4  
[sw1-GigabitEthernet0/0/4]port link-type  access 
[sw1-GigabitEthernet0/0/4]port default  vlan 2


[sw1-GigabitEthernet0/0/4]int g0/0/5
[sw1-GigabitEthernet0/0/5]port hybrid pvid  vlan 4
[sw1-GigabitEthernet0/0/5]port hybrid  untagged vlan 3 to 5


[sw1-GigabitEthernet0/0/5]int g0/0/6
[sw1-GigabitEthernet0/0/6]port link-type  trunk 
[sw1-GigabitEthernet0/0/6]port trunk allow-pass  vlan 2 to 6

(2).sw2


[Huawei]sysname sw2

[sw2]int g0/0/1   
[sw2-GigabitEthernet0/0/1]port link-type trunk    
[sw2-GigabitEthernet0/0/1]port trunk  allow-pass vlan 2 to 6

[sw2-GigabitEthernet0/0/1]q
[sw2]vlan  batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.

[sw2]int g0/0/2  
[sw2-GigabitEthernet0/0/2]port hybrid pvid vlan 5
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 5

[sw2-GigabitEthernet0/0/2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port hybrid pvid vlan 6  
[sw2-GigabitEthernet0/0/3]port hybrid untagged vlan 3 6

 

2.路由器配置dhcp服务


[Huawei]sysname r1
[r1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.  
[r1]ip pool  dh
Info: It's successful to create an IP address pool.
[r1-ip-pool-dh]gateway-list  192.168.1.1 
[r1-ip-pool-dh]network 192.168.1.0 mask 255.255.255.0
[r1-ip-pool-dh]q  
[r1]ip pool  b
Info: It's successful to create an IP address pool.
[r1-ip-pool-b]gateway-list 192.168.2.1
[r1-ip-pool-b]network 192.168.2.0 mask 255.255.255.0
[r1-ip-pool-b]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.2.1 255.255.255.0
Aug 17 2023 23:02:07-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]dhcp  select global 
[r1-GigabitEthernet0/0/0]q
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination  vid 2
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.1 255.255.255.0
Aug 17 2023 23:05:03-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]: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]dhcp select  global 

3.PC手动开启DHCP服务(以PC5为例)

 4.测试

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值