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.
Open System Preferences
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
Actually, the "use dynamic global hostname" is NOT checked and it's still having this behavior.
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.
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
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.
serialband, I can see this happening to one mac, but it's happening on EVERY mac.
Very strange, I will try what yo suggested.
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?
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
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.
thanks guys for your help