3

I just came across a strange quirck:

I use my MacBook Pro in the office. Every computer is assigned their IP addresses by a DHCP server. It seems to be the case now, however, that my OS X changed my hostname by itself.

I am assuming this is done because of the fact that my current IP address was previously used by the user with this hostname, but obviously, I don't want OS X to change my hostname without asking me to do so.

How can I prevent this from happening?

2
  • 1
    There are some related questions on Server Fault and Super User. You might try sudo scutil --set HostName your-preferred-host-name. Commented Oct 9, 2011 at 6:45
  • FWIW, sudo scutil --set HostName … solves the problem for me, on Lion. Commented Jul 5, 2012 at 12:25

2 Answers 2

4

This issue has been going on for years, and there is no way to "fix" it on the Mac.

What happens is the machine gets an address from DHCP, and then performs a reverse DNS lookup to see if there is a hostname associated with the IP in DNS.

If you are on a Windows network, all of the Windows machines are automatically registered in DNS when they connect to the Domain.

I went on and on with the techs at Apple about this... There is little that you can do at the level of your Mac. It becomes an issue for your network administrator, and since there is nothing really wrong, he/she is likely to leave things as they are.

1

A long time later, still facing the issue.

My two cents after digging a bit: Windows clients send a DHCP option 81 ("Client Fully Qualified Domain Name" in Wireshark), which triggers the DNS update, by default.

On Linux boxes around here, it is not done by default, I needed a "send fqdn.server-update on;" in dhclient.conf to get the same behaviour.

For MacOS, I wonder if the DHCP client extension for option 81 is implemented.

Edit: after a decent amount of time spent trying to play around with the regular MacOS DHCP client (and its networking in general), I compiled the ISC DHCP client (ie the same as the one on the Linux boxes). I have partially achieved my goal of updating the DNS so far from the Apple machine, as I do get a proper macname.domain.tld -> IP mapping. The reverse mapping still resolves to a former lease from a Windows machine, it's the last thing I have to figure out but I can live with that.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.