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