Random hostname assigned to Mac on AD Network (WINS/DHCP/DNS on W2k3 Server)

My environment is a Windows 2003 AD network where I run DHCP/DNS/WINS all on the DCs of the AD network.  It's a small network and there are only 2 DCs running those services.  
The problem is more of an annoyance and hasn't caused any problems yet.  
On the Mac...
In Sharing Preferences the computer name was incorrect.  I clicked edit, and gave it the name I wanted and it sticks after reboot.  
In Network Preferences - advanced I went into the WINS Settings and entered the NetBIOS name the same as in the sharing preferences, this setting sticks also.  
Both settings that I changed above were originally hostnames of other computers on the network, before I specified one, it would get a different hostname every time it would get a new IP address.  After specifying for both, they stuck.  The only problem now is that when I go into the terminal console, the prompt is another hostname on the network.  I issue the hostname command and sure enough it's got the wrong hostname, it is a valid hostname on the network but that machine (laptop) is offsite, ie not connected.  I can SU and change the hostname (hostname -s newhostname), and that sticks until I reboot, then it reverts.  
I can ping from my windows machine the netbios name of the Mac and it replies properly.  When I try to ping -a the IP of the Mac, it resolves to the incorrect hostname I see in the terminal prompt of the Mac.  

Initial thoughts are that DHCP issues Wins Server info as part of the scope, and Wins might have this hostname still listed in its DB.  I'm not sure though since I don't know much about Wins.

The Mac is not bound to the AD network at all; except for using the AD DHCP/DNS/Wins services.  

Has anyone ever  seen this behaviour before?  

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Let me get this right.  
You, (through DHCP Option) issue a host name to a client computer? If not than DHCP _should_ accept the hostname the computer has chosen, and lob it into the AD DNS for lookups.

By default the shared name is "Someones' Mac"  not "hostname or hostname.domain.com"
You changed it to say "hostname"
when you use hostname -s "someother" as root or under sudo.

You reboot the box and you get back "hostname.domain.com" not "newhostname.domain.com"

Just use the Sharing tab to set it. Also if check your DHCP server and make sure it honors the client set hostname. This is why you were getting random assignments.

After DHCP giving you an address, OSX would check reverse DNS and auto-set the hostname for you.

you may also want to check


Check this thread on apple forums.

"Hostnames under Leopard"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wv-rogAuthor Commented:
I changed the hostname in the sharing preferences and it sticks.  it's the terminal prompt that is wrong.  The SUDO hostname -s 'someother' works for that session, but not when I reboot.  
"After DHCP giving you an address, OSX would check reverse DNS and auto-set the hostname for you."
That might be the key because for some reason the DHCP server is not updating the DNS server with it's leases for non-domain member work stations.  I'll look into it.  

I'll also check out the Apple link you sent.  I'll get back to you in a few hours.  Thanks for the tips.  

wv-rogAuthor Commented:
So the update to the hostconfig file with the hostname=desiredhostname line seems to do the trick.  Even though it says at the top of that file "This file is going away" it does seem to work like the posting you linked to said.  

In regards to your first comment on this topic, I do not issue the hostname out to clients from the DHCP server.  I don't know how i would force that anyway.  It looks like my AD DNS is not getting updated at all with any non-domain member computers' A records.  Strange, despite the fact that I have configured dynamic updates to the DNS server (same machine).  I still think the problem lies in WINS because that's the only place where the incorrect hostname appeared, i.e. no active leases in DHCP nor any A records in DNS.  Different issue all together.  

Thanks for the response, your second one seemed to do the trick, so... points awarded.  

wv-rogAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Internet Protocols

From novice to tech pro — start learning today.