DHCP的基本配置:

拓扑见QQ收藏:

DHCP服务器的配置:
[DHCP Server]int g0/0
[DHCP Server-GigabitEthernet0/0]ip add 12.1.1.1 24
[DHCP Server-GigabitEthernet0/0]un sh
[DHCP Server]dhcp enable   开启DHCP功能
[DHCP Server]dhcp server ip-pool H3C   定义地址池名为H3C
[DHCP Server-dhcp-pool-H3C]network 192.168.1.0 mask 255.255.255.0
[DHCP Server-dhcp-pool-H3C]gateway-list 192.168.1.254
[DHCP Server-dhcp-pool-H3C]dns-list 5.5.5.5
[DHCP Server-dhcp-pool-H3C]expired day 5   租期5天
[DHCP Server]dhcp server forbidden-ip 192.168.1.100 192.168.1.254  排除地址

DHCP中继的配置:
[R2]vlan  10
[R2-vlan10]port g1/0/1
[R2-vlan10]port g1/0/2
[R2-vlan10]int vlan 10
[R2-Vlan-interface10]ip add 192.168.1.254 24
[R2-Vlan-interface10]un sh
[R2]int g1/0/3
[R2-GigabitEthernet1/0/3]port link-mode route
[R2-GigabitEthernet1/0/3]ip add 12.1.1.2 24
[R2-GigabitEthernet1/0/3]un sh
[R2]dhcp enable
[R2]int  vlan 10
[R2-Vlan-interface10]dhcp select relay  开启中继
[R2-Vlan-interface10]dhcp relay server-address 12.1.1.1  服务器的接口地址