11

(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?

Ethan Reesor
  • 233
  • 1
  • 2
  • 7

2 Answers2

8

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Ă 
asiby
  • 203
  • 2
  • 6
1

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.

Daniel J.
  • 298
  • 1
  • 7