Two Wrongs

(don't make a right)

Temporarily Disabling iptables

by ~kqr

I'll just put this here since it didn't appear early enough in Google searches. The iptables firewall is a part of the kernel and not a service, so you can't really systemctl stop it. The solutions I saw others post were about saving the entire iptables state, flushing the tables and then restoring the state when you are done. Not really convenient.

What you can do, however, to prevent iptables from blocking e.g. incoming connections, is

$ iptables -I INPUT 1 -j ACCEPT

Iptables is now in effect disabled for incoming traffic, since it accepts everything in the INPUT chain. Then when you have done whatever you were going to, you can

$ iptables -D INPUT 1

which removes the rule above. Obviously change INPUT to something else if there's another chain you want to disable.

If you enjoyed this article, you might like others tagged with