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
paddy
  • 238
  • 2
  • 7

1 Answers1

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.

TheCompWiz
  • 7,409
  • 17
  • 23