配置命令:
<Huawei>sys
Enter system view, return user view withCtrl+Z.
[Huawei]sysna
[Huawei]sysname dhcp
[dhcp]vlan 11
[dhcp-vlan11]vlan 22
[dhcp-vlan22]qu
[dhcp]interface vlan11
[dhcp-Vlanif11] ip add
[dhcp-Vlanif11]ip add 192.168.0.254255.255.255.0
[dhcp-Vlanif11]inter vlan 22
[dhcp-Vlanif22]
[dhcp-Vlanif22]ip add 192.168.2.254255.255.255.0
[dhcp-Vlanif22]
[dhcp-Vlanif22]qu
[dhcp]interface g
[dhcp]interface GigabitEthernet 0/0/1
[dhcp-GigabitEthernet0/0/1]port link-typeaccess
[dhcp-GigabitEthernet0/0/1]port defaultvlan 11
[dhcp-GigabitEthernet0/0/1]
[dhcp-GigabitEthernet0/0/1]inter g0/0/2
[dhcp-GigabitEthernet0/0/2]port link-t
[dhcp-GigabitEthernet0/0/2]port link-typeacc
[dhcp-GigabitEthernet0/0/2]port link-typeaccess
[dhcp-GigabitEthernet0/0/2]port def
[dhcp-GigabitEthernet0/0/2]port default vla
[dhcp-GigabitEthernet0/0/2]port defaultvlan 22
[dhcp-GigabitEthernet0/0/2]qu
[dhcp]
[dhcp]dhcp enable
Info: The operation may take a few seconds.Please wait for a moment.done.
[dhcp]
[dhcp]ip pool vlan11
Info:It‘s successful to create an IPaddress pool.
[dhcp-ip-pool-vlan11]gateway-list192.168.0.254
[dhcp-ip-pool-vlan11]network 192.168.0.0mask 255.255.255.0
[dhcp-ip-pool-vlan11]dns-list202.102.224.68
[dhcp-ip-pool-vlan11]qu
[dhcp]
[dhcp]ip pool vlan22
Info:It‘s successful to create an IPaddress pool.
[dhcp-ip-pool-vlan22]
[dhcp-ip-pool-vlan22]gateway-list192.168.2.254
[dhcp-ip-pool-vlan22]network 192.168.2.0mask 255.255.255.0
[dhcp-ip-pool-vlan22]dns-list202.102.224.68
[dhcp-ip-pool-vlan22]excluded-ip-address192.168.2.253
[dhcp-ip-pool-vlan22]qu
[dhcp]
[dhcp]quit
<dhcp>
<dhcp>save
The current configuration will be writtento the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to theslot 0.
Oct 22 2014 15:07:36-08:00 dhcp%%01CFM/4/SAVE(l)[0]:The user chose Y when decidi
ng whether to save the configuration to thedevice.
Save the configuration successfully.
<dhcp>
-------------------------------------------------------------------------------------
最终配置结果:
<dhcp>dis current-configuration
#
sysname dhcp
#
vlan batch 11 22
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
ip pool pool1
gateway-list 192.168.0.254
network 192.168.0.0 mask 255.255.255.0
dns-list 202.102.224.68
#
ip pool vlan1
#
ip pool vlan22
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
excluded-ip-address 192.168.2.253
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface Vlanif11
ipaddress 192.168.0.254 255.255.255.0
dhcpselect global
#
interface Vlanif22
ipaddress 192.168.2.254 255.255.255.0
dhcpselect global
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
portlink-type access
portdefault vlan 11
#
interface GigabitEthernet0/0/2
portlink-type access
portdefault vlan 22
#
interface GigabitEthernet0/0/3
………………
验证配置结果,并测试: