Skip to Content
Linux iptables Pocket Reference
book

Linux iptables Pocket Reference

by Gregor N. Purdy
August 2004
Intermediate to advanced
96 pages
1h 52m
English
O'Reilly Media, Inc.
Content preview from Linux iptables Pocket Reference

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

-c

Restore the packet and byte counters for the rules.

--counters

Synonym for -c.

-n

Disable the preflushing of tables before restoration.

--noflush

Synonym for -n.

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

-c

Display the packet and byte counters for the rules.

--counters

Synonym for -c.

-t table

Display only the specified table.

--table

Synonym for -t.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Security Cookbook

Linux Security Cookbook

Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
Linux Firewalls

Linux Firewalls

Michael Rash

Publisher Resources

ISBN: 9780596801861Errata Page