9

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.

1
  • 2
    Have you set your Windows DNS server to allow unauthenticated updates?
    – Zoredache
    Jan 19, 2010 at 17:24

6 Answers 6

2

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.

1
  • this won't do, since I'm setting hostname in a script that takes it (the hostname) as an argument. Jan 19, 2010 at 21:40
2

I Ended up using a script which runs nsupdate after VM is created from template and upon each boot.

1

This is somewhat similar to my own question. Have a look at my final comment to the one and only answer I received, where I refer to dhclient.conf.

2
  • so basically you just added 'send host-name' to dhclient.conf? because this didn't work for me Jan 19, 2010 at 21:40
  • That's all I had to do. The man page indicates that the FQDN is required but in my case simply sending the hostname worked with both Windows and Linux DHCP and DNS systems. The machines were added to DNS by the DHCP service as soon as the client's DHCP lease was released and recreated. Jan 19, 2010 at 23:00
1

Two things I've found that were required to get a non-domain joined machine to register and update it's DNS records on a Windows DC\DNS server:

  1. Configure the DC\DNS server to allow both secure and unsecure dynamic DNS updates.

  2. Configure the FQDN of the non-domain joined host to match your AD\DNS name: as in host.domain.com

1

Hmm. Never tried this exact config - I've had this working with Linux clients to Windows DHCP servers, but in that setup the DHCP server does the update. Not sure if the Fortinet box does the same thing.

You could try making the client talk to the DNS server directly; something like:

send fqdn.server-update off;
send fqdn.encoded on;
send fqdn.fqdn "hostname.example.com.";  

in /etc/dhcp3/dhclient.conf. Check man dhclient.conf for more info. I had to set at least send fqdn.fqdn to get it working in my setup.

You'll have to enable insecure updates to your DNS zones as well.

1

Many may consider this blatantly obvious, but be sure to specify your own request directive in dhclient.conf which does not request a hostname or domain-name. The default on my distro was:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name,
        netbios-name-servers, netbios-scope, interface-mtu;

Note that this requests both host and domain names from the server which nullifies a send host-name ... directive. My request and send-host directives look like this:

send host-name "leaf.node.domain.com";
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name-servers,
        netbios-name-servers, netbios-scope, interface-mtu;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .