1.创建VLAN
<Huawei>system-view
[L1]vlan 2
[L1-vlan2]quit
[L1]interface e0/0/2
[L1-Ethernet0/0/2]port link-type access
[L1-Ethernet0/0/2]port default vlan 2
[L1-Ethernet0/0/2]quit
[L1]vlan 3
[L1-vlan3]quit
[L1]interface e0/0/3
[L1-Ethernet0/0/3]port link-type access
[L1-Ethernet0/0/3]port default vlan 3
[L1-Ethernet0/0/3]quit
[L1]vlan 4
[L1-vlan4]quit
[L1]interface e0/0/4
[L1-Ethernet0/0/4]port link-type access
[L1-Ethernet0/0/4]port default vlan 4
[L1-Ethernet0/0/4]quit
[L1]vlan 5
[L1-vlan5]quit
[L1]interface e0/0/5
[L1-Ethernet0/0/5]port link-type access
[L1-Ethernet0/0/5]port default vlan 5
[L1-Ethernet0/0/5]quit
[L1]display vlan
[L1]interface e0/0/1
[L1-Ethernet0/0/1]port link-type trunk
[L1-Ethernet0/0/1]port trunk allow-pass vlan all
2.配置dhcp
[dhcp]dhcp enable
[dhcp]interface g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]dot1q termination vid 2
[dhcp-GigabitEthernet0/0/0.1]quit
[dhcp]interface g0/0/0.2
[dhcp-GigabitEthernet0/0/0.2]dot1q termination vid 3
[dhcp-GigabitEthernet0/0/0.2]quit
[dhcp]interface g0/0/0.3
[dhcp-GigabitEthernet0/0/0.3]dot1q termination vid 4
[dhcp-GigabitEthernet0/0/0.3]quit
[dhcp]interface g0/0/0.4
[dhcp-GigabitEthernet0/0/0.4]dot1q termination vid 5
[dhcp-GigabitEthernet0/0/0.4]quit
[dhcp]interface g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]ip address 172.16.1.1 24
[dhcp-GigabitEthernet0/0/0.1]q
[dhcp]interface g0/0/0.2
[dhcp-GigabitEthernet0/0/0.2]ip address 172.16.2.1 24
[dhcp-GigabitEthernet0/0/0.2]q
[dhcp]interface g0/0/0.3
[dhcp-GigabitEthernet0/0/0.3]ip address 172.16.3.1 24
[dhcp-GigabitEthernet0/0/0.3]q
[dhcp]interface g0/0/0.4
[dhcp-GigabitEthernet0/0/0.4]ip address 172.16.4.1 24
[dhcp]ip pool 1
[dhcp-ip-pool-1]network 172.16.1.0 mask 24
[dhcp-ip-pool-1]gateway-list 172.16.1.1
[dhcp-ip-pool-1]dns-list 8.8.8.8 114.114.114.114
[dhcp-ip-pool-1]q
[dhcp]ip pool 2
[dhcp-ip-pool-2]network 172.16.2.0 mask 24
[dhcp-ip-pool-2]gateway-list 172.16.2.1
[dhcp-ip-pool-2]dns-list 8.8.8.8 114.114.114.114
[dhcp-ip-pool-2]q
[dhcp]ip pool 3
[dhcp-ip-pool-3]network 172.16.3.0 mask 24
[dhcp-ip-pool-3]gateway-list 172.16.3.1
[dhcp-ip-pool-3]dns-list 8.8.8.8 114.114.114.114
[dhcp-ip-pool-3]q
[dhcp]ip pool 4
[dhcp-ip-pool-4]network 172.16.4.0 mask 24
[dhcp-ip-pool-4]gateway-list 172.16.4.1
[dhcp-ip-pool-4]dns-list 8.8.8.8 114.114.114.114
[dhcp-ip-pool-4]q
[dhcp]interface g0/0/0.1
[dhcp-GigabitEthernet0/0/0.1]dhcp select global
[dhcp-GigabitEthernet0/0/0.1]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.1]q
[dhcp]interface g0/0/0.2
[dhcp-GigabitEthernet0/0/0.2]dhcp select global
[dhcp-GigabitEthernet0/0/0.2]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.2]q
[dhcp]interface g0/0/0.3
[dhcp-GigabitEthernet0/0/0.3]dhcp select global
[dhcp-GigabitEthernet0/0/0.3]arp broadcast enable
[dhcp-GigabitEthernet0/0/0.3]q
[dhcp]interface g0/0/0.4
[dhcp-GigabitEthernet0/0/0.4]dhcp select global
[dhcp-GigabitEthernet0/0/0.4]arp broadcast enable