Contents

LXC Container Internet Access

Contents

I tried forever to get internet access in my LXC container to work. It turns out the iptables was configure badly. The following command will fix the issue:

> for ipt in iptables iptables-legacy ip6tables ip6tables-legacy; do $ipt --flush; $ipt --flush -t nat; $ipt --delete-chain; $ipt --delete-chain -t nat; $ipt -P FORWARD ACCEPT; $ipt -P INPUT ACCEPT; $ipt -P OUTPUT ACCEPT; done
> systemctl reload snap.lxd.daemon