cloudinit and DHCP supplied nameservers

Udo Rader udo.rader at bestsolution.at
Wed Jun 22 17:08:07 CEST 2022


Hi,

I've already asked this in the forum, but didn't get an answer, so 
trying here :)

https://forum.proxmox.com/threads/cloudinit-how-to-get-nameservers-and-other-networking-settings-via-dhcp.110691/

Playing with the cloudinit features, I noticed that even though I 
configured DHCP for my IPv4 configuration, the nameservers would still 
be copied from the PVE node running the cloudinit based VM, if I did not 
manually specify them for the VM.

If I look at the created cloudinit image, it instead contains the copied 
resolver information from the PVE node, for example like this:

version: 1
config:
     - type: physical
       name: eth0
       mac_address: 'xx:xx:xx:xx:xx'
       subnets:
       - type: dhcp4
     - type: nameserver
       address:
       - '1.2.3.4'
       - '2.3.4.5'
       - '6.7.8.9'
       search:
       - 'pve1.example.com'

Maybe I am missing something, but this looks weird to me.

I then did a quick hack in /usr/share/perl5/PVE/QemuServer/Cloudinit.pm 
and commented out the part that creates the nameserver branch in the 
cloudinit image and now the /etc/resolv.conf gets correctly populated 
via DHCP.

Well, is this a feature or a bug :)

-- 
Udo Rader, MSc MBA, CTO
BestSolution.at EDV Systemhaus GmbH
Salurner Straße 15, A-6020 Innsbruck
http://www.bestsolution.at/
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck



More information about the pve-devel mailing list