how to iptables-restore

Iptables-restore is used to restore (load) a set of rules that was previously saved with iptables-save. Set the utility receives from standard input and cannot load it from a file directly. The command has the following syntax:

iptables-restore [-c] [-n]

The-c switch (a longer version of the-counters) causes the restore the values of the counters.

Specifying the-n (a longer version of the–noflush) tells iptables-restore, that rules should be added to the existing. By default iptables-restore (without-n) will clear the contents of the tables and chains before downloading a new set of rules.

To download a set of rules for iptables-restore utility from a file you can offer several options, but the most used:

cat/etc/iptables-save | iptables-restore-c

As a result of this command, the contents of the file/etc/iptables-save will be read by the cat and perenapravlenno to the standard input of iptables-restore utility. Could be a number of commands you can use to organize the loading a rule set from a file, but that is outside the scope of the topic, so I will leave to the reader the possibility to find a more convenient option for it.

After execution of this command is a set of rules should boot and everything should work. If not, then most likely you have made a mistake when entering the command.