← 返回命令列表

Linux command

iptables-save 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Print

sudo iptables-save

Example

sudo iptables-save -t filter

Save

sudo iptables-save -f /etc/iptables.rules

说明

iptables-save dumps the current iptables IPv4 configuration to stdout or a file. The output can be restored using iptables-restore. Use ip6tables-save for IPv6 rules.

参数

-t, --table _table_
Only output rules for the specified table (filter, nat, mangle, raw, security)
-f, --file _filename_
Write output to file instead of stdout
-c, --counters
Include packet and byte counters in output

FAQ

What is the iptables-save command used for?

iptables-save dumps the current iptables IPv4 configuration to stdout or a file. The output can be restored using iptables-restore. Use ip6tables-save for IPv6 rules.

How do I run a basic iptables-save example?

Run `sudo iptables-save` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t, --table _table_ do in iptables-save?

Only output rules for the specified table (filter, nat, mangle, raw, security)