DNS configuration in containers ignores my directives.

Hello guys.

I have a problem with containers and the configuration of the DNS server to be used for internet traffic: regardless of how I configure the DNS servers to be used, whether it is:
  1. via proxmox webgui
  2. via network configuration from proxmox webgui
  3. via file /etc/resolv.conf
  4. via manual modification of the pve configuration file (/etc/pve/lxc/XXX.conf)

When I restart the container, every somthing modifies the /etc/resolv.conf source, file assigning, as DNS servers to be used, the DNS of my provider and not mine.:mad:

I have two of my own DNS servers: a classic one using dnsmasq, and another one with PiHole on two different containers, and they work perfectly, but I can't get them to be used automatically by my containers, because at each restart or network service restart, PVE assign themselves the DNS servers of my provider.


Code:
cat /etc/resolv.conf

nameserver 2a05:9d40:dc1:d1::2
nameserver 2a05:9d40:dc2:d2::2

Code:
whois 2a05:9d40:dc1:d1::2

inet6num:       2a05:9d40::/32
netname:        IT-SPADHAUSEN-SRL-BACKBONE
country:        IT

Spadhausen is my internet provvider.

How can it be resolved so that the containers use the DNS servers that I want? Of course, excluding manual modification, or via script, at each restart?


Thanks to anyone who can point me a way to solve this annoying problem.

IG
 
After doing some tests, I came to this conclusion:


If I configure the network card to get data from the DHCP6 server, there is no way I can set the DNS servers I want: any attempt always leads to the same result, that is, the DNS loaded in /etc/resolv.conf are always those of the DHCP6 server.


Even if I set IPv4 to static and IPv6 to DHCP6 the result is always the same.


So I set the IPv6 values manually, taking those that the DCP6 offers me: I set the mask address /128 I put the gateway of my provider, and in this way the DNS servers that I want in /etc/resolv.conf remain but... IPv6 no longer works!!!


In the end, the only way in which I can get what I need is:

  1. set IPv4 manually
  2. set IPv6 via DHCP6
  3. create a script that runs at the end of the boot, adding:

Bash:
echo "nameserver 192.168.1.106" > /etc/resolv.conf
echo "nameserver 192.168.1.101" >> /etc/resolv.conf


What I can't understand is why if I manually set IPv6, with the IPs provided by the DHCP6, the v6 network no longer works...


I don't know what to do anymore: any suggestions?
 
At least I found my way, sure not the best way:

Create a file in /etc/network/if-up.d/ (I named it force-resolv)

File content in my case
Code:
#!/bin/bash
echo "nameserver 192.168.1.106" > /etc/resolv.conf
echo "nameserver 192.168.1.101" >> /etc/resolv.conf

set it executable:
Bash:
chmod u+x /etc/network/if-up.d/force-resolv

… done

When I reboot, the file in /etc/network/if-up.f/ is executed automatically onece the lan configuration is loaded ad set up.

I know this does not solve the problem of IPv6 not working if I set eth0 inet6 dhcp, but at least I've my dns pointend as I wanted.
 

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!