Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: Gentoo User <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: Wed, 10 Mar 2021 13:27:44
Message-Id: CAK2H+edOhCjcokfLW=qF+HddMRqHNXMrd9gpvyn4NFHpyfObeQ@mail.gmail.com
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 Grant Taylor
1 On Tue, Mar 9, 2021 at 10:10 PM Grant Taylor <
2 gtaylor@×××××××××××××××××××××.net> wrote:
3 >
4 > On 2/21/21 3:23 PM, Grant Taylor wrote:
5 > > Will someone please explain why the Gentoo AMD64 Handbook ~> Gentoo (at
6 > > large) says to add the local host name to the 127.0.0.1 (or ::1) entry
7 > > in the /etc/hosts file? What was the thought process behind that?
8 >
9 > Shameless Bump -- I'm still interested in understanding the logic
10 > behind the choice in the Gentoo Handbook.
11 >
12 > Additional information.
13 >
14 > The Samba Wiki states the following in the Preparing the Installation
15 > section of the Setting up Samba as an Active Directory Domain Controller
16 > document.
17 >
18 > "The host name and FQDN must not resolve to the 127.0.0.1 IP address or
19 > any other IP address than the one used on the LAN interface of the DC."
20 >
21 > Link - Setting up Samba as an Active Directory Domain Controller -
22 > Preparing the Installation
23 > -
24 >
25 https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller#Preparing_the_Installation
26 >
27
28 AND
29
30 [quote]
31 I'm reading Kerberos - The Definitive Guide[1] and it makes the
32 following comment:
33
34 > And to make matters worse, some Unix systems map their own hostname
35 > to 127.0.0.1 (the loopback IP address).
36 [/quote]
37
38 Caveat - not an expert, just my meager understanding:
39
40 1) The name 'localhost' is historically for developers who want to access
41 their own machine _without_ using DNS.
42
43 2) By general practice sometime in the deep, dark times 127.0.0.1 was
44 accepted for this purpose. There's nothing special about the address.
45
46 3) I read the original quoted comment in the Kerberos Guide as a warning -
47 'to make matters worse, __SOME__"
48
49 4) In my /etc/hosts I do _NOT_ map my machine's name to the same address as
50 localhost, avoiding the Kerberos warning:
51
52 mark@science:~$ cat /etc/hosts
53 127.0.0.1 localhost
54 127.0.1.1 science
55
56 # The following lines are desirable for IPv6 capable hosts
57 ::1 ip6-localhost ip6-loopback
58 fe00::0 ip6-localnet
59 ff00::0 ip6-mcastprefix
60 ff02::1 ip6-allnodes
61 ff02::2 ip6-allrouters
62
63 mark@science:~$ ping localhost
64 PING localhost (127.0.0.1) 56(84) bytes of data.
65 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.032 ms
66
67 mark@science:~$ ping science
68 PING science (127.0.1.1) 56(84) bytes of data.
69 64 bytes from science (127.0.1.1): icmp_seq=1 ttl=64 time=0.032 ms
70
71 mark@science:~$ hostname
72 science
73 mark@science:~$ hostname -I
74 192.168.86.42
75 mark@science:~$ hostname -A
76 science.lan
77 mark@science:~$ hostname -f
78 science
79 mark@science:~$ hostname -i
80 127.0.1.1
81 mark@science:~$

Replies