(I'm using a Mac. It triple boots OS X.8, Gentoo, and Windows 7. I've only noticed the problem in OS X, but that's what I use most of the time so it might be occurring in other OSes.)

I've used System Preferences to set my host name to what I want it to be. Yet, when I connect to particular networks (parent's house, dorms, school, etc), as far as Darwin is concerned, my hostname becomes something else. I say Darwin because Terminal and the sharing panels in System Preferences ('Other users can [some sharing action] your computer [some address involving the altered hostname]'). Sometimes the altered hostname is a lower case version of what it should be, sometimes its host1234.some.provider.com, or just host1234.

This frustrates me. I want my hostname to be what I set it to, always, across all systems. Especially in Mac. What can I do to prevent this alteration? I have (root) access to a server with BIND on it, so should I set up dynamic global hostname? Are there any guides to setting up BIND for that (RFC 3007)? I (mostly) understand DNS as applied to websites, etc, but I've only ever altered the bindings in CPanel.

UPDATE: I'm not complaining about clients showing fully qualified host names. My local machine is showing a different host name. Lets say my computer's hostname is set to be Firelizzards-Computer in OS X's equivalent of /etc/hostname. Right now, connected to my dorm's WiFi, running hostname returns host-173-230-36-89.mycampusname.clients.myprovider.com (my LAN address is Why is hostname not returning Firelizzards-Computer.mycampusname.clients.myprovider.com?

NOTE: The phrase 'dynamic global hostname' refers to a setting in OS X that involves RFC 3007.

SOLUTION: sudo scutil --set HostName <desired host name>. I found this, this, and this, the last one being my exact problem.

So now my question is, by what mechanism is connecting to a LAN changing what hostname was returning?


The answer from Daniel J. is not a valid answer. It's just "stating a fact". Can it be done or not? And how is it done?

The answer is yes. Here is how:

  • Go in your OSX Network preferences and select the network card you are connected with.
  • Click on "Advanced..." near the bottom right corner of the dialog box (above "Assist me.." "Revert" and "Apply")
  • In the new window that comes up, click on the WINS tab and change the NetBIOS Name and Workgroup to your liking.
  • Save the changes ... et voilà

It looks like your computer is getting its hostname from a DHCP server. If you are in a campus context it is normal that network administrators try to keep control on any aspect that they can.


if I'm understanding your question correctly, no you cannot do what you want, because each client will choose whether to show the Fully Qualified Domain Name (host1234.some.provider.com) or a short name.

keep in mind, a given PC is always doing DNS host name lookups by appending the default domain (some.providor.com) if it is not already present in the input, so the computer is always identified by its FQDN. the client itself may or may not choose to display only the host portion of the name.

I'm sure you understand of course, that when outside your LAN, it is impossible for remote systems to refer to your host by just its shortname, and there is no such thing as a global hostname in DNS, other than the FQDN for any given entry.

one thing you can do, if you are running on linux, is edit your resolv.conf to add a search domain statement for your network on every client you plan to connect from.

search example.com

this will only work if the dns server you are using contains that domain though.

  • My hostname is not host1234, it's being changed to that. I don't really mind the domain qualification bit, it's the changing of my hostname that bothers me. I added this in more detail to my question. Sep 2 '13 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.