Tony Wall’s Blog

Remember quality? A bit more time upfront saves a ton of trouble later ;-)

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:
    …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.
Tagged ,

3 thoughts on “Configuring Linux With Windows DHCP Servers

    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.

  • 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

Your email address will not be published. Required fields are marked *