I need to assign the DNS servers to a Virtual Machine via DHCP, but I want the machine to have a static IP address.
I cannot use a reservation and go through the usual DHCP process because the VM gets cloned to other datacenters and
- the MAC address will change
- I want the DNS to be assigned without having to fix the DHCP server configuration.
I think I can use DCHPINFORM messages, but I did not find how (I am using an Ubuntu 12.04 image, btw)
Thanks in advance for any hint.
Best Answer
Got it - thanks for the clarification. There are a few ways to do this, but the easiest might just be to take a look at the script called by the DHCP client (/sbin/dhclient-script, oddly enough). This script is passed a series of values, including the IP address of the lease. Edit the script to prevent it from actually setting the IP - possibly based on a conditional to look for the presence of a defined permanent IP. You could take as much - or as little - info from DHCP as you'd like.