Avatar of Dan
Dan
Flag for United States of America asked on

hostname of my macs change when using DHCP

I'm experiencing a new crazy issue.  I have about 9 MAC computers on a network with mostly Windows PCs.  I have a windows 2012R2 DC, with AD, DNS, DHCP, etc...
If the Macs use a static IP, everything works fine, the hostname stays what is configured by the user.

As soon as I change the manual IP to DHCP on the MAC, after a reboot, the hostname of the PC randomly changes to a windows PC name.
It's completly random, as different MACs use different windows PC names.   Where do I even begin to troubleshoot this issue.

I am running different versions of the mac, on most of the macs, i'm running Mojave.  A few are running Catalina.
Windows Server 2012DHCPActive DirectoryMac OS XApple Networking

Avatar of undefined
Last Comment
Dan

8/22/2022 - Mon
SOLUTION
Dr. Klahn

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
serialband

You must have turned on the dynamic hostname.  I always thought it was off by default.  I just checked and don't see it enabled.

Open System Preferences
Select Sharing.
Click on the Edit button just under the Computer name field.
Make sure the check box for Use dynamic global hostname is unchecked.

Instructions here also: https://knowledge.autodesk.com/search-result/caas/sfdcarticles/sfdcarticles/Setting-a-persistent-hostname-on-a-Mac-workstation-that-uses-DHCP.html
Dan

ASKER

Actually, the "use dynamic global hostname" is NOT checked and it's still having this behavior.

Dan

ASKER

under system preferences -> sharing, If i turn off remote management, the name in terminal is correct.

As soon as I turn on remote management, the name displayed is wrong.


So how does the mac get it's computer name from DNS, as I'm trying to figure this out.

Your help has saved me hundreds of hours of internet surfing.
fblack61
serialband

Maybe the GUI is wrong.  Toggle it on, then toggle it off.


Check all 3 names in the Terminal.app command line.
#Used by computer / unix
   scutil --get HostName
#Used by Sharing
   scutil --get LocalHostName
#Used by Bonjour
   scutil --get ComputerName


Make sure all names are set and your hostname should remain fixed.
   scutil --set LocalHostName MyHostName
Dan

ASKER

after looking in DNS, I noticed the IP address of my mac is 192.168.102.115, which is a DHCP IP.

In the forward lookup zone, this IP has the correct name of admins-mac-mini

In the referse lookup zone, this IP points to a different name,udzyndra,  which is not correct. The name in the reverse

lookup zone is listed numerous times over and over.  The computer udzyndra is actually a windows PC, so not sure why most of my macs are using this windows name. 


Is it safe to just delete all entries in my reverse lookup zone?


I tried setting the DHCP client ID, but that didn't.


If I use static IPs on my macs, then this issue doesn't happen.  I think there's a total of 13 or 14, I was mistaken earlier about the total number of macs, so I really want to use DHCP on all of them.




Dan

ASKER

serialband, I can see this happening to one mac, but it's happening on EVERY mac.

Very strange, I will try what yo suggested.

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dan

ASKER

serialband,


So I ran those commands and now when I go to system preferences -> sharing, it doesn't list the computer name there anymore, but IP address.  I guess it kind of helped, since the wrong computer name is not there, but the problem is, it's now an IP address and I need it to use a computer name, as it's much harder to remember to remote desktop into computers by IPs rather than names.


Anything else I can try?

ASKER CERTIFIED SOLUTION
serialband

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dan

ASKER

I figured out the exact problem, I just don't know how to solve it.



When a MAC is using DHCP, it does NOT update the DNS forward zone records

 

DHCP is working fine, when a MAC gets an IP lease, the correct computer name is listed in DHCP

 

It does try to use the DNS entry listed in the Reverse lookup zone

If a record with the IP address it has is already in there, it will use that DNS name in the remote sharing section and in terminal


If a record for the IP it's using is NOT in the reverse lookup zone, it will just use it's IP address in the remote sharing section and in terminal

 

DNS has been verified, in the reverse lookup zone, by default the setting is enabled "update associated pointer (PTR) record"

 

The MACs just don't update the PTR record, they only read it, so they will use it if it's in there, but will not update or add an entry


Dan

ASKER

Does anyone know any good vendors that work with MACS and Windows in the Sacramento, CA area, as I think it's time for me to call a company to come research the issue.

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Dan

ASKER

thanks guys for your help