Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

(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 173.230.36.89). 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?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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à
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
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. –  FireLizzard Sep 2 '13 at 2:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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