Gentoo Archives: gentoo-user

From: Grant Taylor <gtaylor@×××××××××××××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Why do we add the local host name to the 127.0.0.1 / ::1 entry in the /etc/hosts file?
Date: Thu, 11 Mar 2021 17:04:58
Message-Id: f4607a94-07fa-de41-affe-d051d0015753@spamtrap.tnetconsulting.net
In Reply to: Re: [gentoo-user] Why do we add the local host name to the 127.0.0.1 / ::1 entry in the /etc/hosts file? by Michael
1 On 3/11/21 6:38 AM, Michael wrote:
2 > The syntax is:
3 >
4 > IP_address canonical_hostname [aliases...]
5
6 The man page for hosts has the following to say:
7
8 > DESCRIPTION
9 > This manual page describes the format of the /etc/hosts file.
10 > This file is a simple text file that associates IP addresses with
11 > hostnames, one line per IP address. For each host a single line
12 > should be present with the following information:
13 >
14 > IP_address canonical_hostname [aliases...]
15 >
16 > The IP address can conform to either IPv4 or IPv6. Fields of the
17 > entry are separated by any number of blanks and/or tab characters.
18 > Text from a "#" character until the end of the line is a comment, and
19 > is ignored. Host names may contain only alphanumeric characters, minus
20 > signs ("-"), and periods ("."). They must begin with an alphabetic
21 > character and end with an alphanumeric character. Optional aliases
22 > provide for name changes, alternate spellings, shorter hostnames,
23 > or generic hostnames (for example, localhost). If required, a host
24 > may have two separate entries in this file; one for each version of
25 > the Internet Protocol (IPv4 and IPv6).
26
27 I want to call out "For /each/ /host/ a *single* *line* should be
28 present" and "a host /may/ /have/ *two* /separate/ /entries/ in this
29 file; *one* /for/ /each/ /version/ /of/ /the/ /Internet/ /Protocol/".
30
31 I interpret this to mean that any given host name (alias or canonical)
32 should appear on at most one line per protocol family.
33
34 As such, having the local host's name, qualified or not, appear on
35 multiple lines for the same protocol is contrary to what the man page
36 states.
37
38
39
40 --
41 Grant. . . .
42 unix || die