Update hostname from Debian machine with DHCP to a Windows 2008 DNS server
I have a XenServer installation with Debian (lenny) machines created on a daily basis using a script which creates the machine from a template and assigns it with a new hostname.
Our network has a Fortinet 60B appliance which servers as the DHCP server and a Microsoft Windows 2008 DC which also serves as a DNS server. I'd like to configure the VM template to send its hostname to the DNS server when it gets a leased IP from DHCP.
Currently, Fortinet assigns the DC as the DNS server along with the IP lease. I tried adding a 'send host-name "my-host-name"' line to /etc/dhcp3/dhclient.conf, but nothing gets updated in the DC.
So basically you want your client to send their hostname to your DNS server ?
This works great with Windows clients, but for Linux machines, I would go the other way around : set your clients to ask the DHCP server for an IP and a hostname. Using the "request host-name" option, dhclient asks the DHCP server to send a hostname along with the IP address, then sets the hostname of the VM.
Of course you'll need to prepare, in your DNS, a hostname for each IP address in the DHCP range.
This way you don't have the DNS cache / propagation delay problem, and you may have a central place with all the IP and hostnames - your DNS server.
I don't know wether your appliance's DHCP server supports sending hostnames - most does, but I think that's the easiest way for Linux clients.
Note: If you configured your DHCP server so that the same machine always get the same IP address (e.g. using mac address) then it will, obviously, always get the same hostname too. On some DHCP server, you can use directly hostname instead of IP address in the config files.
I Ended up using a script which runs nsupdate after VM is created from template and upon each boot.