How does a Mac decide its name on the network?
Hi,
How does a Mac (a MacBook Pro running macOS High Sierra, for instance) decide its own name on a local network? How can I configure this?
What I mean by "its own name" is, to be exact, the DNS name that it suggests to other computers in order to connect to services it provides via the Sharing pane in System Preferences. For instance, right now, if I turn on Remote Login from the Sharing pane, then my mac tells me "To log in to this computer remotely, type "ssh alexis@sydneys-mbp.localdomain". So this Mac thinks it can be reached at the DNS name "sydneys-mbp.localdomain". We might call this the sharing name. Where does it get this name from?
The reason I ask is that this machine is not Sydney's MBP (although it used to be) and, as near as I can tell, I have set every possible configuration that could be used on the machine to remove that name. Here are things I have already tried:
1. In the Sharing pane, I have already set the Computer Name to "DesertMac", and indeed the system tells me that "Computers on your local network can access your computer at: DesertMac.local."
2. I have already used the system configuration command line utility, scutil, in order to set the ComputerName, the HostName, and the LocalHostName to DesertMac as well. (You do this by performing commands like: "scutil --set ComputerName DesertMac").
3. I have already used the "defaults" command to set the preferred NetBIOS name. (You do this with commands like: "sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string DesertMac")
Despite all these measures, as soon as my system joins the network, the sharing name is quickly set to the old, incorrect name, as is the the NetBIOS name. (I see the NetBIOS name in System Preferences / Network / Advanced / WINS, or by doing "echo 'show State:/Network/NetBIOS' | scutil".)
Because the incorrect sharing name also appears as the NetBIOS name, this makes me wonder if the Mac's NetBIOS stack is responsible for remembering this name or accepting it from some external computer that acts as a name assigner, but I don't understand how that would work. Because the incorrect name ("sydneys-mbp") appears with the DNS suffix which is the router's search domain (".localdomain") this alternatively makes me wonder if the router is responsible, but I also don't understand how that would work. When I watch the system console logs via Console.app, I can see that the "digest-service" process is registering or effecting the change, but I don't know what this means.
So, to recap, this all raises two main questions:
1. How does a Mac decide what its own DNS name is?
Does it remember what it used to be, in some obscure cache or setting that I need to reset? This seems hard to believe because I've tried resetting everything imaginable.
Does it receive an assignment from some external name assigner server, like the router? This seems like what must be happening. But it is puzzling, because the only mechanisms I can imagine are the router's DHCP server and DNS name server. I thought that DHCP only allowed the server to assign a numerical address to the Mac, and that DNS only allowed the Mac to lookup a specific name. So I was under the impression (maybe wrong?) that neither of those technologies could be used to assign a name to the Mac. Or could there be another technology, like a NetBIOS, which can act as a name assigner and force a Mac to accept a name? And how would any of these technologies choose the name to begin with?
2. How do I configure a Mac to tell the world it wants to be known by a different name?
Setting the ComputerName is clearly not enough. This does affect my Mac's Bonjour name (i.e., "DesertMac.local.") but it does not seem to affect its non-Bonjour DNS name (i.e., "sydneys-mbp.localdomain."). Is there something else I can tell the Mac that will hint to the (hypothetical) name assigner on the network that the Mac wants to be known differently? Or do I need to reconfigure the (hypothetical) name assigner manually?
I'd really appreciate any help on this. For what it's worth, a see a trail of dozens of similar questions dating back on these forums for many years. They usually take the form of people complaining that they can't control the Mac's NetBIOS name, and people giving advice to update the ComputerName, advice which does not work for me. Also, for what it's worth, the router on my network is a Ubiquiti UniFi Security Gateway, and I can modify its configurations if need be. But I don't see anything in its configurations now which mentions these outdated, incorrect names.
MacBook Pro (15-inch, Late 2016), macOS High Sierra (10.13.6)