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

Posted on 2008-11-05
Last Modified: 2013-11-25
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?  

Question by:wv-rog
    LVL 4

    Expert Comment


    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"
    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 "" not ""

    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.

    LVL 4

    Accepted Solution

    you may also want to check


    Check this thread on apple forums.

    "Hostnames under Leopard"
    LVL 1

    Author Comment

    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.  

    LVL 1

    Author Comment

    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.  

    LVL 1

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    #Citrix #Citrix Netscaler #HTTP Compression #Load Balance
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now