Mailing List Archive

1 2  View All
Re: Why do we add the local host name to the 127.0.0.1 / ::1 entry in the /etc/hosts file? [ In reply to ]
On 3/16/21 6:16 AM, Michael wrote:
> Yes, I won't argue against this all around rational position.

;-)

Thank you for the CRC / checksum on my logic and possibly even my position.

> Fair enough. It is clear to me your proposal won't break things.
> Quite the opposite it will eliminate the chance of being the cause
> of localhost misconfiguration breaking various services.

:-)

> The syntax of /etc/hosts as presently configured in the Gentoo handbook
> doesn't even agree with the hosts man page installed by baselayout -
> the man page I believe follows the Debian convention.

That should be addressed as well.

I think that any concerns regarding DEs being able to resolve the
systems FQDN (?) when using dynamic IPs should also be addressed.

> ACK. This and Samba AD is where this thread started I think.

Kerberos and AD (Windows or Samba) were the most poignant examples of
why I thought having the FQDN resolve to 127.0.0.1 was incorrect.

> I was talking about the domain name changing, not the host name.

I consider the domain name to be part of the host name. But that's a
different discussion.

> my_laptop.home.com
>
> my_laptop.work.com

Think about an email server, in different locations:

smtp.branch-office-1.example.com
smtp.branch-office-2.example.com

Remember that kernels only have a singular name, which is free form text
string, including periods, as their host name. As such, the kernel on
each system should know it's own name as something that humans can
differentiate between the two systems. Thus, the output of `hostname`
should return an FQDN.

With this in mind, and the methodology of using the same configuration
everywhere, I think your notebook's hostname should be the same at home
and at work.

There is an independent name for a given connection, which can, and
frequently does, differ from what the attached system thinks the
hostname is. E.g. my home router thinking that it's FQDN is

home-router-gw.home.example.net

While a reverse DNS lookup for it's IP will be something like

dhcp-a-b-c-d.town.isp.example

But, like I said, that's another, different, probably larger conversation.

> However, the hostname should be set in /etc/conf.d/hostname,
> or netifrc(?).

I think the /hostname/ is completely independent of anything network
interface related. So, /etc/conf.d/hostname.

Aside: This also touches on the strong vs weak host model and what the
interfaces & names belong to. Linux by default uses the weak host model
where IPs and interfaces belong to the system (thus any interface).

> Right, the topic has been (re)visited a number of times. I wonder
> what has brought about the hosts file syntax in the current version
> of the Handbook.

Inquiring minds....

> Perhaps it is time to file a bug to propose a way forward both on the
> Handbook and the Wiki pages to ensure network configuration remains
> consistent across the documentation.

Perhaps.

I do appreciate the sanity check on my logic, and the result of my logic.

Thank you for the discussion Michael. :-)



--
Grant. . . .
unix || die

1 2  View All