VLAN实验

一、实验要求:
VLAN实验_第1张图片
二、实验思路分析:
1、划分VLAN,由实验要求可知,PC1和PC3在VLAN2,PC2在VLAN3,PC4和PC5在VLAN4,PC6在VLAN5
2、创建VLAN并修改接口模式,VLAN2的接口模式为access,其他VLAN接口模式为hybird,交换机相连的接口为trunk
3、修改VLAN允许列表,按实验要求允许相应VLAN通过
4、SW1的e0/0/1口为hybrid,VLAN2带标签,VLAN3/4/5不带标签通过
5、R1创建子接口给VLAN3/4/5使用,物理接口给VLAN2
三、实验拓扑
VLAN实验_第2张图片
五、实验步骤:
SW1配置:

[SW1]vlan batch 2 to 5        创建VLAN
[SW1]int e0/0/2	
[SW1-Ethernet0/0/2]port link-type access       修改接口	模式为access
[SW1-Ethernet0/0/2]port default vlan 2       将接口划分	到VLAN2
[SW1-Ethernet0/0/3]port hybrid pvid vlan 3
[SW1-Ethernet0/0/3]port hybrid untagged vlan 3 4 5  修	改允许列表,不贴VLAN标签通过
[SW1]int e0/0/4	
[SW1-Ethernet0/0/4]port link-type trunk    修改接口模式	为trunk
[SW1-Ethernet0/0/4]port trunk allow-pass vlan 2 to 5 允许VLAN 2to5通过 
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port hybrid tagged vlan 2  贴标签
[SW1-Ethernet0/0/1]port hybrid untagged vlan 3 to 5  不贴标签

VLAN3 to 5合成一个广播域
VLAN实验_第3张图片
SW2配置

[SW2]vlan batch 2 to 5
[SW2]int e0/0/1	
[SW2-Ethernet0/0/1]port link-type trunk 
[SW2-Ethernet0/0/1]port trunk allow-pass vlan 2  to 5
[SW2]int e0/0/3
[SW2-Ethernet0/0/3]port link-type access 	
[SW2-Ethernet0/0/3]port default vlan 2
[SW2]int e0/0/4
[SW2-Ethernet0/0/4]port hybrid pvid vlan 4
[SW2-Ethernet0/0/4]port hybrid untagged vlan 3 to 4
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port link-type trunk 
[SW2-Ethernet0/0/2]port trunk allow-pass vlan 2 to 5

SW3配置

[SW3]int e0/0/1	
[SW3-Ethernet0/0/1]port link-type trunk 
[SW3-Ethernet0/0/1]port trunk allow-pass vlan 2 to 5
[SW3]vlan batch 2 to 5
[SW3]int e0/0/2
[SW3-Ethernet0/0/2]port hybrid pvid vlan 4	
[SW3-Ethernet0/0/2]port hybrid untagged vlan 3 to 4
[SW3]int e0/0/6
[SW3-Ethernet0/0/6]port hybrid pvid vlan 5
[SW3-Ethernet0/0/6]port hybrid untagged vlan 3 5

R1配置

【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]dot1q termination vid 2  虚拟子接口vid2
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]arp broadcast enable   开ARP请求
[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]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]arp broadcast enable 
[R1-GigabitEthernet0/0/0.1]q
[R1]dhcp enable   全局开启DHCP服务 
[R1]ip pool qyx
Info: It's successful to create an IP address pool.
[R1-ip-pool-qyx]network 192.168.1.0 mask 24  宣告网段
[R1-ip-pool-qyx]gateway-list 192.168.1.1
[R1-ip-pool-qyx]q
[R1]ip pool haha
Info: It's successful to create an IP address pool.
[R1-ip-pool-haha]network 192.168.2.0 mask 24
[R1-ip-pool-haha]gateway-list 192.168.2.1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global   接口开启dhcp服务
[R1-GigabitEthernet0/0/0]int g0/0/0.1	
[R1-GigabitEthernet0/0/0.1]dhcp select global 

每台PC获取IP地址
VLAN实验_第4张图片
VLAN实验_第5张图片
测试环节:
VLAN1的PCpingVLAN4的PC
VLAN实验_第6张图片
VLAN4的PCpingVLAN5的PC
VLAN实验_第7张图片
VLAN2的PCpingVLAN5的PC
VLAN实验_第8张图片
实验成功!

你可能感兴趣的:(HCIP,练习,网络)