Interview Prep/Networking/Containers, Kubernetes, IPv6 and packet captures

After someone ran `iptables -F` (or restarted firewalld), all Docker containers lost outbound connectivity.

IntermediateTroubleshootingContainers, Kubernetes, IPv6 and packet captures
Answer

Likely causes → Docker programs its own iptables chains (DOCKER, DOCKER-USER, NAT MASQUERADE for 172.17.0.0/16). Flushing rules or a firewalld reload removed them, so container traffic is no longer NATed. A reset of net.ipv4.ip_forward=0 has the same effect.

Diagnose →

sudo iptables -t nat -S POSTROUTING | grep MASQUERADE
sudo iptables -S FORWARD | head
sysctl net.ipv4.ip_forward
docker run --rm busybox ping -c2 1.1.1.1

Fix → sudo systemctl restart docker recreates the chains (it restarts containers unless live-restore is set). Re-enable forwarding if needed.

Prevent → Never flush iptables on Docker/Kubernetes hosts; put your own rules in the DOCKER-USER chain and manage host firewalls with tools that preserve Docker's rules.

All Networking questions Roadmap: Networking for DevOps

More on Containers, Kubernetes, IPv6 and packet captures