How to temporarily stop iptables on Ubuntu
iptables
is not a service, but a facility inside the kernel. That is why you can't stop it.
If you ever need to stop iptables quickly, here's my suggestion:
-
Configure your iptables to completion.
-
Save the configuration first:
iptables-save > /etc/iptables.conf
-
Flush the iptables, and configure it 'open':
- All policies set to ACCEPT
- Configure all necessary NATs for your sysadmin to work
- If you use Policy-Based Routing in the mangle table, also configure it as necessary
- Save the 'open' ruleset:
iptables-save > /etc/open-iptables.conf
Now, whenever you need to quickly 'disable' iptables, do:
cat /etc/open-iptables.conf | iptables-restore
.
After that, 're-enable' iptables using:
cat /etc/iptables.conf | iptables-restore
( iptables-restore < /etc/open-iptables.conf
might also work; but I've read somewhere else that sometimes it doesn't work )
ADD: Newer versions of iptables-restore
can directly read from a file. So the above commands can be simplified to:
iptables-restore /etc/open-iptables.conf iptables-restore /etc/iptables.conf
respectively.