关于vlan虚拟局域网的相关配置:
交换机接口模式有:
Access 模式:用来连接终端、电脑、打印机。
trunk 模式:用来连接其他交换机。
首先我们对pc1,pc2进行IP地址配置 相同网段,这时我们在其中一台设备Ping另一台设备可以成功配通。那么我们开始vlan配置(在交换机中配置,当然了图里就交换机和pc。
<Huawei>system-view
[Huawei]vlan 10 //添加vlan接口 设定号码为10
[Huawei-vlan10]
Feb 2 2024 21:18:14-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.1
[Huawei-vlan10]q //退出当前模式
[Huawei]vlan 20 //添加vlan接口 设定号码为20
[Huawei-vlan20]q
[Huawei]
Feb 2 2024 21:18:44-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.dis
[Huawei]display vlan
这时我们可以调用
[Huawei-port-group-discardq]display vlan //查看当前配置的vlan
我们配置了vlan 10 和 vlan 20 但我们没有去使用它,接下来要把交换机的端口划到相关vlan中。
[Huawei]int g0/0/1 //进入1号端口
[Huawei-GigabitEthernet0/0/1]port link-type access //将该端口模式设定为Access模式
[Huawei-GigabitEthernet0/0/1]port default vlan 10 //将该端口划分为vlan 10
[Huawei-GigabitEthernet0/0/1]
Feb 2 2024 21:24:34-08:00 Huawei 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, t
he change loop count is 0, and the maximum number of records is 4095.
[Huawei-GigabitEthernet0/0/1]q //退出
[Huawei]int g0/0/2 //如上,划分2号端口
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 20
[Huawei-GigabitEthernet0/0/2]
Feb 2 2024 21:25:09-08:00 Huawei %%01IFNET/4/IF_STATE(l)[0]:Interface Vlanif1 h
as turned into DOWN state.
Feb 2 2024 21:25:14-08:00 Huawei 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 12, t
he change loop count is 0, and the maximum number of records is 4095.