Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Override Host name assigned by DHCP? Network
My friend is running DHCP at his house. I noticed that it also assigns an Host name to OS X. How do I override this host name? While DHCP is enabled, the Host name field is grayed out.

[see the comments for a solution]
    •    
  • Currently 2.00 / 5
  You rated: 1 / 5 (8 votes cast)
 
[30,663 views]  

Override Host name assigned by DHCP? | 6 comments | Create New Account
Click here to return to the 'Override Host name assigned by DHCP?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Host name
Authored by: kon21 on Dec 25, '00 06:48:10PM

If you use DHCP for your IP address it will lock out the Host name. To enter a name you like
for your machine and still use DHCP, go to manual mode, enter the the name you like in the
host field, then change to DHCP. The system will now lock in the name you entered.



[ Reply to This | # ]
Host name
Authored by: jasonq on Feb 03, '01 09:27:13AM

Erm, not on my machines!



[ Reply to This | # ]
Host name
Authored by: Anonymous on Feb 04, '01 08:04:53AM

Or you could just bring out Terminal.app su root and then type
hostname what.ever.you.want.for.host.name



[ Reply to This | # ]
Override Host name assigned by DHCP?
Authored by: Schwie on Oct 22, '04 09:01:07PM
Please help me oh friendly and all-knowing Unix/Mac OS X gods! My hostname keeps getting over-written every time I join the network at work.

Here's the situation.

I am joining my network at work, via DHCP, by either wifi or ethernet. Every time I join the network, DHCP forces a hostname on me. How do I know this? I fire up Terminal and it reads out not one but 2 other hostnames of computers on our network at the Terminal prompt:

[mnx_oandersonmnx_jsmith:~] bschwie%

At first, I didn't care about it, but after I tried printing, I soon realized that I was unable to print, the error in Print Center mentioning something about a "control file".

To work around this situation, each time I hop on the network at work, I open up Terminal and perform the following:

[mnx_oandersonmnx_jsmith:~] bschwie% su

mnm_bschwietibook:/Users/bschwie root# hostname mnm_bschwie

after exiting from root mode, quitting Terminal, and then re-opening Terminal, I see that my changes have taken hold and my prompt now looks like it should have in the first place:

[mnm_bschwie:~] bschwie%

The problem with this workaround is, whenever I leave for the day, and come back to work the next, the hostname has re-set itself again.

Man, this is not good... Please help! Is this something I should be changing in NetInfo.

Also, I made the hostname "mnm_bschwie" the hostname in the Sharing Control Panel. Still, this doesn't seem to help my problem of acquiring former hostnames on the network at work.

If it matters at all, I'm getting a DHCP lease from a Windows 2000 Server.

[ Reply to This | # ]

Override Host name assigned by DHCP?
Authored by: Schwie on Mar 16, '06 10:15:40PM

This is advice from Trevor in the Forums and the only thing that ended up getting things to work for me:

Open "Terminal.app" and at the prompt enter:

cd /etc
sudo pico hostconfig

Enter your password and modify the line that says:

HOSTNAME=-AUTOMATIC-

to:

HOSTNAME=mnm_bschwie (or whatever you want)

Press Control and X to get out and save you changes.

You may need to do a restart to make these changes go in to effect.



[ Reply to This | # ]
Override Host name assigned by DHCP?
Authored by: BadgerUMD on Jul 05, '06 10:19:07AM
I ran into this problem myself today (unsure if it was a change for 10.4.7 or a changed in the wireless router here on campus that caused it). In either case, this fixed it.

sudo emacs /etc/hostconfig
if you see the line: HOSTNAME=-AUTOMATIC- replace -AUTOMATIC- with the hostname of your choice. Otherwise, add the line: HOSTNAME="My Host Name" to the end of the file, save and exit. I restarted, and my hostname was no longer reset by DHCP!

Of course, I use emacs, 'cause that's just how I roll. Feel free to use vi, pico, or whatever else you want.

[ Reply to This | # ]