[Bug 1015030] Re: Use nss-myhostname to provide default IP address of UNIX hostname

Thomas Hood 1015030 at bugs.launchpad.net
Tue Jun 19 10:13:35 UTC 2012


I see that nss-myhostname has been packaged for Debian as libnss-
myhostname.  It's in universe.

    $ apt-cache madison libnss-myhostname
    libnss-myhostname |      0.3-4 | http://nl.archive.ubuntu.com/ubuntu/ quantal/universe amd64 Packages

It has already been patched so that it returns 127.0.1.1 rather than
127.0.0.2.

I see also that in version 0.3, nss-myhostname was enhanced such that
* it returns an external IP address if the machine has one, falling back to 127.0.1.1 if it doesn't;
* and so, in nsswitch.conf on the "hosts:" line, 'myhostname' can be listed right after 'files' so that dns doesn't have to be tried first.

I forgot to mention that this report arose out of discussion at bug
#234543 which also hearkens back to Debian bug report #267321. But these
are far from the only discussions about this issue.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netcfg in Ubuntu.
https://bugs.launchpad.net/bugs/1015030

Title:
  Use nss-myhostname to provide default IP address of UNIX hostname

Status in “netcfg” package in Ubuntu:
  New

Bug description:
  Currently the installer creates this /etc/hosts for a machine named
  'foo':

      127.0.0.1	localhost
      127.0.1.1	foo

  If foo is connected to a LAN with domain name 'bar.com' then it's
  generally the case that 'foo.bar.com' resolves to the machine's
  external IP address.  But 'foo' continues to resolve to 127.0.1.1
  because nsswitch.conf contains

      hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

  where 'files' is given first.  Hence "ping foo" pings 127.0.1.1 but
  "host foo" returns the external IP address.

  To eliminate this inconsistency the line

      127.0.1.1   foo

  could be eliminated from /etc/hosts and the "myhostname" NSS provider
  (suitably modified so that it returns 127.0.1.1 for the UNIX hostname)
  added to nsswitch.conf at the end of the "hosts" line.  That way,
  127.0.1.1 is still returned for the name 'foo' but only if other
  methods of name resolution have failed to resolve the name 'foo'.

  The Myhostname NSS provider is another fine product brought to you by
  supercoder Lennart Poettering.

      http://0pointer.de/lennart/projects/nss-myhostname/

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/1015030/+subscriptions




More information about the foundations-bugs mailing list