Home » Questions » Computers [ Ask a new question ]

How can I stop Mac OS X overriding my hostname when I receive a DHCP request on Snow Leopard?

How can I stop Mac OS X overriding my hostname when I receive a DHCP request on Snow Leopard?

Whenever I go on a network where the DHCP server assigns hostnames then it overrides the settings I've set for my hostname on my Mac in the "Sharing" section of System Preferences.

Asked by: Guest | Views: 69
Total answers/comments: 2
Guest [Entry]

"In short: there is an auto-magic behavior that Mac OS uses, by default.

You can turn it off in /etc/hostconfig.

http://excitedcuriosity.wordpress.com/2007/08/24/mac-os-x-hostname-determination/

I like the answer by Jack M., but it doesn't work in many environments of the real-world DHCP environments, because you do not have a pre-existing relationship with the DHCP server. Only in a home setup or a corporate setup (where the IT people are helpful), can you get your desired hostname via DHCP.

In /etc/hostconfig add something like this:

HOSTNAME=your_hostname.your_domain.your_tld

If you want to set it at automatic again, either remove the line or set it to -AUTOMATIC-"
Guest [Entry]

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

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

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