Hi all,
I would like to run Pi-hole inside of LXC container (not lxd). But I don't know how to properly configure LXC containers to run in same LAN subnet range like host (and other devices).
Could you please help me configure it properly?
thank you
Details about my system:
Raspberry Pi 4 8GB
Raspberry Pi OS 64
Linux raspberrypi 5.15.61-v8+
lxc v.4.0.6
Some notes on this config: (1) there is no lxc.net.0.link since we don't want a bridge, (2) the lxc.net.0.ipv4.gateway address is the host's IP address, (3) note the netmask is /32, (4) the scripts are explained below.
The netup.sh script routes incoming IP traffic to the container and creates an ARP entry so that eth0 will accept traffic for it:
#!/bin/sh
ip route add ${1}/32 dev veth0
arp -i eth0 -Ds ${1} eth0 pub
The netdown.sh script simply removes the ARP entry (the IP route will go away automatically when veth0 is destroyed).
#!/bin/sh
arp -d -i eth0 ${1} pub
On the guest, /etc/network/interfaces can be empty, since in this case the setup was done in the container config file.