Containers fails to reach internet

Suddenly my lxc containers are not able to reach internet.

I’m on ubuntu 22.04.

snap: lxd 5.3-91e042b 23270 latest/stable canonical✓ -

I’ve recorded my issue here with asciinema: LXC containers fail to reach internet. - asciinema


I have rebooted in between attempts.

Anyone knows whats gone wrong?

The only thing I can imagine might have changed some reality here is that I’ve installed docker (via apt) … Could that have messed up networking for me?

[UPDATE] docker fucks it up

After some google and testing - I discovered that docker indeed mess up the host as described here:

My workaround was to run on the host:

iptables -t nat -A POSTROUTING -s $dockernet ! -o docker0 -j MASQUERADE
iptables -F FORWARD

… which is not going to work across reboots, but gives me back network for lxc containers again.

For example, if ip addr show dev docker0 | grep inet shows inet brd scope global docker0 then $dockernet should be

Yep there is a work around of sorts