Load iptables rules from a file
high risk
iptables-restore --test < <file>Validate firstiptables-save > /root/iptables.beforeSave current rulesAtomically loads rules produced by iptables-save.
| Flag | Meaning |
|---|---|
-t --test | Parse only, do not commit |
-n | Do not flush existing rules |
iptables-restore --test < rules.v4Syntax check · explain & risk-check →iptables-restore < /root/iptables.backupRoll back · explain & risk-check →Reference text is hand-written and may be incomplete — check man iptables-restore for your version. Test destructive commands on a non-production system first.