On linux systems, I've seen many variations of /etc/hosts configurations with regards to the loopback address, localhost, and server aliases. Some include the servername as an alias for the localhost/loopback address (127.0.0.1), and others don't. I'm trying to figure out which of these is the most "correct", and what issues incorrect setups might cause.
For example, for an imaginary server named alice, with an FQDN of alice.example.com, and an IP of 192.168.42.42, I've seen these /etc/hosts configurations (and more):
Option 1:
127.0.0.1 alice.example.com alice localhost.localdomain localhost
192.168.42.42 alice.example.com alice
Option 2:
127.0.0.1 localhost.localdomain localhost alice.example.com alice
192.168.42.42 alice.example.com alice
Option 3:
127.0.0.1 localhost.localdomain localhost alice
192.168.42.42 alice.example.com alice
Option 4:
127.0.0.1 localhost.localdomain localhost
192.168.42.42 alice.example.com alice
So of these options, which is most correct? I tend to go with option 4 myself, but I have no justifiable reasoning for this. I'm particularly suspicious about option 1, since doesn't that set the FQDN machine name as canonical for 127.0.0.1 as well as 192.168.42.42? I'm not sure how that's different than, for instance, option 2 where it's just an "alias" for 127.0.0.1 instead.