I have netplan managing a simple bridge and have DNS served with BIND from the same server, it's all working perfectly well except for relative domain resolution.
host -t A foo outputs:
foo.example.com has address 192.168.0.3but host -t A bar.foo (which is an alias of foo) outputs:
Host bar.foo not found: 3(NXDOMAIN)even though ping bar.foo correctly resolves the domain alias and outputs:
PING foo.example.com (192.168.0.3) 56(84) bytes of data.I think this can be controlled by adding ndots:2 to the options directive in /etc/resolv.conf so that the second query is seen as relative, but of course it's not a directly editable file. What's the correct way to pass this configuration on from netplan? Or is there another place this can be specified? I don't want to make /etc/resolv.conf a regular file if it can be avoided.
I didn't find anything helpful in the resolved.conf manpage.
/etc/netplan/00-my-config.yaml:
network: ethernets: eno1: dhcp4: false dhcp6: false version: 2 bridges: br0: interfaces: - eno1 addresses: - 192.168.0.2/24 gateway4: 192.168.0.1 nameservers: addresses: - 192.168.0.2 - 192.168.0.1 search: - example.com/etc/resolv.conf:
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
search example.com 1 Answer
You have two separate issues:
host -t A bar.fooexplicitly looks for an "A" record for "bar.foo". Assuming you mean that "bar.foo" is a CNAME for "foo", I think specifying the-t Ashould return NXDOMAIN as there is no A record.- Netplan.io defers to
system-resolvedfor DNS management. It appears that systemd explicitly opted to NOT support ndots-like functionality. I think this is a moot point as your problem is because of your options to thehostcommand as described above.