On Linux, the host name seems to be of little use other than identifying the computer by executing the hostname command. On Windows, there is a value returned by hostname but I have not found any other use for it. Maybe something in a Wins server?
It used to go to WINS, yes – and similarly, NetBIOS local name discovery in places that didn't have a WINS server, so that you could ping Jimputer
to reach your computer over your home network. It's exactly like Bonjour in macOS.
In fact, both Windows and Linux also use the hostname for actually the same Bonjour as on macOS – under the name of Avahi on Linux, or the generic mDNS more broadly. These days, WINS and NetBIOS NBNS are no longer a thing – if you try to access a local hostname in Windows, it'll be resolved via Bonjour first.
But note that Bonjour/mDNS is two things: it does hostname lookup, but it also does service discovery. The former is what uses the short 'hostname', but the latter – meant to show your computer in the "Network" list – uses the long 'computer name', which may include any special characters because it's not meant to be typed-in anywhere.
This "service discovery" part of Bonjour is explicitly meant to mimic how networking worked in AppleTalk (Mac OS Classic), where hostnames as such didn't exist (nor did SSH or Ping or terminals). Network printing, file-server access, everything worked via free-form service names that you selected from a list, and therefore "computer name" was a Mac's primary identity in an AppleTalk network. Hostnames only came to Macs with TCP/IP and with the Unix-based OSX.
I am not sure where DHCP gets the names it uses. For my MacOS computer, it does not use any of computer name, local host name, or host name. For my Linux computer, the DHCP name is the same as the computer's host name; is that by chance, or does Linux provide that name?
It is normally provided from the system hostname, yes. Windows always does so; on Linux it depends on which of the 100 different DHCP clients you use, but generally the system hostname is used by default.
While in small LANs the hostname usually reaches local DNS via DHCP, that's not the only method – in larger networks with Active Directory, Windows also sends a DNS 'UPDATE' for its system hostname directly to the AD DNS server.
By default, the host name is not set. If set, the hostname command returns that name, but if not set, then the local host name is returned.
Note also that macOS, by default, will also take the hostname from DHCP, if the lease provides one. (You often see people here confused about why they have [email protected]
as their shell prompt.) So now you also have two parameters: one is the permanent, manually-configured hostname (in /etc/hostname on Linux), the other is the temporary, currently-active hostname (in the hostname
command on Linux).
And that's how you have three in total:
macOS |
Linux (hostnamectl) |
Usage |
"Hostname" |
"Transient hostname" |
The actual currently active system hostname (either initialized from static hostname, or overridden from DHCP). This is what's retrieved by various programs and services when they call 'gethostname()'. |
"Local hostname" |
"Static hostname" |
Manually set hostname that's used as the system hostname if nothing overrides it. Not directly used by apps. |
"Computer name" |
"Pretty hostname" |
Free-form "display name" to be shown in network discovery lists (Bonjour/Avahi); generally not used by much else. |
Finally, the same system hostname is also what's typically used by various third-party features because of how easily it's accessible to programs (traditionally there's a very simple API call to retrieve it). For example, it acts as a default device label in Dropbox or Syncthing or Steam or Spotify; even if the OS doesn't necessarily use it much, other software find plenty of uses.
I changed the host name on the Linux computer and then restarted it, but the DHCP name did not change
... try rebooting the router