CentOS 7 Cloud-init Inserting Unexpected DNS Server

morey-tech

Active Member
Aug 3, 2017
1
0
41
26
Ottawa, Canada
morey.tech
Below is the cloud-init network configuration for the VM:
root@proxmox:~# qm cloudinit dump XXX network
version: 1
config:
- type: physical
name: eth0
mac_address: 'ce:f0:98:cb:ad:0f'
subnets:
- type: static
address: '10.x.x.x'
netmask: '255.255.255.0'
gateway: '10.x.x.x'
- type: nameserver
address:
- '10.x.x.x'
search:
- 'example.domain'

But when the VM boots, there is an additional DNS server being inserted by cloud-init:
[user@centos ~]$ cat /etc/resolv.conf
; Created by cloud-init on instance boot automatically, do not edit.
;
# Generated by NetworkManager
nameserver 192.168.122.1
nameserver 10.x.x.x
search example.domain

The DNS server `192.168.122.1` is being added but is not apart of the configuration and is not functional:
[user@centos ~]$ nslookup google.com 192.168.122.1
;; connection timed out; no servers could be reached

Here are the steps I used to create the cloud-init template (and to reproduce the issue):
# wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2003.qcow2 -O /var/lib/vz/images/CentOS-7-x86_64-GenericCloud-2003.qcow2
# qm create XXX --memory 2048 --net0 virtio,bridge=vmbr0
# cd /var/lib/vz/images/
# qm importdisk XXX CentOS-7-x86_64-GenericCloud-2003.qcow2 local
# qm set XXX --scsihw virtio-scsi-pci --scsi0 local:XXX/vm-XXX-disk-0.raw
# qm set XXX --ide2 local:cloudinit
# qm set XXX --boot c --bootdisk scsi0
# qm set XXX --serial0 socket --vga std
# qm template XXX
[clone from the template and configure cloud-init in the GUI]

I've tested with an Unbuntu Focal image and this appears to be an issue with only the CentOS images (7 and 8), but everything I've read so far has indicated to use the GenericCloud image provided by CentOS.

I'm looking for suggestions on how to address this.
  • Is there a setting I'm missing?
  • Is there a different CentOS cloud-init image I should be using?
  • How are other people dealing with this?
Thanks in advance!
 
Anyone find the issue/fix? Have the same issue.

/etc/NetworkManager/conf.d/99-cloud-init.conf contains:

Code:
# Created by cloud-init on instance boot automatically, do not edit.
#
[main]
dns = none

Grep search only returns thre resolv.conf file
Code:
[root@ip156 etc]# grep -i "192.168.122.1" /etc/* -R
/etc/resolv.conf:nameserver 192.168.122.1
 
Last edited:

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!