2

I have a bunch of rules dumped with iptables -S:

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT

etc...

Next time, I will do this via iptables-save, and iptables-restore. But for now, is there a better way to restore my rules, other than:

iptables -F
xargs -n1 -d\\n iptables < iptables.dump

1 Answer 1

4

Sadly... probably not. However... one point-of-interest... your iptables -F is insufficient for flushing ALL your tables. (Yes, this is sufficient for flushing all the chains in the default filter table) You must specify each table to flush, not just the default one. i.e. iptables -t nat -F and/or iptables -t mangle -F.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.