Mac – Ensure Macs get correct machine name from DHCP

dhcpmacmac-osx

I have a problem in our network where our Mac's occasionally get given the wrong machine name while, I guess, getting a new DHCP lease.

The DHCP servers are Windows based – the bulk of our network is Windows, but we have some Linux machines and an increasing number of Macs. The problem specifics is that occasionally a Mac will take on the name of another machine in the network.

For example, I have a new Macbook Pro. In the OSX setup is gets called "gomez", and initially starts up on the network with that name without any problems. But after a few days when the machine was restarted (it had several restarts in the meantime), it ended up being called "florrie", which is actually the name of another machine in another part of the network.

All network ops work fine, and indeed you don't notice most of the time – it's only when you run apps like Perforce that require the hostname that you get problems.

I'm sorry I don't have more info than that, but if I know what to look for I can dig out some more facts. Or any hints on checking the network setup would be useful.

Best Answer

It's more likely to be a dynamic update DNS issue; Windows clients, beginning with Windows 2000, automatically update Windows DNS servers directly with their new details once they've been leased an IP address by the DHCP server. This way, the DNS and DHCP servers are kept in sync. Macs don't. Previous posters are correct when they say that the Macs are getting these incorrect hostnames from the DNS server. The problem, then, is with the DNS server.

I haven't used the current Microsoft DHCP server but previous versions provided an option specifically for this situation. Instead of the client machine talking directly to the Windows DNS server, as happens automatically with Windows 2000 client and later, the Windows DHCP server can update the Windows DNS server once it has successfully leased an IP address to a client.

You need to enable the option yourself in your Windows DHCP server. The wording for this option will usually be something like "Always Update DNS and Enable Updates To DNS Clients That Do Not Support Dynamic Update".

You might still find this article useful, though it's for Windows Server 2000 DHCP. (I'm not having a good Google day.)