Cisco DHCP Configuration
DHCP在RF2131中定义,使用UDP协议进行数据报传递,使用67,68端口
Cisco IOS 12.0 T1以后可以配置为DHCP relay,DHCP Client,DHCP Service
- DHCP Relay configuration
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip helper-address 10.1.1.1 指定DHCP服务器IP
事实上ip helper-address命令不只转发DHCP请求包,默认还转发其它UDP报,如DNS请求,同时会转发用其定义过的所有服务器IP,无疑会增加服务器负担,引发网络问题,可以通过如下命令禁止一些无意义的UDP广播转发:
Router(config)#no ip forward-protocol udp ?
- DHCP Client configuration
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip address dhcp client-id fa0/0 开启DHCP客户端,从fa0/0接口动太获取IP (不建议将路由器配置成DHCP Client,一般用于当路由器作为网络边界连接到ISP时)
- DHCP Server configuration
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#service dhcp 开启DHCP
Router(config-if)#ip dhcp pool 10.1.1.0/24 定义DHCP pool
Router(config-if)#network 10.1.1.0 255.255.255.0 定义地址范围
Router(config-if)#default-router 10.1.1.1 定义默认网关
Router(config-if)#exit
Router(config)#ip dhcp excluded-address 10.1.1.100 10.1.1.150 定义排除地址范围
Router(config-if)#end