iptables Command Reference

Most of the options for the iptables command can be grouped into subcommands and rule match criteria. Table 1-15 describes the other options.

Table 1-15. iptables miscellaneous options

Option

Description

-c packets bytes

When combined with the -A, -I, or -R subcommand, sets the packet counter to packets and the byte counter to bytes for the new or modified rule.

--exact

Synonym for -x.

-h

Displays information on iptables usage. If it appears after -m match or -j target, then any additional help related to the extension match or target (respectively) is also displayed.

--help

Synonym for -h.

-j target [options]

Determines what to do with packets matching this rule. The target can be the name of a user-defined chain, one of the built-in targets, or an iptables extension (in which case there may be additional options).

--jump

Synonym for -j.

--line-numbers

When combined with the -L subcommand, displays numbers for the rules in each chain, so you can refer to the rules by index when inserting rules into (via -I) or deleting rules from (via -D) a chain.

-m match [options]

Invoke extended match, possibly with additional options.

--match

Synonym for -m.

-M cmd

Used to load an iptables module (with new targets or match extensions) when appending, inserting, or replacing rules.

--modprobe=cmd

Synonym for -M.

-n

Displays numeric addresses and ports instead of looking up and displaying domain names for the IP addresses and displaying service names for the port numbers. This can be especially ...

Get Linux iptables Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.