Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
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: Wed, 10 Mar 2021 15:25:50
Message-Id: 9854601.nUPlyArG6x@lenovo.localdomain
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 Mark Knecht
1 On Wednesday, 10 March 2021 13:27:24 GMT Mark Knecht wrote:
2 > On Tue, Mar 9, 2021 at 10:10 PM Grant Taylor <
3 >
4 > gtaylor@×××××××××××××××××××××.net> wrote:
5 > > On 2/21/21 3:23 PM, Grant Taylor wrote:
6 > > > Will someone please explain why the Gentoo AMD64 Handbook ~> Gentoo (at
7 > > > large) says to add the local host name to the 127.0.0.1 (or ::1) entry
8 > > > in the /etc/hosts file? What was the thought process behind that?
9 > >
10 > > Shameless Bump -- I'm still interested in understanding the logic
11 > > behind the choice in the Gentoo Handbook.
12 > >
13 > > Additional information.
14 > >
15 > > The Samba Wiki states the following in the Preparing the Installation
16 > > section of the Setting up Samba as an Active Directory Domain Controller
17 > > document.
18 > >
19 > > "The host name and FQDN must not resolve to the 127.0.0.1 IP address or
20 > > any other IP address than the one used on the LAN interface of the DC."
21 > >
22 > > Link - Setting up Samba as an Active Directory Domain Controller -
23 > > Preparing the Installation
24 > >
25 > > -
26 >
27 > https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Dom
28 > ain_Controller#Preparing_the_Installation
29 >
30 >
31 > AND
32 >
33 > [quote]
34 > I'm reading Kerberos - The Definitive Guide[1] and it makes the
35 >
36 > following comment:
37 > > And to make matters worse, some Unix systems map their own hostname
38 > > to 127.0.0.1 (the loopback IP address).
39 >
40 > [/quote]
41 >
42 > Caveat - not an expert, just my meager understanding:
43 >
44 > 1) The name 'localhost' is historically for developers who want to access
45 > their own machine _without_ using DNS.
46 >
47 > 2) By general practice sometime in the deep, dark times 127.0.0.1 was
48 > accepted for this purpose. There's nothing special about the address.
49 >
50 > 3) I read the original quoted comment in the Kerberos Guide as a warning -
51 > 'to make matters worse, __SOME__"
52 >
53 > 4) In my /etc/hosts I do _NOT_ map my machine's name to the same address as
54 > localhost, avoiding the Kerberos warning:
55 >
56 > mark@science:~$ cat /etc/hosts
57 > 127.0.0.1 localhost
58 > 127.0.1.1 science
59 >
60 > # The following lines are desirable for IPv6 capable hosts
61 >
62 > ::1 ip6-localhost ip6-loopback
63 >
64 > fe00::0 ip6-localnet
65 > ff00::0 ip6-mcastprefix
66 > ff02::1 ip6-allnodes
67 > ff02::2 ip6-allrouters
68 >
69 > mark@science:~$ ping localhost
70 > PING localhost (127.0.0.1) 56(84) bytes of data.
71 > 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.032 ms
72 >
73 > mark@science:~$ ping science
74 > PING science (127.0.1.1) 56(84) bytes of data.
75 > 64 bytes from science (127.0.1.1): icmp_seq=1 ttl=64 time=0.032 ms
76 >
77 > mark@science:~$ hostname
78 > science
79 > mark@science:~$ hostname -I
80 > 192.168.86.42
81 > mark@science:~$ hostname -A
82 > science.lan
83 > mark@science:~$ hostname -f
84 > science
85 > mark@science:~$ hostname -i
86 > 127.0.1.1
87 > mark@science:~$
88
89 I think this is relevant to DNS resolution of/with domain controllers and may
90 depend on the AD/DC topology. The idea is to use the LAN address of the box
91 as the first address in /etc/hosts and use 127.0.0.1 as the second address in
92 the file. If more AD/DNS servers exist in the network, then 127.0.0.1 could
93 be even further down the list.
94
95 https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ff807362(v=ws.10)?redirectedfrom=MSDN
96
97 I haven't over-thought this and there may be more to it, but on a pure linux
98 environment I expect this would not be a requirement, hence the handbook
99 approach.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies