[systemd-devel] nss-myhostname: why don't loopback interfaces appear?

Daurnimator quae at daurnimator.com
Tue Jun 2 23:31:12 PDT 2015


On 3 June 2015 at 16:01, Lennart Poettering <lennart at poettering.net> wrote:
> On Wed, 03.06.15 15:40, Daurnimator (quae at daurnimator.com) wrote:
>
>> I was playing around with nss, and found that my loopback interface ip
>> doesn't appear from nss-myhostname.
>> Rather, my other ones do.
>> Furthermore, unless I request IPv4, link-local IPv6 addresses are
>> returned. Is this expected?
>
> We order the returned addresses by scope. Global addresses are
> placed first, local ones last.

Then why are link local IPv6 addresses returned first?

If this was the case, I would expect to see:

192.168.2.229
192.168.2.21
fe80::aed1:b8ff:fec0:d113
fe80::9eeb:e8ff:fe1b:f42d
127.0.0.1
::1

> We return addresses on the loopback device only when there's no other
> address known.

What's the rationale for this? (i.e. why not always just include
127.0.0.1 and ::1 last?)

> And even then we'll return 127.0.0.2 rather than
> 127.0.0.1, to avoid confusing software that expects "localhost" mapping
> only to 127.0.0.1 and vice versa.
>
> Also see nss-myhostname(8).


More information about the systemd-devel mailing list