How to get the systemd resolver to resolve local (i.e. unqalified) names?

Tom H tomh0665 at gmail.com
Tue Jun 6 08:31:55 UTC 2017


On Sun, Jun 4, 2017 at 2:50 PM, Xen <list at xenhideout.nl> wrote:
> Tom H schreef op 04-06-2017 19:53:


>> The search list is normally determined from the local domain name; by
>> default, it contains only the local domain name.
>
> Hmm. I personally still don't know exactly how the local domain name is
> usually configured.
>
> You can put it in /etc/hostname but it is not also in /etc/hosts, your local
> resolving might not find it?
>
> ie. I always have in /etc/hosts:
>
> IP host host.local

You shouldn't use "local" as a domainname; it's reserved for mdns.


> at that point hostname -f will give a result.
>
> but only hostname (/etc/hostname) might not work.
>
> so I don't exactly know where it derives the local domain from :p.

What I do (ignoring ipv6 in hosts):

1) on non-systemd

1a) cat /etc/hostname
hostname

1b) cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 hostname.domainname hostname

The domainname is determined from the "127.0.1.1" line.

2) on recent systemd (or when myhostname is installed with or without systemd)

1a) cat /etc/hostname
hostname.domainname

1b) cat /etc/hosts
127.0.0.1 localhost

The domainname is determined from having "myhostname" on the "hosts"
line in "/etc/nsswitch.conf".


> A domain is also specific to a certain entry path. Your host could have
> different domains based on different connections.

In that case, the domainname's determined by the associated ip address
or by a dns server.


> Principally a host doesn't even have a domain. It is part of a domain, or
> can be part of one, but it does not "have" one.

ACK. Even the hostname's irrelevant, network-wise, unless you have a dns server.




More information about the ubuntu-users mailing list