[Huawei]dhcp enable   //开启DHCP功能

[Huawei]dhcp speed-limit auto  //开启DHCP报文动态限速功能

[Huawei-GigabitEthernet0/0/1]dhcp  select interface  //开启接口采用接口地址池的DHCP服务器功能

[Huawei-GigabitEthernet0/0/1]dhcp select global  //使能接口采用全局地址池的DHCP服务器功能

[Huawei]display dhcp server database  //查看DHCP数据的存放信息

[Huawei]dhcp server database enable   // 开启设备分配地址的数据保存功能

[Huawei]dhcp server database write-delay 7200  //配置数据保存的时间间隔,缺省每隔7200秒保存一次,并覆盖之前的数据文件

[Huawei]dhcp server database recover  //开启DHCP数据恢复功能

[Huawei]dhcp server ping packet 2  //配置设备分配IP地址时的冲突探测的次数,缺省为2

[Huawei]dhcp server ping timeout 500  //配置设备分配IP地址时每次冲突探测的最长等待时间,缺省为500毫秒

[Huawei]dhcp server  bootp  //开启DHCP Server应答BOOTP请求的功能

[Huawei]dhcp server bootp automatic  //开启DHCP服务器为BOOTP客户端动态分配地址的功能

[Huawei]ip pool a1  //创建全局地址池,进入全局地址池视图

[Huawei-ip-pool-a1]network 10.1.1.0 mask 24  //配置全局地址池可动态分配的IP地址范围

[Huawei-ip-pool-a1]vpn-instance b1  //配置地址池下的VPN实例, 使用同一个地址池为不同VPN网络中的客户端分配相同网段的IP地址

[Huawei-GigabitEthernet0/0/1]dhcp server excluded-ip-address 10.1.1.1 10.1.1.10  //配置地址池中不参与自动分配的IP地址

[Huawei-ip-pool-a1]excluded-ip-address 10.1.1.1 10.1.1.10  //配置地址池中不参与自动分配的IP地址

[Huawei-GigabitEthernet0/0/1]dhcp server static-bind ip-address 10.1.1.11 mac-address 1-2-3  //配置为指定DHCP Client分配固定IP地址

[Huawei-ip-pool-a1]static-bind ip-address 10.1.1.11 mac-address 1-2-3  //为指定DHCP Client分配固定IP地址

[Huawei-GigabitEthernet0/0/1]dhcp server lease day 1 hour 10 minute 50  //配置IP地址租期,缺省为1天

[Huawei-ip-pool-a1]lease day 1 hour 10 minute 50  //配置IP地址租期

[Huawei]display ip pool  //可以查看租约相关信息

[Huawei-ip-pool-a1]gateway-list 10.1.1.20  //配置DHCP Client的网关地址

[Huawei-GigabitEthernet0/0/1]dhcp server next-server 10.1.1.254  //指定客户端获取IP地址后下一步使用的文件服务器IP地址

[Huawei-ip-pool-a1]next-server 10.1.1.254  //配置客户端自动获取IP地址后下一步使用的文件服务器地址

[Huawei-GigabitEthernet0/0/1]dhcp server dns-list 8.8.8.8 114.114.114.114  //为DHCP Client指定DNS Server的IP地址

[Huawei-GigabitEthernet0/0/1]dhcp server domain-name a1  //配置分配给DHCP Client的DNS域名后缀

[Huawei-ip-pool-a1]dns-list 8.8.8.8 114.114.114.114

[Huawei-ip-pool-a1]domain-name a1  

[Huawei-GigabitEthernet0/0/1]dhcp server nbns-list 10.1.1.15  //配置DHCP Client的NetBIOS Server的IP地址

[Huawei-GigabitEthernet0/0/1]dhcp server netbios-type b-node  //配置DHCP Client的NetBIOS节点类型

[Huawei-ip-pool-a1]nbns-list 10.1.1.15

[Huawei-ip-pool-a1]netbios-type b-node

[Huawei-GigabitEthernet0/0/2]dhcp select relay  //使能接口的DHCP中继功能

[Huawei-GigabitEthernet0/0/2]dhcp relay server-ip 10.1.1.100  //配置DHCP服务器的IP地址

[Huawei]ip relay address cycle  //配置DHCP中继的轮询功能

[Huawei]dhcp server group a1

[Huawei-dhcp-server-group-a1]dhcp-server 10.1.1.100

[Huawei-dhcp-server-group-a1]gateway 10.1.1.10

[Huawei-dhcp-server-group-a1]vpn-instance b1

[Huawei-GigabitEthernet0/0/2]dhcp relay server-select a1  //配置接口应用的DHCP服务器组

[Huawei]dhcp relay trust  option82  //使能DHCP中继信任Option82选项功能

[Huawei-GigabitEthernet0/0/2]dhcp option82 insert enable  //配置在DHCP报文中添加Option82选项功能, DHCP报文中如果没有携带Option82选项,则插入Option82选项;如果携带了Option82选项,则判断Option82选项中是否包含remote-id,如果包含,则保持Option82选项不变,如果不包含,则插入remote-id

[Huawei-GigabitEthernet0/0/2]dhcp option8 rebuild enable  //配置在DHCP报文中添加Option82选项功能, DHCP报文中如果没有携带Option82选项,则插入Option82选项;如果携带了Option82选项,则删除该Option82选项并插入已经配置的Option82选项

[Huawei-vlan10]dhcp option82 insert enable  

[Huawei-vlan10]dhcp option82 rebuild enable

[Huawei]display dhcp relay all  //查看中继接口配置的DHCP服务器组或服务器信息

[Huawei]display dhcp server group a1  //查看DHCP服务器组的配置信息

[Huawei-GigabitEthernet0/0/1]ip add dhcp-alloc  //开启DHCP Client功能

[Huawei]dhcp client class-id 12  //配置DHCP客户端发送DHCP请求报文中的Option60字段

[Huawei-GigabitEthernet0/0/1]dhcp client hostname c1   //配置DHCP客户端的主机名

[Huawei-GigabitEthernet0/0/1]dhcp client client-id 1-2-3  //配置DHCP客户端的标识,缺省是客户端的MAC地址

[Huawei-GigabitEthernet0/0/1]dhcp client expected-lease 60  //,配置DHCP客户端的期望租期,缺省未配置

[Huawei-GigabitEthernet0/0/1]dhcp client gateway-detect period 1 retransmit 1 timeout 1  //配置DHCP客户端网关探测功能,缺省未配置

[Huawei]ip route 10.1.1.10 24 GigabitEthernet 0/0/1 dhcp  //配置DHCP客户端通过DHCP方式获取路由表项

[Huawei-GigabitEthernet0/0/1]dhcp client default-route preference 60  //配置DHCP客户端通过DHCP服务器获取的缺省路由优先级,缺省为60

[Huawei]display dhcp client  //查看DHCP客户端的状态信息

[Huawei-GigabitEthernet0/0/2]ip address bootp-alloc  //使能BOOTP客户端功能

[Huawei-GigabitEthernet0/0/2]dhcp client hostname b1  //配置BOOTP客户端的主机名

[Huawei-GigabitEthernet0/0/2]dhcp client client-id 10.1.1.1  //配置客户端的标识,缺省是客户端的MAC地址

[Huawei-GigabitEthernet0/0/2]dhcp client gateway-detect period 1 retransmit 1 timeout 1  //配置BOOTP客户端网关探测功能

[Huawei]ip route 10.1.1.10 24 g0/0/1 dhcp  //配置BOOTP客户端通过DHCP方式获取路由表项

[Huawei-GigabitEthernet0/0/2]dhcp client default-route preference 60  //配置DHCP客户端通过DHCP服务器获取的缺省路由优先级,缺省为60

[Huawei]display dhcp client  //查看DHCP客户端的状态信息

[Huawei]display dhcp server statistics  //查看设备作为DHCP Server接收和发送DHCP报文的统计信息

[Huawei]display dhcp relay statistics  //查看设备作为DHCP Relay接收和发送DHCP报文的统计信息

[Huawei]display dhcp client statistics  //查看设备作为DHCP Client接收和发送DHCP报文的统计信息

[Huawei]display dhcp statistics  //查看设备接收和发送DHCP报文的统计信息

<Huawei>reset dhcp server statistics   //清除设备作为DHCP服务器接收和发送DHCP报文的统计信息

<Huawei>reset dhcp relay statistics   //清除设备作为DHCP中继接收和发送DHCP报文的统计信息

<Huawei>reset dhcp client statistics   //清除设备作为DHCP客户端接收和发送DHCP报文的统计信息

<Huawei>reset dhcp statistics   //清除设备接收和发送DHCP报文的统计信息

<Huawei>reset ip pool interface g0/0/1 all  //复位接口上已经配置的DHCP地址池

<Huawei>reset ip pool name a1 all  //复位全局配置的DHCP地址池

[Huawei-GigabitEthernet0/0/1]dhcp relay release 10.1.1.10 1234-2345-5678  //向DHCP服务器申请释放DHCP客户端已经获取到的IP地址

[Huawei-ip-pool-a1]lock  //锁定DHCP地址池

[Huawei-vlan10]dhcp policy-vlan mac-address 1-2-3  //配置基于MAC地址的DHCP策略VLAN

[Huawei-vlan10]dhcp policy-vlan port GigabitEthernet 0/0/1  //配置基于接口的DHCP策略VLAN

[Huawei-vlan10]dhcp policy-vlan generic  //配置普通DHCP策略VLAN

[Huawei]display current-configuration | include dhcp policy-vlan  //查看DHCP策略VLAN的相关配置