Unable to connect to routed container after wifi is restarted

I’m following this routed tutorial to give my container an ip address on my local network which is 192.168.x.x range. It is using a wireless parent device on the host. How to get LXD containers get IP from the LAN with routed network.

I noticed that anytime the wifi network is disrupted, for example by rebooting my access point or disable/enable the wireless parent device, the container permanently loses connectivity to the local network after the wifi comes back up. The host is able to connect to the network, but the container is not able to.

When checking the arp tables on another computer in the same network, the entry for the container is shown as incomplete. Whereas the entry for the host has a mac address like it should.

# arp -a
? (192.168.1.xxx) at <incomplete>  on br0

Restarting the container restores the container network connectivity and the arp table looks correct afterwards. Any ideas on why this is happening?

Yes. If the parent interface drops then any of the IP neighbour proxy entries LXD had set up on it (which allow the instance’s IPs to be advertised onto the parent network) will get removed by Linux.

LXD doesn’t currently monitor the state of the parent link and recreate the IP neighbour entries if the link has gone down and been restored.

If the container’s you are running are static then you could configure the neighbour entries to be added by your system network configuration so they are restored each time the link comes up.

That makes a lot of sense. Yes, these containers will be static. By neighbor entries, I’m assuming you are referring to proxy ARP?

What’s the best way to add these entries? I found documentation for ‘ip neigh add’, ‘ip neigh add proxy’, and also sysctl comands. I’m on Ubuntu 22.04 desktop.

Would I also need to add static proxy NDP entries as well?

I believe Linux will proxy ARP for any static route if the right sysctl is enabled, see:

https://wiki.debian.org/BridgeNetworkConnectionsProxyArp

For IPv6 you could look into using something like ndppd:

https://manpages.ubuntu.com/manpages/bionic/man1/ndppd.1.html

As LXD creates the static routes in both cases to the container.

Thanks! I’ll take a look.

Running these commands fixed the issue. Thanks again!

echo 'net.ipv4.conf.all.proxy_arp = 1' | sudo tee -a /etc/sysctl.conf > /dev/null
sudo sysctl -p
1 Like