I have netplan setup for one physical interface which in turn has a single vlan subinterface. Both the untagged interface and the vlan interface are statically addressed and have appropriate nameservers listed in the yaml file. My netplan config looks like this:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
eno1:
addresses:
[ 192.168.51.7/24 ]
gateway4: 192.168.51.1
nameservers:
search: [ my.domain ]
addresses: [ 127.0.0.1, 192.168.51.8 ]
vlans:
IOTDevices:
id: 4
link: eno1
addresses:
[ 192.168.4.7/24 ]
gateway4: 192.168.4.1
nameservers:
search: [ my.domain ]
addresses: [ 127.0.0.1, 192.168.4.8 ]
This seems to generate a single file (IOTDevices.dhcp) in /run/dhcpd/resolv.conf which looks like this:
# Generated by dhcpcd from IOTDevices.dhcp
domain my.domain
search my.domain
nameserver 192.168.4.8
nameserver 192.168.4.7
This in turn seems to populate the /etc/resolv.conf file which looks like this:
# Generated by dhcpcd from IOTDevices.dhcp
# /etc/resolv.conf.head can replace this line
domain my.domain
nameserver 192.168.4.8
nameserver 192.168.4.7
# /etc/resolv.conf.tail can replace this line
I also see a file at /etc/NetworkManager/no-stub-resolv.conf which contains the IPs of both of the host's interfaces as well as the loopback address. All of these are valid nameservers as the host runs PiHole and Unbound.
# Generated by NetworkManager
search my.domain
nameserver 127.0.0.1
nameserver 192.168.51.8
nameserver 192.168.4.8
When I use dig to test DNS resolution, the response comes from 192.168.4.8 which is the first IP that appears in /etc/resolv.conf.
Anything that points me in the right direction is appreciated. Thanks
В верхней части файла конфигурации указано «Создано dhcpcd из IOTDevices.dhcp». Это не часть сетевого плана. У вас установлен пакет dhcpcd
, который не является частью системы Ubuntu по умолчанию и не интегрируется с netplan. Вы должны удалить этот пакет, а также resolvconf
, который также не является частью стандартного сетевого стека Ubuntu.
Внесение этих изменений должно привести к восстановлению файла /etc/resolved.conf как символической ссылки на управляемый файл systemd-resolved в каталоге /run.