1. 创建 VLAN:

[HUAWEI] system-view [HUAWEI] vlan batch 10 20 30 40 //一次性创建 VLAN 10、20、30、40

  1. 配置端口:

[HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] port link-type access [HUAWEI-GigabitEthernet0/0/1] port default vlan 10 //将端口设置为 VLAN 10

  1. 配置子接口:

[HUAWEI] interface gigabitethernet 0/0/1.10 //创建子接口,VLAN ID为10 [HUAWEI-GigabitEthernet0/0/1.10] port link-type hybrid [HUAWEI-GigabitEthernet0/0/1.10] port hybrid vlan 10 untagged //将子接口设置为 VLAN 10,同时设置为未打标签

  1. 配置 Trunk 端口:

[HUAWEI] interface gigabitethernet 0/0/2 [HUAWEI-GigabitEthernet0/0/2] port link-type trunk [HUAWEI-GigabitEthernet0/0/2] port trunk allow-pass vlan 10 20 30 //将端口设置为 Trunk 模式,允许通过 VLAN 10、20、30 的数据

  1. 配置 IP 地址:

[HUAWEI] interface vlanif 10 [HUAWEI-Vlanif10] ip address 192.168.1.1 24 //为 VLAN 10 配置 IP 地址为 192.168.1.1/24

  1. 配置 DHCP:

[HUAWEI] dhcp enable [HUAWEI] interface vlanif 10 [HUAWEI-Vlanif10] dhcp select interface [HUAWEI-Vlanif10] dhcp server dns-list 8.8.8.8 //开启 DHCP 功能,为 VLAN 10 设置 DNS 服务器地址为 8.8.8.8


原文地址: https://www.cveoy.top/t/topic/m6wD 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录