Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myhostname: should recommend installing it before dns/resolve? #1280

Closed
fsateler opened this issue Sep 16, 2015 · 3 comments
Closed

myhostname: should recommend installing it before dns/resolve? #1280

fsateler opened this issue Sep 16, 2015 · 3 comments

Comments

@fsateler
Copy link
Member

Having myhostname after dns/resolve in nsswitch.conf presents the following problems:

  1. If /etc/hosts is empty/nonexistent, querying for localhost will ask dns first, which does not seem reasonable.
  2. Querying for *.localhost will always ask dns first.
  3. Querying the local configured hostname or any subdomain will query dns first.
  4. Plenty of programs want to know the fqdn, so if the connection is flaky/slow but not dead you get (possibly very long) delays in resolving it.

The manpage suggests problem 3 is by design, but then if I'm using a local dns to resolve local hostnames, why do I want myhostname for?

I think myhostname should be recommended to be configured before dns, and note problem 3 in the manpage so that people can move it last if they need to. I can prepare a PR if you think the change should be made.

@martinpitt
Copy link
Contributor

I was wondering about that too (and actually disabled myhostname again as it causes some 10 second lag when resolving local host addresses). IIRC myhostname is essentially a dynamic replacement for /etc/hosts, isn't it? Shouldn't it follow right after files then, even before mdns4_minimal and particularly before dns?

Note that I do see why we recommend putting mymachines last in the list, but IMHO in the case of collision you want dns to win, while the local host name should always be defined, well, locally :) This particularly applies to localhost, localhost.localdomain, etc.

Is there a particular reason why it should follow dns and thus make it subject to achingly long delays?

@poettering
Copy link
Member

I am pretty sure many people rely that "hostname --fqdn" returns the fqdn of the system. Hence the local hostname should be resolved via DNS first really, because otherwise "hostname --fqdn" will always return the nss-myhostname resolved hostname, i.e. the actual system hostname. The only way how to my nss-myhostname two modules, one htat resolves the local hostname, and is done after dns, and one that resolves "localhost", and is placed before dns.

Note that resolved removes the issues around this, as it refuses to resolve localhost via DNS. In fact, I am pretty sure that's the right way to go here...

@poettering
Copy link
Member

I figure this is the same one as #1605... Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants