Configuring Linux With Windows DHCP Servers

If you have a mostly Windows infrastructure including Windows DHCP and DNS servers, and have to run some Linux machines, you may find they fail to register their DNS names even though the Windows DHCP server is set to do this automatically.

This is because Linux has some questionable logic whereby it has a separate setting for the hostname used in DHCP registration than the network configuration. That may be good for rare situations when you want a different DHCP hostname registered, but seems crazy not to default to the same setting when it is not configured. Another example of how the Windows world is just easier and more intuitive.

Anyway, here is how you get your difficult Linux clients to register their host names properly:

  1. Login with administrative privilege (i.e. login as root then enter “sudo bash” command if SUDO is enabled).
  2. Enter the command:
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
  3. Hit the INSERT key to start editing, move to a free line then enter:
    DHCP_HOSTNAME=<hostname>
    …where “<hostname>” is the host name, best keep it the same as what you configured in the /etc/sysconfig/networking configuration file to avoid confusion.
  4. Hit the ESCAPE key then enter “:wq” to save and exit.
  5. When you reboot or restart networking the DNS name should be registered correctly.

3 thoughts on “Configuring Linux With Windows DHCP Servers”

  1. The DHCP_HOSTNAME=
    I am confused what hostname it should have. The hostname which we defined on windows server DHCP or the hostname of the linux machine that we have set….

    1. It’s just the hostname you want reported back to the Windows DHCP infrastructure. If you have configured your Windows DHCP server scope options to register clients which do not request dynamic registration, it will then write that hostname through to the Windows DNS server.

      In theory you could have a different DHCP hostname to your Linux hostname. The idiocy here is that the default choice was to do nothing, not even register with DHCP properly. So by default Linux clients don’t register properly with Windows DHCP servers.

      So the short answer is the DHCP_HOSTNAME should be exactly the same as your hostname.

  2. Thank you! Red Hat docs bogus at least with MS DHCP: “DHCP_HOSTNAME — Only use this option if the DHCP server requires the client to specify a hostname before receiving an IP address.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s