Bug 486461

Summary: Defining IPv6 and IPv4 loopback addresses needs multi on
Product: [Fedora] Fedora Reporter: Allen Kistler <ackistler>
Component: setupAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dcantrell, ovasik, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: setup-2.8.1-1.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-26 12:42:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 486457    

Description Allen Kistler 2009-02-19 21:06:43 UTC
Description of problem:
The loopback address should always be "localhost" whether it's IPv4 or IPv6. However, defining both 127.0.0.1 and ::1 as localhost in /etc/hosts also requires inserting "multi on" in /etc/host.conf.  For example, on an IPv6 remote host, X cannot connect to "localhost:10.0" to tunnel X over ssh if localhost is not ::1.

Version-Release number of selected component (if applicable):
setup-2.7.7-4.fc11.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install F11 on a remote X client
2. Configure sshd on client to support IPv6 only (AddressFamily inet6)
3. From a local X server "ssh -X <remote-ipv6-X-client>"
4. xclock (or any X application)
  
Actual results:
Error: Can't open display: localhost:10.0

Expected results:
xclock (or any other X application) runs on local X server

Additional info:
See Bug 486457 for defining both 127.0.0.1 and ::1 as localhost in /etc/hosts.

This bug is to add "multi on" to /etc/host.conf so that resolution of localhost returns both IPv4 and IPv6 values from the /etc/hosts definitions.  I know the default for multi is off if it's absent, but considering other host entries may have also both IPv4 and IPv6 values, I think there's an even stronger argument for inserting "multi on" in /etc/host.conf as the default for that file.

Note that F9 did/does not need the entry in /etc/host.conf for resolution of multiple lines, only the edit to /etc/hosts.  (I don't know about F10.  I didn't check.)

For out-of-the-box IPv6-only (or dual-stacked) operation, gethost* functions should return IPv6 (or both IPv6 and IPv4) addresses for "localhost" without having to edit any config files.

Comment 1 Ondrej Vasik 2009-02-20 09:49:38 UTC
I'm a bit worried about the change consequences.
Host.conf(5) manpage states about "multi":
'This  is  off  by default, as it may cause a substantial performance loss at sites with large hosts files.'

To be honest - I don't know how big is that performance loss - and I don't want to add something what could cause performance impact on large servers. On other side - you are right that something to get IPv6-only box should work properly without editing config files. 

As a side note - shiping default /etc/hosts by setup was recently requested in bz #483244 , it would have 
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

so it should not cause confusion for resolv+ library between IPv4 and IPv6 loopback even without multi on activated.

Comment 2 Allen Kistler 2009-02-20 14:12:16 UTC
The performance hit of "multi on" refers more to a time before the existence of DNS than now.  Once upon a time, there was no DNS, and /etc/hosts could be several kB in size.  Moreover, in order to keep /etc/hosts synced throughout the enterprise, /etc/hosts could be a symbolic link into an NFS mount so that only one hosts file had to be maintained.  The resolution functions with multi off would search for the queried name and stop at the first hit.  With multi on, it has to scan the whole file for multiple entries.  I doubt that either the large size or the remote mount are true in any enterprise (or even home network) today.

In Bug 486457, I'm suggesting that /etc/hosts should be
127.0.0.1       localhost.localdomain localhost
::1             localhost.localdomain localhost

... because there really is no such thing as localhost6.  As discussed in the original description, applications refer to the literal "localhost" no matter what its IP address is, including the address family.  There's no confusion.  localhost is localhost.

Editing /etc/hosts as above is what I've done for IPv6 functionality in F9.  In F11, I discovered I must also explicitly set multi on because, intentional or not, that's what the default was in F9.

Ultimately the idea is to get IPv6 working out-of-the-box.  As I said, localhost is localhost.  Additionally, it seems likely to me that hosts could have both IPv4 and IPv6 addresses defined as dual-stacking becomes more common.  But my main concern is localhost.

As for whether anaconda or setup owns or creates /etc/hosts, I have no strong preference.  anaconda creates it now probably only because it also inserts the host name into the file, and the host name isn't a fixed definition from installation to installation.

Comment 3 Ondrej Vasik 2009-02-26 12:42:09 UTC
"multi on" option added to default /etc/host.conf and built as
setup-2.8.1-1.fc11, closing RAWHIDE