Linux command
iptables-restore 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Restore
sudo iptables-restore /etc/iptables.rules
Restore
sudo iptables-restore -n /etc/iptables.rules
Test
sudo iptables-restore -t /etc/iptables.rules
Restore
sudo iptables-save | sudo iptables-restore
说明
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.
参数
- -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
FAQ
What is the iptables-restore command used for?
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.
How do I run a basic iptables-restore example?
Run `sudo iptables-restore /etc/iptables.rules` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --counters do in iptables-restore?
Restore packet and byte counter values