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.

  • Still not fixed, I'm afraid. Tried the suggestions, but nothing forthcoming. The MS DHCP server settings were already set as Bahi suggested. May 27, 2009 at 7:11
  • *nix computers will probably have the same problems. Jul 20, 2009 at 16:22

5 Answers 5


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.)

  • Thanks for the suggestion. I'll see if my IT services dept can try it. May 17, 2009 at 20:54

The Mac is doing a reverse lookup on the DHCP IP it gets to set the hostname. You can either configure the DNS servers to answer correctly as Sam suggests, or you can fix the machine names per-computer.

There are plenty of ways to do this, but the two simplest are:

  1. You can edit /etc/hostconfig and add the line HOSTNAME=[desired hostname] and reboot. This file is deprecated since 10.5, so don't count on it working into Snow Leopard.

  2. In System Preferences -> Sharing you can set the "computer name". If you click the "Edit..." button, you'll see a setting for "Use dynamic global hostname". Untick this to stop the DNS lookup and retain whatever setting you put in there.

Both these ways require setting per-machine, however, so you might prefer to look into sorting the DNS if the number of Macs is going to grow.

  • Thanks for the tips - I'll give a go when back in the office. May 17, 2009 at 20:53
  • bonaldi is correct. It's the reverse records that are causing the issue. I've had this same thing happen before to my macs when we moved from bind on unix to bluecat network appliances(don't buy them, they suck)
    – Tatas
    Jul 20, 2009 at 17:45

The answer is here


Copying the better answers here for convenience:

Set it in the Terminal with sudo scutil --set HostName

example: sudo scutil --set HostName server1.mynetwork.com

Depending on how your DHCP is set up, you may be able to use the "DHCP client ID".

  1. System Preferences.
  2. Network
  3. Select your network adapter on the left.
  4. Select "Advanced" button at the bottom.
  5. Set the "DHCP client ID" to your hostname.

If your DHCP server supports it, your hostname will be used for your machine.


The problem here is not that the name of your machine is changing, DHCP does not give out machine names, it only distributes IP addresses. However when DHCP allocates an IP, it will record what the name of the machine is that leased the IP. Most DHCP servers will then register that machine in DNS, with that IP. So somewhere along the line, DNS is get the IP and machine name mixed up, or DHCP is registering the wrong details with DNS.

Take a look at your DHCP server and your DNS server and check if the records they have for your machine match up, if they don't, then we need to try and find out why.

  • Thanks - I'll take a look at the DNS during the week. I did think that DHCP only handed out IP addresses, hence my confusion. May 17, 2009 at 20:52

Greg, it could be a lot of things. What you need to do first is figure out why the Mac is picking the name it displays. Then check the forward and reverse lookups for the IP address and hostname (using nslookup or dig), and your "Computer Name" in the System Preferences.

For a while, this topic had bothered me, so I took did some research and took some notes, and left them here:

Mac OS X - setting the "hostname"

You will probably find that there is some combination of IP address changes + problem with DNS/DHCP integration.

NOTE: This is not a backdoor to advertising for my personal blog... I don't blog. I've left the community wiki flag on, and linking out causes a problem, just copy useful text in here and remove the link.

You must log in to answer this question.

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