Nameserver configuration in cloud-init isn't picked up

cliksuresh18

New Member
Jan 20, 2024
3
0
1
I am trying to create 2 ubuntu 22.04 VMs through cloud-init. The nameserver config in cloud-init is not reflecting in /etc/resolve.conf. Due to this, the dns resolution isn't working for the hosts in the same network.

output of cat /etc/netplan/50-cloud-init.yaml

Bash:
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            - 192.168.10.30/24
            match:
                macaddress: 0a:0b:30:d8:db:d3
            nameservers:
                addresses:
                - 192.168.1.10
                search:
                - localdomain
            routes:
            -   to: default
                via: 192.168.10.1
            set-name: eth0


Output of resolvectl status
Bash:
Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (eth0)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.10
       DNS Servers: 192.168.1.10
        DNS Domain: localdomain

Link 3 (docker0)
Current Scopes: none
     Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported

output of cat /etc/resolv.conf

Code:
nameserver 127.0.0.53
options edns0 trust-ad
search localdomain

If I add the line nameserver 192.168.1.10 in the resolv.conf, the DNS resolution works.

I tried a few options but none of these works.

- Clear the cloud-init and restart
- change 50-cloud-init.yaml and reapply netplan
- Use DHCP instead of static ip

Is there anything else I can try to troubleshoot this.?
 
Last edited:
This is the error i get if I try to resolve. If I add nameserver 192.168.1.10 to resolv.conf file, the server is reachable

Code:
ubuntu@k8s-control-1:~$ ping k8s-control-2
ping: k8s-control-2: Temporary failure in name resolution[/CODE
 
I have the same thing happening where the nameserver shows 127.0.0.53. Where you able to get this resolved?
 
The same thing here for me, the name server is not set, although the search domain get´s set correctly in /etc/resolv.conf.
 
The same thing here for me, the name server is not set, although the search domain get´s set correctly in /etc/resolv.conf.
forgot to mention: i am using Ubuntu 24.04.
Digging futher into this issue, i noticed that /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf. Although the nameserver IP does not get set in stub-resolv.conf, i further noticed that there is also a resolv.conf in that directory. And there both nameserver and search domain get set correctly.
To my stupidity I have to admit that the DNS resolution always worked, i can resolve internal and external names successfully :rolleyes:
Due to the missing entry in /etc/resolv.conf, I initially thought DNS resolution wouldn't work. It seems like the config in /run/systemd/resolve/resolv.conf is active.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!