Cisco ios DHCP-server基本配置
 
1.       启动dhcp服务,禁用ip冲突检测记录
service dhcp
no ip dhcp conflict logging
 
2. dhcp不分配的地址
ip dhcp excluded-address 10.10.0.1 10.10.0.2
ip dhcp excluded-address 10.0.0.1
ip dhcp excluded-address 10.20.0.1 10.20.0.2
ip dhcp excluded-address 10.30.0.1
 
3.配置要分配的地址池
ip dhcp pool Root-pool
   network 10.10.0.0 255.255.255.0
   domain-name cnca.gov.cn
   dns-server 192.168.2.2
   default-router 10.10.0.2
ip dhcp pool pool2
   network 10.20.0.0 255.255.255.0
ip dhcp pool pool3
   network 10.30.0.0 255.255.255.0
 
配置DHCP代服务器
1. 使用ip helper-address命令指向dhcp服务器的地址
interface FastEthernet1/0
 ip address 10.20.0.1 255.255.255.0
 ip helper-address 10.10.0.1
Dhcp客户端使用udp广播来发送discover消息,配置ip helper-address命令的接口收到udp广播将该广播转变成单播,并通过其他端口转发到该命令指定的单播ip地址
dhcp
服务器地址池必须包括dhcp代理接口地址段的地址,否则连接dhcp代理的终端机器无法得到地址。
 
2.       配置ip forword-protocol 选择转发的协议和端口
默认转发前往所有已知UDP端口的分组
no ip forward-protocol udp time
no ip forward-protocol udp netbios-ns
no ip forward-protocol udp netbios-dgm
代理服务器在收到udp广播时,插入82选项,当dhcp服务器转发给代理服务器dhcp消息后,代理服务器对消息中的82选项进行删除
 
Debug dhcp命令
sh ip dhcp binding
sh ip dhcp pool
clear ip dhcp binding
clear ip dhcp server statistics
debug dhcp detail
debug ip dhcp event
debug ip dhcp server linkage
debug ip dhcp server packet