1

I have a handful of devices which are normally in separate networks (or perhaps not even connected to a network), and they use DHCP to get their IP addresses. Now I would like to run some script on each of them, eg. to update their firmware.

I want to connect them one at a time to my PC and run an update script, for which I need the device's IP address. One attractive solution would be for my script to always use the same IP and to configure my DHCP server to just offer the same IP address to every DHCPDISCOVER request it gets.

In pseudo dhcpd.conf, I want to say this:

host device-to-update {
    hardware ethernet *;
    fixed-address 192.168.1.100;
}

I've played around with classes a bit, but I haven't found a way to use them with fixed-address. The man page ominously says:

Please be aware that only the dhcp-client-identifier option and the hardware address can be used to match a host declaration

... so I suspect it might not be possible. Currently my workaround is to manage a pool of 1 address with a short lease time, which works OK, but has other drawbacks.

This is on Ubuntu 14.4 with isc-dhcp-server.

  • You can match the hardware with classes, but you'll still be back to a "1 lease pool" to assign the address. (Could you elaborate on the the other drawbacks you have about this?) Or you could send a dhcp-client-identifier and match that in a host declaration (simply replacing the hardware match with the dhcp-client-identifier). But this approach requires you to touch every client machine 2x (once to add it, once to remove it) -- if you're doing that might as well just can in a fixed ip and forget dhcp. I'll be happy to post an answer for either method if you like. – Brandon Xavier Aug 25 '15 at 12:29
  • The "other drawbacks" was really just that I have to pick an arbitrary lease duration. If I pick 60s, I can't plug one device in right after another (say, before having run the update script). If I pick something tiny, the device has to renew its IP constantly. I guess since network performance isn't important here, it doesn't matter anyway. And its certainly better than modifying the hosts. – Caloboletus Aug 25 '15 at 14:38

0 Answers0