一、交换机DHCP配置举例

[switch]dhcp enable

[switch]ip pool pool1

[switch-ip-pool-pool1]network 10.0.20.0 mask 255.255.255.0

[switch-ip-pool-pool1]dns-list 10.0.10.2

[switch-ip-pool-pool1]gateway-list 10.0.20.1

[switch-ip-pool-pool1]lease day 3

[switch-ip-pool-pool1]quit

[switch]interface vlanif 20

[switch-vlanif20]dhcp select global

[switch-vlanif20]quit

二、路由器DHCP配置

system-view

[Router]interface GigabitEthernet0/0/1

[Router-interface GigabitEthernet0/0/1]ip address 10.10.1.1 255.255.255.128

[Router-interface GigabitEthernet0/0/1]dhcp select global //接口工作在全局地址池模式

[Router-interface GigabitEthernet0/0/1]quit

[Router]ip pool pool1

[Router-ip-pool-pool1]network 10.10.1.0 mask 255.255.255.128

[Router-ip-pool-pool1]excluded-ip-address 10.10.1.2

[Router-ip-pool-pool1]dns-list 10.10.1.2 //设置DNS

[Router-ip-pool-pool1]gateway-list 10.10.1.1 //设置默认网关

[Router-ip-pool-pool1]lease day30 hour 0 minute 0

[Router-ip-pool-pool1]domain-name abc.com

[Router-ip-pool-pool1]