On Fri, Oct 27, 2023 at 07:59:00AM -0400, Pocket wrote: > On 10/27/23 07:50, Greg Wooledge wrote: > > On Fri, Oct 27, 2023 at 07:29:20AM -0400, Pocket wrote: > > > /etc/hosts > > If you're using short-form hostnames like this: > > > > unicorn:~$ hostname > > unicorn > > > > then yeah, that's all you need. If you're using long-form hostnames > > (with dots in them), then you also need to configure /etc/hostname. > > > > I use the short-form hostnames, so mine is simply: > > > > unicorn:~$ cat /etc/hostname > > unicorn > > > > Couldn't be simpler, really. > > Are you referring to the domain name or FQDN?
Neither. I'm referring to the hostname, as printed by the hostname(1) command. There are two philosophies for how to set your hostname. You can either use the short form (no dots), or the long form (dots). I use the short form. My hostname is simply set to "unicorn", not to "unicorn.wooledge.org" or anything like that. That would be the long form. If you're a long form hostname person, then your hostname should be set to the FQDN of the system. For a setup like Gene's, where the domain name is unofficial and he simply hopes that nobody ever registers it, I strongly recommend using short form hostnames. In BOTH cases, the entry in /etc/hosts should contain both the FQDN (real or otherwise), and the short form alias. Thus: unicorn:~$ grep unicorn /etc/hosts 127.0.1.1 unicorn.wooledge.org unicorn This is independent of which way you set the hostname. The IP address could be 127.0.1.1, or it could be your LAN address, if you're using statically assigned IPs.