cloud-init DNS settings - bad interface

Snowmanko

Member
Apr 8, 2021
6
0
21
37
Hi,

I would like to know how to configure DNS server (resolver) on network interfaces and not only localhost.
When I configure DNS server cloud-init only configure this DNS server on loopback interface.

# cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback
dns-nameservers 8.8.8.8

What am I doing wrong ?
 

Attachments

  • Screenshot 2021-08-05 at 15.09.08.png
    Screenshot 2021-08-05 at 15.09.08.png
    31.6 KB · Views: 5
Last edited:
resolv.conf is symlink to : /etc/resolv.conf -> ../run/resolvconf/resolv.conf
and it's empty

Code:
# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

# cat /etc/network/interfaces
Code:
auto lo
iface lo inet loopback

source /etc/network/interfaces.d/*.cfg

see this:

# cat /etc/network/interfaces.d/50-cloud-init.cfg
Code:
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
auto lo
iface lo inet loopback
    dns-nameservers 8.8.8.8
    dns-search domain.com

auto eth0
iface eth0 inet static
    address x.y.z.u/27

In general I am looking for a way to provide DNS configuration (with cloud-init) to resolv.conf so VM will be able to resolve with local resolver.
 
Last edited:
Have you installed the `resolvconf` package?