iptables-restore
restores iptables IPv4 rules from a file created by iptables-save
TLDR
Restore from file
$ sudo iptables-restore /etc/iptables.rules
Restore from file without flushing existing rules$ sudo iptables-restore -n /etc/iptables.rules
Test rules without applying them$ sudo iptables-restore -t /etc/iptables.rules
Restore from stdin using iptables-save$ sudo iptables-save | sudo iptables-restore
SYNOPSIS
iptables-restore [OPTIONS] [file]
DESCRIPTION
iptables-restore restores iptables IPv4 rules from a file created by iptables-save. Use ip6tables-restore for IPv6 rules. Input can be from a file or stdin.
PARAMETERS
-c, --counters
Restore packet and byte counter values-n, --noflush
Don't flush existing rules before restoring-T, --table name
Only restore the specified table-t, --test
Test mode - parse rules but don't apply-v, --verbose
Print additional debug info during ruleset processing-w, --wait [seconds]
Wait for xtables lock-V, --version
Print the program version number-M, --modprobe modprobe
Specify the path to the modprobe program
CAVEATS
By default, all existing rules are flushed before restore. Use -n to add rules without flushing. This only restores IPv4 rules; use ip6tables-restore for IPv6.
HISTORY
iptables-restore is part of the iptables package for managing the Linux kernel firewall.
SEE ALSO
iptables(8), iptables-save(8), ip6tables-restore(8)
