On Thu, Apr 03, 2025 at 12:59:19 -0400, Jeffrey Walton wrote: > I think the idea is, software can always use 127.0.1.1 to find the > host's fully qualified domain name,
No. Absolutely not. You have it exactly backwards. The purpose of putting the "127.0.1.1 my_hostname" line in /etc/hosts by default is so programs which need to do so can look up the system's hostname and get *any working* IP address for it. It may seem implausible these days, but back in the Olde Times, it was common for programs like X sessions to look up the system's hostname, get an IP address, and then use that IP address for connections. In the absence of a discoverable working IP address for the local system, X sessions would break. (I don't know if Debian ever had this specific problem, but HP-UX sure did.) On a system with a statically configured LAN IP address, it was always most desirable to put that address in the hosts file. If you are fortunate enough to be in this situation, then your job is done. Everything is happy. On a system with a dynamically assigned LAN IP address, putting the dynamic address in the hosts file causes problems when the address changes. That's why the 127.0.1.1 hack was developed. It gives you something you can put into the hosts file which will work, even if the ethernet interface's address changes out from under you.