Netplan, VLANs, and Nameservers (Where does all the info come from?)

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.

  • Why does netplan generate a config file for the vlan subinterface, but nothing for the main interface? (The correct IP gets assigned, but the nameserver doesn't get added to /etc/resolv.conf).
  • Is the information in the /etc/NetworkManager/no-stub-resolv.conf file being generated from the yaml file in /etc/netplan?
  • How do I get the main interface's IP (192.168.51.7) or the loopback address (127.0.0.1) to show up in /etc/resolv.conf as the first nameserver?

Anything that points me in the right direction is appreciated. Thanks

0
задан 21 November 2020 в 10:30

0 ответов

Другие вопросы по тегам:

Похожие вопросы: