未创建vlan默认vlan1,可创建不同的vlan,不同vlan不能通信,相同vlan下可通信
同一路由器交换机下创建几个广播域
1创建新的vlan
[Huawei]vlan batch 2 to 4
Info: This operation may take a few seconds. Please wait for a moment...done.
2将接口划入新的vlan
[Huawei]interface e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
Nov 22 2022 22:49:17-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.v
[Huawei-Ethernet0/0/2]port default vlan 2
3通往路由器的接口默认属于vlan1,用trunk干道承载所以vlan通往路由器
[Huawei]interface e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
Nov 22 2022 22:52:17-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-Ethernet0/0/1]port trunk allow-pass vlan all
4创建虚拟子接口属于不同vlan,配置IP pool下发IP或给电脑配置静态ip
[Huawei]interface g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 3
[Huawei-GigabitEthernet0/0/0.2]ip address 2.2.2.1 24
Nov 22 2022 22:55:01-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/0.2 has entered the UP state.