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: https://github.com/docker/for-linux/issues/103
My workaround was to run on the host:
iptables -t nat -A POSTROUTING -s $dockernet ! -o docker0 -j MASQUERADE
iptables -F FORWARD
iptables -P FORWARD ACCEPT
… 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 172.17.0.1/16 brd 172.17.255.255 scope global docker0
then $dockernet
should be 172.17.0.0/16
.