华为3026交换机VLAN实验(虚拟平台)手记
在一点通模拟软件上,进行了交换机VLAN实验。
实验过程如下:
[SwitchA]vlan 2 //进入VLAN 2配置状态
[SwitchA-vlan2]port e0/3 to e0/4 //建立虚拟通道3、4
[SwitchA-vlan2]vlan 3
[SwitchA-vlan3]port e0/5 to e0/6 //建立虚拟通道5、6
[SwitchA]dis vlan all //显示虚拟配置情况
[SwitchA]dis current //显示所有配置
[SwitchB]vlan 2
[SwitchB-vlan2]port e0/3 to e0/4
[SwitchB-vlan2]vlan 3
[SwitchB-vlan3]port e0/5 to e0/6
[SwitchB-vlan3]quit
[SwitchB]dis vlan all
[SwitchB]dis current
设置计算机的IP为:
PCA:192.168.1.2 PCB:192.168.1.3 PCC:192.168.1.4 PCD:192.168.1.5
[root@PCA root]#ping 192.168.1.2 通 (本机IP)
[root@PCA root]#ping 192.168.1.4 不通 (中间连接线是vlan 1)
[root@PCA root]#ping 192.168.1.3 不通 (不同vlan)
[root@PCA root]#ping 192.168.1.5 不通 (不同vlan)
[root@PCB root]#ping 192.168.1.5 不通 (中间连接线是vlan 1)
设置trunk:
交换机的端口工作模式一般可以分为Access(普通模式),Multi(多vlan模式),Trunk(中继模式)三种;trunk模式是两台交换机在划分VLAN时通信的主干,是一种封装技术。
[S3026A]interface ethernet0/8
[S3026A-Ethernet0/8]port link-type trunk
[S3026A-Ethernet0/8]port trunk permit vlan all
[S3026B]interface ethernet0/1
[S3026B-Ethernet0/1]port link-type trunk //建立端口类型为trunk
[S3026B-Ethernet0/1]port trunk permit vlan all //允许所有trunk端口虚拟访问
[S3026B-Ethernet0/1]quit
[S3026B]dis curr
[root@PCA root]#ping 192.168.1.4 通 (相同vlan)
[root@PCA root]#ping 192.168.1.3 不通 (不同vlan)
由此可见,VLAN可以实现同一网络下,不同的访问区域。这种方法适合在公司多个部门,但不能互访的实际中应用。

没有评论:
发表评论