About the cloud-init configuration problem in the hard disk image (raw/qcow2)

Recently in use, I found that cloud-init is used to configure the image, but DNS cannot be configured. Looking at the document, I found that network-manager is used for network configuration, and the priority used in the cloud-init configuration file is netplan. , I hope it can be modified in the next version of the image, or the package of the next version of cloud-init software, thank you.

My English is not very good. I used Google Translate to translate, and then the original Chinese text.

最近在使用中,发现使用cloud-init对镜像经行配置,无法对DNS配置,看文档发现,使用的是network-manager进行网络配置,而在cloud-init的配置文件中使用的优先权为 netplan,希望能在下一个版本的镜像中,或下一版本cloud-init软件包进行修改,谢谢。

1 Like

I’m not quite sure what exactly the issue is, but by default for most images, DNS will be done via DHCP by default. You should be able to open the disk image with qemu-kvm or virt-manager and modify the network device to override DNS or use DHCP.

You can try the cloud-init way with the manage_resolve_conf module, but I honestly have never tried this with the default systemd-resolved in Fedora (I’m assuming that you’re attempting to run a Fedora 37 guest) and I’m honestly not sure if it will work since systemd would likely overwrite it. You can disable systemd-resolved in the image and then it should probably work. It might be possible to do all of this with a cloud-init script in one-shot as well.

1 Like

But I use Proxmox …

Shouldn’t matter as you’re presumably using the libvirt backend for it with a raw/qcow2 image. You can use qemu or virt-manager to update it and then re-register it with proxmox and cloud-init doesn’t really care much about the platform itself.

Is this related to your issue?

2 Likes

yes .it’s.
But this bug only in Fedora 37
I has add Cloud-init cfg On VM
/etc/cloud/cloud.cfg.d/00_setdns.cfg

#cloud-config
bootcmd:
 - nmcli con mod "eth0" ipv4.dns *****
 - nmcli con mod "eth0" ipv6.dns *****
 - nmcli con up id "eth0"

In addition, the official cloud-init file for fedora’s network template is

   network:
      renderers: ['netplan', 'network-manager', 'networkd', 'sysconfig', 'eni']

But Fedora not use 'netlan" ,It use ‘network-manager’.

1 Like