Antsle Forum

Welcome to our Antsle community! This forum is to connect all Antsle users to post experiences, make user-generated content available for the entire community and more. 

Please note: This forum is about discussing one specific issue at a time. No generalizations. No judgments. Please check the Forum Rules before posting. If you have specific questions about your Antsle and expect a response from our team directly, please continue to use the appropriate channels (email: [email protected]) so every inquiry is tracked. 

Please or Register to create posts and topics.

Debian-11 LXC and resolv.conf

Here's the current state of the Antsle

 

antMan 3.3.1
edgeLinux version

(formerly antsleOS) 0.12.0

It would seem I'm ready for an OS upgrade. Yes I read the beta for edgeLinux 2.x. I'm not there yet. Here's what's setup and the experience:
  1. 2 Debian11 LXC running pihole for ad blocking plus unbound as recursive..
  2. Both of these are using reserved IP addresses from DHCP server. (not sure if that matters)
  3. Resolv.conf are custom, yet identical, on both Debian to use pihole
  4. Occasional I'll notice the antsle performing DNS requests, which it should not be as it's configured to use either of the Debian instances. At least that's what the resolv.conf file shows on the antsle.
  5. Here's what I'm seeing from either of the Debian instances running pihole; Remember the custom config should be in use and not the 10.1.1.7 or the domain of bblv.
What is changing this and why? If this is a bug based on my current OS and Antman version fine; but how do I make it stop. And yes the IP address of the antsle is the 10.1.1.7. 
Please let me know if you need additional information as I'll gladly provide it. 
Thanks
ERIN
Update 1: In summary why do the Debian LXC resolv.conf get overwritten by what appears to be a default resolv.conf and then some time later have the correct one (custom) get applied.
Uploaded files:
  • LXC-and-resolv.png

Hi @someflextest

Can you let us know if you are using DHCP for the addresses?

Does the IP Address change while the DNS is being changed as well?

Thank you,
antsle Support

Hey! @daniel-luck

The Antsle and all LXC are using reserved IP addresses issued from the DHCP server. The IP addresses are always the same for all devices in question.

Thanks

ERIN

Hi @someflextest

From looking at the description and screenshot above, it may be possible that you may have more than one DHCP Server.

One of the servers gave out 10.1.1.7 as DNS and the other gives 192.168.0.x addresses with their associated DNS servers (192.168.0.20 / 192.168.0.22).

It's normal behavior for /etc/resolv.conf by DHCP Servers.  If you have more than one DHCP Server, that that may explain why they are getting overwritten.

Within the Antsle device management page under Network/Network Defaults there is a Base IP value that the Antsle uses for the default Antlets network which is 10.1.1.X; 10.1.1.7 is the physical Antsle device IP address for virbr1. The 192.168.0.7 IP address is for br0.

I'm trying to understand what process running from the HOST (The Antsle) is overwriting the resolv.conf within the Debain11 LXCs.

If I reboot either Debian LXC, the correct resolv.conf is in place. Yet after some time the correct resolv.conf gets overwritten with the default bblv for domain and search and the namseserver changes to the Antsle device 10.1.1.7.

Also if I had more than 1 DHCP server on my network I'd have much larger problems than a resolv.conf being overwritten within an LXC..  LOL!!

My next step is to set each Debian 11 LXC bridged interface to the 192.168.0.x network to static and see what happens.

I'll update after setting static IP addresses for both and letting it bake in for a while.

ERIN

 

Just wow... (and not in a good way)

I set static IP for Pihole1 running Debian11 LXC:

iface eth1 inet static
address 192.168.0.20
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.20 192.168.0.22

Set the resolv.conf to what I want:

domain utilitybear.network
search utilitybear.network
nameserver 192.168.0.20
nameserver 192.168.0.22

Then rebooted to find resolv.conf:

domain bblv
search bblv
nameserver 10.1.1.7

How do I make this stop?

Thanks

ERIN

Next step is setting the Antsle to static. I'll update when done.

ERIN

Everything is now static IP address: Antsle and both Debian11 LXC. After rebooting Antsle and reviewing it's resolv.conf file I see this:

root@myantsle:~ # cat /etc/resolv.conf
# Generated by dhcpcd from br0.dhcp, br0.ra
# /etc/resolv.conf.head can replace this line
domain utilitybear.network
nameserver 192.168.0.20
nameserver 192.168.0.22
# /etc/resolv.conf.tail can replace this line

First look at Debain11 LXC resolv.conf file and I see this:

root@Pihole1:~# cat /etc/resolv.conf
domain bblv
search bblv
nameserver 10.1.1.7

I add my custom resolv.conf, which you've seen before, and reboot and resolv.conf with bblv and 10.1.1.7 comes back.

Hope this helps get me closer to a solution.

Thanks

ERIN

 

Hi @someflextest

From looking at the resolv.conf for both the antsle and pihole, it appears that they may be still using DHCP reservations.

On the antsle, can you provide us with contents of /etc/conf.d/net ?

On the pihole, can you provide us with contents of /etc/network/interfaces ?

Thank you,
antsle Support

After running both Antsle and pihole with static IP address without any behavior change I've set both back to DHCP. DHCPCD.conf on the Antsle at least has these options enabled:

option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes

That way at least on reboot of either container I get the resulting resolv.conf file that I want; but only for a time because some process will over write that file eventually.

I'm now looking for a way to modify the template that creates, or the command that launches, these containers and include hardcoded values for nameserver, search and domain name within the resolv.conf and then lastly setting a script to run at startup of the container to mark that file read only so it can't be modified. Additionally I'm going to build out a Debian 10 container to see if the behavior is the same.

I've turned both eyeballs into raisins trying to understand this and it seems to be the default behavior for containers with few override options, like this link for example: https://stackoverflow.com/questions/30848911/lxc-is-there-a-way-to-setup-nameserver-on-container-config

Further it seems folks have been asking about this for years... https://lxc-users.linuxcontainers.narkive.com/o8QRyxB4/etc-resolv-conf-occasionally-does-not-get-written-in-lxc-container-with-static-conf

Not sure where else to take this but I'm now looking at Docker for pihole instead of LXC and see if the behavior is more to my needs.

Thanks

ERIN