DNS resolution fails in LXC containers, but only for apt.

elderx

New Member
Oct 8, 2023
2
0
1
When create LXC container from default Ubuntu 22.04 template i can not run apt udate inside the LXC container since apt cannot resolve any DNS names. Pinging domains works, running dig works for domains that apt is trying. Only thing that is not working, is that apt can not resolve DNS names. I have found multiple people complaining same thing, but so far 0 resolved.
 
I figured i was since i had these in proxmox
# post-up iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.101
# post-up iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.0.0.101

I was thinking of running an Nginx reverse proxy and i wanted to forward ports 80 and 443 to the LXC container running the Nginx. Then the Nginx will proxypass to other containers running different services and i was able to map my own domains subdomains to those containers running services and access the them through the Nginx reverse proxy. Everything was working except that i could not run apt from inside those LXC containers. In the above that 10.0.0.101 is the ip of Nginx reverse proxy LXC container.

Any suggestions how to implement that in a way that apt can still resolve dns ?
 

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!