首先,我是在vlanif下启用dhcp的。
[2#-1F-Core1-Vlanif2]display this # interface Vlanif2 ip address 172.16.15.1 255.255.254.0 dhcp select interface dhcp server excluded-ip-address 172.16.15.80 172.16.15.254 dhcp server static-bind ip-address 172.16.15.69 mac-address 040e-3c22-3de2 dhcp server static-bind ip-address 172.16.15.70 mac-address f439-0929-07ac dhcp server static-bind ip-address 172.16.15.75 mac-address c051-7e6b-68f5 dhcp server static-bind ip-address 172.16.15.77 mac-address c051-7e72-665e dhcp server static-bind ip-address 172.16.15.78 mac-address c051-7e6b-5b7f dhcp server static-bind ip-address 172.16.15.79 mac-address c051-7e72-58a0 dhcp server dns-list 172.16.128.5 172.16.128.6 # |
除了在在vlanif下要启用dhcp,还需要在配置模式下输入dhcp enable。
我在vlanif 2下面要绑定一个MAC地址的IP,命令如下,
[2#-1F-Core1-Vlanif2]dhcp server static-bind ip-address 172.16.15.69 mac-address 040e-3c22-3de2
结果报以下错误
error: This IP address is conflicting, and only idle or expired IP addresses can be statically bound.
意思是说:IP地址冲突,只能静态绑定空闲或过期的IP地址。
用命令quit退回到视频模式,就是输入帐号和密码后的模式,到了视频模式下输入下面的命令清一下IP地址。
<2#-1F-Core1>reset ip pool interface Vlanif2 172.16.15.69
再输入sys进入管理模式,
输入interface Vlanif2进入Vlanif2的接口模式,
再次输入绑定命令,成功了。
[2#-1F-Core1-Vlanif2]dhcp server static-bind ip-address 172.16.15.69 mac-address 040e-3c22-3de2
下面这个命令可以统计Vlanif2下的DHCP信息。
[2#-1F-Core1]disp ip pool interface Vlanif2 all
----------------------------------------------------------------------------------------------
Index IP Client-ID Type Left Status
----------------------------------------------------------------------------------------------
321 172.16.15.66 2cc5-463b-8e4e DHCP 75972 Used
322 172.16.15.67 1062-e503-9407 DHCP - Expired
323 172.16.15.68 - - - Idle
324 172.16.15.69 040e-3c22-3de2 DHCP - Static-bind
325 172.16.15.70 f439-0929-07ac DHCP - Static-bind used
326 172.16.15.71 - - - Idle
327 172.16.15.72 - - - Idle
328 172.16.15.73 - - - Conflict