华为交换机——VLAN配置实验:基于端口划分Vlan
·
一、简单的概念解释
VLAN(Virtual Local Area Network ):通过在交换机上部署VLAN机制,可以将一个规模较大的广播域在逻辑上划分成若干个不同的、规模较小的广播域,由此便可以有效地提升网络的安全性,同时减少了垃圾流量,节约网络资源。
一个LVAN就是一个广播域,所以在同一个VLAN内部,计算机之间的通信就是二层通信。如果源计算机与目的计算机位于不同VLAN中,那么他们之间是无法进行二层通信的,只能进行三层通信来传递信息。
二、实验拓扑
三、实验配置
1.首先进行SW1的配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW1
[SW1]
May 14 2022 16:32:33-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1]VL
[SW1]vlan 6
[SW1-vlan6]Q
[SW1]VLAN 8
[SW1-vlan8]
[SW1-vlan8]Q
分别创建6和8的VLAN,创建了VLAN后,里面并没有任何端口,因此,我们需要将端口和对应的Vlan关联起来。
[SW1]int e 0/0/1
#进入端口
[SW1-Ethernet0/0/1]port l
[SW1-Ethernet0/0/1]port link-type acc
[SW1-Ethernet0/0/1]port link-type access
#缺省端口类型为Hybrid,我们需要将端口类型改成 Access
[SW1-Ethernet0/0/1]port default v
[SW1-Ethernet0/0/1]port default vlan 6
#把接口划分到我们创建的 vlan 6中
接下来我们需要对Ethernet0/0/10的端口进行Trunk 配置
[SW1]int e
[SW1]int Eth0/0/10
[SW1-Ethernet0/0/10]port link-t
[SW1-Ethernet0/0/10]port link-type tr
[SW1-Ethernet0/0/10]port link-type trunk
#这里的端类型就不是Access了,而是Trunk ,我们需要两台交换机进行Trunk
[SW1-Ethernet0/0/10]q
检查配置情况:
[SW1]dis port v
Port Link Type PVID Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1 access 6 - # Vlan 6
Ethernet0/0/2 access 8 - # Vlan 8
Ethernet0/0/3 hybrid 1 -
Ethernet0/0/4 hybrid 1 -
Ethernet0/0/5 hybrid 1 -
Ethernet0/0/6 hybrid 1 -
Ethernet0/0/7 hybrid 1 -
Ethernet0/0/8 hybrid 1 -
Ethernet0/0/9 hybrid 1 -
Ethernet0/0/10 trunk 1 1 #Trunk 1
Ethernet0/0/11 hybrid 1 -
Ethernet0/0/12 hybrid 1 -
Ethernet0/0/13 hybrid 1 -
Ethernet0/0/14 hybrid 1 -
Ethernet0/0/15 hybrid 1 -
Ethernet0/0/16 hybrid 1 -
Ethernet0/0/17 hybrid 1 -
Ethernet0/0/18 hybrid 1 -
Ethernet0/0/19 hybrid 1 -
Ethernet0/0/20 hybrid 1 -
Ethernet0/0/21 hybrid 1 -
Ethernet0/0/22 hybrid 1 -
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 hybrid 1 -
注意,在Trunk 的Vlan列表中,缺省情况下,只允许Vlan 1,但我们是Vlan 6 和vlan 8,
所以需要把我们创建的两个Vlan 加进去。
[SW1]int e0/0/10
[SW1-Ethernet0/0/10]port tr
[SW1-Ethernet0/0/10]port trunk allow-pass v
[SW1-Ethernet0/0/10]port trunk allow-pass vlan 6 8
[SW1-Ethernet0/0/10]q
到这里,SW1交换机就配置成功了。
2.对SW2进行配置
[Huawei]sys SW2
[SW2]vlan
[SW2]vlan b
[SW2]vlan batch 6 8
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]
May 14 2022 16:37:43-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2]
[SW2]
[SW2]
[SW2]int e 0/0/3
[SW2-Ethernet0/0/3]port link-type a
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default
[SW2-Ethernet0/0/3]port default vlan 6
[SW2-Ethernet0/0/3]q
[SW2]
May 14 2022 16:39:03-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.int
^
Error:Incomplete command found at '^' position.
[SW2]int e0/0/4
[SW2-Ethernet0/0/4]port l
[SW2-Ethernet0/0/4]port link-t
[SW2-Ethernet0/0/4]port link-type as
[SW2-Ethernet0/0/4]port link-type a
[SW2-Ethernet0/0/4]port link-type access
[SW2-Ethernet0/0/4]poet de
[SW2-Ethernet0/0/4]port default vlan 8
[SW2-Ethernet0/0/4]q
[SW2]int e 0/0/5
[SW2-Ethernet0/0/5]port link-t
[SW2-Ethernet0/0/5]port link-type access
[SW2-Ethernet0/0/5]
May 14 2022 16:40:13-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.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.
[SW2-Ethernet0/0/5]port de
[SW2-Ethernet0/0/5]port default v
[SW2-Ethernet0/0/5]port default vlan 8
[SW2-Ethernet0/0/5]q
[SW2]int e0/0/10
[SW2-Ethernet0/0/10]por
[SW2-Ethernet0/0/10]port l
[SW2-Ethernet0/0/10]port link-type trunk
[SW2-Ethernet0/0/10]port
[SW2-Ethernet0/0/10]port trunk allow-pass v
[SW2-Ethernet0/0/10]port trunk allow-pass vlan all
[SW2-Ethernet0/0/10]q
[SW2]dis port vlan
Port Link Type PVID Trunk VLAN List
-------------------------------------------------------------------------------
Ethernet0/0/1 hybrid 1 -
Ethernet0/0/2 hybrid 1 -
Ethernet0/0/3 access 6 -
Ethernet0/0/4 access 8 -
Ethernet0/0/5 access 8 -
Ethernet0/0/6 hybrid 1 -
Ethernet0/0/7 hybrid 1 -
Ethernet0/0/8 hybrid 1 -
Ethernet0/0/9 hybrid 1 -
Ethernet0/0/10 trunk 1 1-4094
Ethernet0/0/11 hybrid 1 -
Ethernet0/0/12 hybrid 1 -
Ethernet0/0/13 hybrid 1 -
Ethernet0/0/14 hybrid 1 -
Ethernet0/0/15 hybrid 1 -
Ethernet0/0/16 hybrid 1 -
Ethernet0/0/17 hybrid 1 -
Ethernet0/0/18 hybrid 1 -
Ethernet0/0/19 hybrid 1 -
Ethernet0/0/20 hybrid 1 -
Ethernet0/0/21 hybrid 1 -
Ethernet0/0/22 hybrid 1 -
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 hybrid 1 -
[SW2]
配置完成。
三、测试通信
PC1→PC3
PC2→PC4、server
没问题!
更多推荐
已为社区贡献1条内容
所有评论(0)