Utility Command Reference
iptables comes with two utility commands for saving and restoring rule sets.
iptables-restore
iptables-restore [ -c | --counters ] [ -n | --noflush ]
Reads rules from standard input in the format written by iptables-save and adds those rules to the current iptables setup. Normally, tables are flushed before rules are restored into them, but you can use the -n (--noflush) option to have the new rules added to those already present. Table 1-85 describes the options to this command.
Table 1-85. iptables-restore options
Option | Description |
|---|---|
| Restore the packet and byte counters for the rules. |
| Synonym for |
| Disable the preflushing of tables before restoration. |
| Synonym for |
iptables-save
iptables-save
[ -c | --counters ]
[ [ -t | --table ] table ]Displays rules and (optionally) byte and packet counts for all tables (the default) or for a specified table. The format is designed to be easy to parse and can be written to file for later restoration via iptables-restore. Table 1-86 describes the options to this command.
Table 1-86. iptables-save options
Option | Description |
|---|---|
| Display the packet and byte counters for the rules. |
| Synonym for |
| Display only the specified table. |
| Synonym for |