On Thu, Apr 3, 2025 at 6:55 AM Greg Wooledge <g...@wooledge.org> wrote:
>
> On Wed, Apr 02, 2025 at 22:28:24 -0500, David Wright wrote:
> > 127.0.1.1 coyote.coyote.den coyote
> > [...]
> > I don't see the point in leaving it there. If you want to send
> > something to coyote.coyote.den, why do you want the LAN address
> > when 127.0.1.1 is just as good. If the line is correct, it does
> > nothing; if it's incorrect, it can cause harm.
>
> I disagree with you here.  The 127.0.1.1 address is a placeholder put
> there by the installer for the more common case where a machine doesn't
> have a fixed LAN IP address.  Most home or workplace computers these
> days will get their addresses from DHCP without a reservation, so their
> internal addresses may vary.
>
> 127.0.1.1 is used when a fixed LAN IP address isn't available.  But if
> a fixed LAN IP address *is* assigned, that should be used instead.

According to hosts(5) man page, EXAMPLE section
(<https://man7.org/linux/man-pages/man5/hosts.5.html>):

       # The following lines are desirable for IPv4 capable hosts
       127.0.0.1       localhost

       # 127.0.1.1 is often used for the FQDN of the machine
       127.0.1.1       thishost.example.org   thishost
       192.168.1.10    foo.example.org        foo
       192.168.1.13    bar.example.org        bar
       146.82.138.7    master.debian.org      master
       209.237.226.90  www.opensource.org

       # The following lines are desirable for IPv6 capable hosts
       ::1             localhost ip6-localhost ip6-loopback
       ff02::1         ip6-allnodes
       ff02::2         ip6-allrouters

I think the idea is, software can always use 127.0.1.1 to find the
host's fully qualified domain name, without the need to know real IP
address. (And what to do with multihomed hosts?)

> In Gene's case, where all the addressing is manually assigned and static,
> using the traditional approach (192.168.x.y coyote.coyote.den coyote)
> is actually preferred.  It allows a single /etc/hosts file to be
> copied across all computers on the LAN without needing to modify it
> on each host.

Jeff

Reply via email to