How to Stop Proxmox from Overriding Container DNS Settings

How to Stop Proxmox from Overriding Container DNS Settings

By default, Proxmox relies on its internal DNS resolver to handle name resolution for virtual machines and containers. This can cause conflicts if you have a separate DNS configuration set up on your host system. Proxmox may overwrite your local DNS settings, resulting in DNS-related errors or unexpected behavior within your virtualized environment.

In proxmox containers, the DNS nameserver is maintained in file /etc/resolv.conf

But the problem is, even if you update the file, it will revert back to the DNS settings from the proxmox host.

On the surface, this may not seem very impactful. But when container level DNS is combined with a reverse-proxy like traefik, local dns through pihole and remote proxy through twingate

The solution

To maintain your local DNS configuration in the container and prevent Proxmox from overriding it, you can add a file /etc/.pve-ignore.resolv.conf.

Follow these steps to implement the solution:

Step 1: Create a new file named .pve-ignore.resolv.conf within the /etc/ directory. You may need administrative privileges to perform this action.

touch /etc/.pve-ignore.resolv.conf

Step 2: Edit the file /etc/resolv.conf

nano /etc/resolve.conf

Step 3: Add your nameservers to the above file

nameserver 192.168.0.100
nameserver 192.168.10.195

You can include as many DNS servers as you need, ensuring redundancy and availability.

Step 4: Save the file and restart the container

Verify your changes

In your container, execute the following command to verify that your dns has been updated

nslookup microsoft.com

Preventing Proxmox from overwriting your local DNS configuration is crucial for maintaining a stable and predictable network environment. By utilizing the /etc/.pve-ignore.resolv.conf file, you can retain control over your DNS settings and avoid unexpected conflicts.

Why this is so powerful

On the surface, this may not seem very impactful. But when container level DNS is combined with a reverse-proxy like traefik, local dns through pihole and remote proxy through twingate: You have a very powerful toolset to make sure your homelab is accessible through the same dns resolver that you use in your local environment.