I saw an interesting problem with our DHCP Server today.
I was troubleshooting a LaserJet with an IP conflict and found it had been set manually on the printer but not reserved in the relevant DHCP scope. I had a specific different IP I wanted it to have which was definitely free and so I tried to add a reservation in DHCP. I got the error “The specified address is not available”. This continued to happen no matter what un-leased and un-pingable IP address I tried. (I had a reason for not letting the printer just grab one via DHCP instead. Indeed, given what happened next, I’m not sure whether it would have even got one.)
I noticed that in the DHCP GUI, there was a reservation listed which had “BAD ADDRESS” next to its name and also the IP it was set to reserve was outside the address pool currently on that scope. I pinged that address and there was an answer so I was not keen just to delete the entry without knowing what it was. It didn’t respond to getmac and I was not on the same VLAN to be able to query my ARP cache.
I used netsh as follows to see what was going on in DHCP:
netsh dhcp server \\<DHCP_Server_Name> scope <Network_IP_of_Scope> show reservedip
This showed the same out-of-scope IP address but with the MAC address of the printer I was trying to add listed against it instead of “BAD ADDRESS”! I therefore knew I could safely remove this reservation. I decided that since the GUI looked in poorer health than the command line, then I would use the command line. But then I get a kick out of using the command line anyway…
delete reservedip <IP_Address> <MAC_Address>
A repeat of the show reservedip revealed all was now well.
I was then able to add the correct reservation to the scope and fix the original printer problem.
To check the health of that scope, I also ran the following command from within the scope context of netsh.exe:
Without adding fix on the end of that command, it just reports back any problems – which is a wise first move! There were no inconsistences.