Debian LXC DNS setting from host doesn't work

unholyhumorousunratedoat

Well-Known Member
Sep 18, 2019
46
10
48
29
Hi guys,
I'm currently expecting something weird on my fresh Debian LXC "sync".
Proxmox Hypervisor is up to date and "sync" as well. The PiHole is my DNS Server, fritzbox is the DHCP Server. All other LXC and VM work fine.
But the new fresh Debian LXC doesn't get it's correct DNS configuration by the host.

This should be:

1587731557061.png

But the config on my "sync" LXC ist always the following:

1587731650828.png

If I change the DNS config of that machine to the fixed IP of my DNS Server it doesn't work. If I write my DNS server manually in the /etc/resolv.conf file, it's gone after a reboot of the LXC.

I also rebooted the Hypervisor.

Do you have any idea?
Thanks!
 
please post the config of the container:
Code:
pct config 106
 
Code:
root@pve:~# pct config 106
arch: amd64
cores: 12
hostname: sync
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BE:1F:DA:FF:4F:85,ip=dhcp,ip6=dhcp,type=veth
ostype: debian
rootfs: local-zfs:subvol-106-disk-0,size=8G
swap: 512
unprivileged: 1
 
you seem to get the ip-address via dhcp - maybe the dhcp server sets the wrong dns server?
 
Code:
root@pve:~# pct config 103
arch: amd64
cores: 12
hostname: arch-test
memory: 4096
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=A2:98:81:93:3A:E2,ip=dhcp,ip6=dhcp,type=veth
onboot: 1
ostype: archlinux
rootfs: local-zfs:subvol-103-disk-0,size=8G
startup: order=3
swap: 512
unprivileged: 1

This is the arch LXC, same configuration and it works. All other devices in the network work as expected. And the /etc/resolv.conf is fine:

1587732969181.png
 
whats the output of lsattr /etc/resolv.conf inside the debian container
 
Code:
root@sync:~# lsattr /etc/resolv.conf
------------------- /etc/resolv.conf

compared to the arch LXC

Code:
[root@arch-test ~]# lsattr /etc/resolv.conf                                                                         
-------------------- /etc/resolv.conf
 
it looks normal.

does it work correctly on different debian containers?
 
PiHole is a normal LXC Debian Container with static IP (not DHCP), but also with the "get DNS from Host" configuration and everything works fine there.
 
okay, so it might have to do with some debian specific way of handling dhcp and dns, like @Stoiko Ivanov suggested. maybe something in the configuration?

in any case you can workaround like this:
1. edit resolv.conf the way you want
2. chattr +i /etc.resolv.conf (sets immutable attribute so file content can't be changed)

and it should survive the reboot. if you need to edit again do chattr -i /etc/resolv.conf and after editing +i again to set immutable
 
What do you mean with I have to set it up?

okay, so it might have to do with some debian specific way of handling dhcp and dns, like @Stoiko Ivanov suggested. maybe something in the configuration?

in any case you can workaround like this:
1. edit resolv.conf the way you want
2. chattr +i /etc.resolv.conf (sets immutable attribute so file content can't be changed)

and it should survive the reboot. if you need to edit again do chattr -i /etc/resolv.conf and after editing +i again to set immutable

1587735376324.png
 
  • Like
Reactions: majorgear

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!