2

Scenario:

  • Attempt to resolve host named 'puppet' in domain 'puppet.mydomain.com'
  • Resolution is successful if the resolv.conf file does not include search directive for 'localdomain' and only the domain 'mydomain.com'.

Resolv.conf working:

nameserver 1.2.3.4
search mydomain.com

Resolv.conf failed:

nameserver 1.2.3.4
search localdomain mydomain.com
  • The system is multihomed
  • Both interfaces have "domain-name mydomain.com" and "domain-search mydomain.com" directives in /etc/network/interfaces.

How can the resolution fail with an additional domain? Shouldn't resolution be attempted for all listed domains?

What do I need to configure to prevent localdomain from being added to the resolv.conf file?

2
  • What result do you get if you look up puppet.localdomain directly? Use dig or another DNS tool that produces good diagnostics. Perhaps this name resolves in a way you don't expect which causes the subsequent query for puppet.mydomain.com to not be tried.
    – Celada
    Jul 5, 2013 at 0:41
  • You say «Both interfaces have "domain-name mydomain.com" and "domain-search mydomain.com" directives in /etc/network/interfaces.» Did you mean to say that both interfaces have dns-domain mydomain.com and dns-search mydomain.com in /e/n/i?
    – jdthood
    Jul 5, 2013 at 4:54

2 Answers 2

1

What do I need to configure to prevent localdomain from being added to the resolv.conf file?

First make sure that the resolvconf package is installed and that /etc/resolv.conf is a symbolic link to ../run/resolvconf/resolv.conf.

Second make sure that there are no domain or search lines in any of the files in /etc/resolvconf/resolv.conf.d/.

Third, find out where localdomain is coming from. If your interface is configured via DHCP then it's probably being sent by the DHCP server. Then fix the DHCP server configuration. If NetworkManager is involved, use the Connection Editor to make sure that localdomain is not in the Additional search domains field on the IPv4 Settings tab of any active connections.

2
0

I have a similar issue where resolution without a dot tries to resolve to the localdomain, which I do not want. localdomain is added to the symlinked /etc/resolv.conf file on Ubuntu 18.04 which is managed by systemd-resolved according to the file comments.

I found some info on how to set search domains but it does not explain the presence of this specific domain, I am guessing it's some kind of default.

It's possible to set search domains like this :

sudo systemd-resolve --set-domain=local --set-domain=prod.ldap --interface=enxxxxxxxxx

If anyone can explain where and why localdomain is always present it's appreciated. The above command can be used to set per interface search domains, which seems like a good workaround - this does not survive a reboot.

Another option to set search domains is to use the network manager GUI tha was hidden, run from a terminal:

nm-connection-editor

There you can set search domains, those will be appended to localdmain, not replace it. I hope this helps anyone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .