全局的DHCP
SW1
[Huawei]port-group group-member Ethernet 0/0/1 e0/0/2 e0/0/3 //把e0/0/1 e0/0/2 e0/0/3 加入组
[Huawei-port-group]port link-type access //把这个组加入access
[Huawei-port-group]port default vlan 10 //把这个组加入VLAN 10
AR1
[AR1]dhcp enable //全局开启DHCP服务
[AR1]ip pool p1 //创建地址池并命名
[AR1-ip-pool-p1]network 192.168.1.0 mask 255.255.255.0 //分配终端要获取的网段信息
[AR1-ip-pool-p1]gateway-list 192.168.1.254 //配置下发的网关地址
[AR1-ip-pool-p1]dns-list 8.8.8.8 //配置下发的DNS地址
[AR1-ip-pool-p1]lease day 3 //配置分配的租期时间
[AR1]interface GigabitEthernet0/0/0 //进入g0/0/0接口
[AR1-GigabitEthernet0/0/0]ip address 192.168.1.254 24 //接口的地址就是网关地址
[AR1-GigabitEthernet0/0/0]dhcp select global //在接口开启DHCP功能
基于接口的DHCP
AR1
[Huawei]dhcp enable //全局开启DHCP服务
[AR1]interface GigabitEthernet0/0/0 //进入g0/0/0接口
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.254 24 //配置网关地址(相当于非配了网段)
[Huawei-GigabitEthernet0/0/0]dhcp select interface //接口下开启DHCP功能
[Huawei-GigabitEthernet0/0/0]dhcp server dns-list 4.4.4.4 //配置DNS地址
[Huawei-GigabitEthernet0/0/0]dhcp server lease day 6 //配置租期时间
[Huawei-GigabitEthernet0/0/0]dhcp server excluded-ip-address 192.168.2.200 192.168.2.253 //配置保留的IP地址范围
中继配置
SW1
[SW1]vlan 10 //创建vlan 10
[Huawei]port-group group-member Ethernet 0/0/1 e0/0/2 //把e0/0/1 e0/0/2 加入组
[Huawei-port-group]port link-type access //把这个组加入access
[Huawei-port-group]port default vlan 10 //把这个组加入VLAN 10
AR1 DHCP服务器
[Huawei]dhcp enable //全局开启DHCP服务
[AR1]ip pool 1314 //创建地址池
[AR1-ip-pool-1314]network 192.168.10.0 mask 255.255.255.0 //分配终端要获取的网段信息
[AR1-ip-pool-1314]gateway-list 192.168.10.254 //配置下发的网关地址
[AR1-ip-pool-1314]dns-list 1.3.1.4 //配置下发的DNS地址
[AR1-ip-pool-1314]excluded-ip-address 192.168.10.100 192.168.10.100 设置保留地址
[AR1-ip-pool-1314]lease day 3 //配置分配的租期时间
[AR1]interface GigabitEthernet 0/0/0 //进入g0/0/0接口
[AR1]ip address 192.168.20.1 255.255.255.0 //配置IP地址
[AR1] dhcp select global //在接口开启DHCP功能
[AR1]ip route-static 192.168.10.0 24 192.168.20.2 吓一跳
AR2 DHCP中继
[AR2]dhcp enable //全局开启DHCP服务
[AR2]interface GigabitEthernet 0/0/1 //进入接口g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 192.168.20.2 24 配置IP地址
[AR2]interface GigabitEthernet0/0/0 //进入接口g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 192.168.10.254 24 //配置IP地址的网关
[AR2-GigabitEthernet0/0/0]dhcp select relay //进入接口上应用DHCP中继功能
[AR2-GigabitEthernet0/0/0]dhcp relay server-ip 192.168.20.1 //指向DHCP服务器的IP地址
原文地址:http://blog.51cto.com/13934244/2298930