ubuntu + ufw 配置docker 不用iptables 然后docker 不能上网了,找个下大模型给了个方法有用,需要的拿去:
# inet 172.18.0.1/16 brd 172.18.255.255 scope global br-2ee91be8f66f
ufw allow in on eth0 to 172.18.0.0/16
iptables -t nat -A POSTROUTING -s 172.18.0.0/16 ! -o br-2ee91be8f66f -j MASQUERADE