Ubuntu Cloud Init: Setting DNS not working

This might have worked in previous versions of cloud-init.
I assume the image you're using has cloud-init 22.1 or 22.2 installed?
 
This might have worked in previous versions of cloud-init.
I assume the image you're using has cloud-init 22.1 or 22.2 installed?
Yes, 22.2-0ubuntu1~22.04.2


Edit:
Also checked on Debian 11.3:
/usr/bin/cloud-init 20.4.1

So it might actually be version related.
But that also means Debian will have the same problem at some point
 
Last edited:
Yes, 22.2-0ubuntu1~22.04.2


Edit:
Also checked on Debian 11.3:
/usr/bin/cloud-init 20.4.1

So it might actually be version related.
But that also means Debian will have the same problem at some point
Not necessarily if it is a renderer issue, rather than an issue with the source.

I am having the exact same issue.
Did you find a way to solve it ?
For now the workaround would be to manually create a network config for cloud-init [0] using the network configuration v2 format [1].


[0] https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_cloud_init
[1] https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html
 
Hi @mira, Link [1] above is now at : https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html#network-config-v2

@Vengance:

You can reference the relevant section:
https://cloudinit.readthedocs.io/en...l#dhcp4-overrides-and-dhcp6-overrides-mapping

And the definitions:
https://netplan.readthedocs.io/en/latest/netplan-yaml/#dhcp-overrides

So if you create a snippet file with the required v2 config:

eg. /mnt/pve/cephfs/snippets/network-debian-12.yaml

YAML:
version: 2
ethernets:
  eth0:
    dhcp4: true
    match:
      macaddress: bc:24:11:80:df:de
    set-name: eth0
    dhcp4-overrides:
      use-dns: true
      use-domains: true

You can then replace the default v1 network config with this file:

qm set <vm-id> --cicustom "network=cephfs:snippets/network-debian-12.yaml"

If you wish to use the snippet with multiple images you may need to use a mechanism other than macaddress to match the network adapter.
 
  • Like
Reactions: mira
Also worth noting is that the set-name: eth0 option causes a race condition with persistient network interface naming in some images that prevents matching on anything other than mac address.

eg. this works:
YAML:
version: 2
ethernets:
  ens18:
    dhcp4: true
    match:
      driver: virtio_net
    dhcp4-overrides:
      use-dns: true
      use-domains: true
but this doesn't:
YAML:
version: 2
ethernets:
  eth0:
    dhcp4: true
    match:
      driver: virtio_net
    set-name: eth0
    dhcp4-overrides:
      use-dns: true
      use-domains: true
 

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!