Blame iptables/iptables.8.in

Packit 7b22a4
.TH IPTABLES 8 "" "@PACKAGE_STRING@" "@PACKAGE_STRING@"
Packit 7b22a4
.\"
Packit 7b22a4
.\" Man page written by Herve Eychenne <rv@wallfire.org> (May 1999)
Packit 7b22a4
.\" It is based on ipchains page.
Packit 7b22a4
.\" TODO: add a word for protocol helpers (FTP, IRC, SNMP-ALG)
Packit 7b22a4
.\"
Packit 7b22a4
.\" ipchains page by Paul ``Rusty'' Russell March 1997
Packit 7b22a4
.\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl>
Packit 7b22a4
.\"
Packit 7b22a4
.\"	This program is free software; you can redistribute it and/or modify
Packit 7b22a4
.\"	it under the terms of the GNU General Public License as published by
Packit 7b22a4
.\"	the Free Software Foundation; either version 2 of the License, or
Packit 7b22a4
.\"	(at your option) any later version.
Packit 7b22a4
.\"
Packit 7b22a4
.\"	This program is distributed in the hope that it will be useful,
Packit 7b22a4
.\"	but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7b22a4
.\"	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7b22a4
.\"	GNU General Public License for more details.
Packit 7b22a4
.\"
Packit 7b22a4
.\"	You should have received a copy of the GNU General Public License
Packit 7b22a4
.\"	along with this program; if not, write to the Free Software
Packit 7b22a4
.\"	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit 7b22a4
.\"
Packit 7b22a4
.\"
Packit 7b22a4
.SH NAME
Packit 7b22a4
iptables/ip6tables \(em administration tool for IPv4/IPv6 packet filtering and NAT
Packit 7b22a4
.SH SYNOPSIS
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] {\fB\-A\fP|\fB\-C\fP|\fB\-D\fP}
Packit 7b22a4
\fIchain\fP \fIrule-specification\fP
Packit 7b22a4
.P
Packit 7b22a4
\fBip6tables\fP [\fB\-t\fP \fItable\fP] {\fB\-A\fP|\fB\-C\fP|\fB\-D\fP}
Packit 7b22a4
\fIchain rule-specification\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-I\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-R\fP \fIchain rulenum rule-specification\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-D\fP \fIchain rulenum\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-S\fP [\fIchain\fP [\fIrulenum\fP]]
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] {\fB\-F\fP|\fB\-L\fP|\fB\-Z\fP} [\fIchain\fP [\fIrulenum\fP]] [\fIoptions...\fP]
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-N\fP \fIchain\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-X\fP [\fIchain\fP]
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-P\fP \fIchain target\fP
Packit 7b22a4
.PP
Packit 7b22a4
\fBiptables\fP [\fB\-t\fP \fItable\fP] \fB\-E\fP \fIold-chain-name new-chain-name\fP
Packit 7b22a4
.PP
Packit 7b22a4
rule-specification = [\fImatches...\fP] [\fItarget\fP]
Packit 7b22a4
.PP
Packit 7b22a4
match = \fB\-m\fP \fImatchname\fP [\fIper-match-options\fP]
Packit 7b22a4
.PP
Packit 7b22a4
target = \fB\-j\fP \fItargetname\fP [\fIper\-target\-options\fP]
Packit 7b22a4
.SH DESCRIPTION
Packit 7b22a4
\fBIptables\fP and \fBip6tables\fP are used to set up, maintain, and inspect the
Packit 7b22a4
tables of IPv4 and IPv6 packet
Packit 7b22a4
filter rules in the Linux kernel.  Several different tables
Packit 7b22a4
may be defined.  Each table contains a number of built-in
Packit 7b22a4
chains and may also contain user-defined chains.
Packit 7b22a4
.PP
Packit 7b22a4
Each chain is a list of rules which can match a set of packets.  Each
Packit 7b22a4
rule specifies what to do with a packet that matches.  This is called
Packit 7b22a4
a `target', which may be a jump to a user-defined chain in the same
Packit 7b22a4
table.
Packit 7b22a4
.SH TARGETS
Packit 7b22a4
A firewall rule specifies criteria for a packet and a target.  If the
Packit 7b22a4
packet does not match, the next rule in the chain is examined; if
Packit 7b22a4
it does match, then the next rule is specified by the value of the
Packit 7b22a4
target, which can be the name of a user-defined chain, one of the targets
Packit 7b22a4
described in \fBiptables\-extensions\fP(8), or one of the
Packit 7b22a4
special values \fBACCEPT\fP, \fBDROP\fP or \fBRETURN\fP.
Packit 7b22a4
.PP
Packit 7b22a4
\fBACCEPT\fP means to let the packet through.
Packit 7b22a4
\fBDROP\fP means to drop the packet on the floor.
Packit 7b22a4
\fBRETURN\fP means stop traversing this chain and resume at the next
Packit 7b22a4
rule in the
Packit 7b22a4
previous (calling) chain.  If the end of a built-in chain is reached
Packit 7b22a4
or a rule in a built-in chain with target \fBRETURN\fP
Packit 7b22a4
is matched, the target specified by the chain policy determines the
Packit 7b22a4
fate of the packet.
Packit 7b22a4
.SH TABLES
Packit 7b22a4
There are currently five independent tables (which tables are present
Packit 7b22a4
at any time depends on the kernel configuration options and which
Packit 7b22a4
modules are present).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-t\fP, \fB\-\-table\fP \fItable\fP
Packit 7b22a4
This option specifies the packet matching table which the command
Packit 7b22a4
should operate on.  If the kernel is configured with automatic module
Packit 7b22a4
loading, an attempt will be made to load the appropriate module for
Packit 7b22a4
that table if it is not already there.
Packit 7b22a4
Packit 7b22a4
The tables are as follows:
Packit 7b22a4
.RS
Packit 7b22a4
.TP .4i
Packit 7b22a4
\fBfilter\fP:
Packit 7b22a4
This is the default table (if no \-t option is passed). It contains
Packit 7b22a4
the built-in chains \fBINPUT\fP (for packets destined to local sockets),
Packit 7b22a4
\fBFORWARD\fP (for packets being routed through the box), and
Packit 7b22a4
\fBOUTPUT\fP (for locally-generated packets).
Packit 7b22a4
.TP
Packit 7b22a4
\fBnat\fP:
Packit 7b22a4
This table is consulted when a packet that creates a new
Packit 7b22a4
connection is encountered.  It consists of four built-ins: \fBPREROUTING\fP
Packit 7b22a4
(for altering packets as soon as they come in), \fBINPUT\fP (for altering
Packit 7b22a4
packets destined for local sockets), \fBOUTPUT\fP
Packit 7b22a4
(for altering locally-generated packets before routing), and \fBPOSTROUTING\fP
Packit 7b22a4
(for altering packets as they are about to go out).
Packit 7b22a4
IPv6 NAT support is available since kernel 3.7.
Packit 7b22a4
.TP
Packit 7b22a4
\fBmangle\fP:
Packit 7b22a4
This table is used for specialized packet alteration.  Until kernel
Packit 7b22a4
2.4.17 it had two built-in chains: \fBPREROUTING\fP
Packit 7b22a4
(for altering incoming packets before routing) and \fBOUTPUT\fP
Packit 7b22a4
(for altering locally-generated packets before routing).
Packit 7b22a4
Since kernel 2.4.18, three other built-in chains are also supported:
Packit 7b22a4
\fBINPUT\fP (for packets coming into the box itself), \fBFORWARD\fP
Packit 7b22a4
(for altering packets being routed through the box), and \fBPOSTROUTING\fP
Packit 7b22a4
(for altering packets as they are about to go out).
Packit 7b22a4
.TP
Packit 7b22a4
\fBraw\fP:
Packit 7b22a4
This table is used mainly for configuring exemptions from connection
Packit 7b22a4
tracking in combination with the NOTRACK target.  It registers at the netfilter
Packit 7b22a4
hooks with higher priority and is thus called before ip_conntrack, or any other
Packit 7b22a4
IP tables.  It provides the following built-in chains: \fBPREROUTING\fP
Packit 7b22a4
(for packets arriving via any network interface) \fBOUTPUT\fP
Packit 7b22a4
(for packets generated by local processes)
Packit 7b22a4
.TP
Packit 7b22a4
\fBsecurity\fP:
Packit 7b22a4
This table is used for Mandatory Access Control (MAC) networking rules, such
Packit 7b22a4
as those enabled by the \fBSECMARK\fP and \fBCONNSECMARK\fP targets.
Packit 7b22a4
Mandatory Access Control is implemented by Linux Security Modules such as
Packit 7b22a4
SELinux.  The security table is called after the filter table, allowing any
Packit 7b22a4
Discretionary Access Control (DAC) rules in the filter table to take effect
Packit 7b22a4
before MAC rules.  This table provides the following built-in chains:
Packit 7b22a4
\fBINPUT\fP (for packets coming into the box itself),
Packit 7b22a4
\fBOUTPUT\fP (for altering locally-generated packets before routing), and
Packit 7b22a4
\fBFORWARD\fP (for altering packets being routed through the box).
Packit 7b22a4
.RE
Packit 7b22a4
.SH OPTIONS
Packit 7b22a4
The options that are recognized by
Packit 7b22a4
\fBiptables\fP and \fBip6tables\fP can be divided into several different groups.
Packit 7b22a4
.SS COMMANDS
Packit 7b22a4
These options specify the desired action to perform. Only one of them
Packit 7b22a4
can be specified on the command line unless otherwise stated
Packit 7b22a4
below. For long versions of the command and option names, you
Packit 7b22a4
need to use only enough letters to ensure that
Packit 7b22a4
\fBiptables\fP can differentiate it from all other options.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-A\fP, \fB\-\-append\fP \fIchain rule-specification\fP
Packit 7b22a4
Append one or more rules to the end of the selected chain.
Packit 7b22a4
When the source and/or destination names resolve to more than one
Packit 7b22a4
address, a rule will be added for each possible address combination.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-C\fP, \fB\-\-check\fP \fIchain rule-specification\fP
Packit 7b22a4
Check whether a rule matching the specification does exist in the
Packit 7b22a4
selected chain. This command uses the same logic as \fB\-D\fP to
Packit 7b22a4
find a matching entry, but does not alter the existing iptables
Packit 7b22a4
configuration and uses its exit code to indicate success or failure.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-D\fP, \fB\-\-delete\fP \fIchain rule-specification\fP
Packit 7b22a4
.ns
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-D\fP, \fB\-\-delete\fP \fIchain rulenum\fP
Packit 7b22a4
Delete one or more rules from the selected chain.  There are two
Packit 7b22a4
versions of this command: the rule can be specified as a number in the
Packit 7b22a4
chain (starting at 1 for the first rule) or a rule to match.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-I\fP, \fB\-\-insert\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP
Packit 7b22a4
Insert one or more rules in the selected chain as the given rule
Packit 7b22a4
number.  So, if the rule number is 1, the rule or rules are inserted
Packit 7b22a4
at the head of the chain.  This is also the default if no rule number
Packit 7b22a4
is specified.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-R\fP, \fB\-\-replace\fP \fIchain rulenum rule-specification\fP
Packit 7b22a4
Replace a rule in the selected chain.  If the source and/or
Packit 7b22a4
destination names resolve to multiple addresses, the command will
Packit 7b22a4
fail.  Rules are numbered starting at 1.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-L\fP, \fB\-\-list\fP [\fIchain\fP]
Packit 7b22a4
List all rules in the selected chain.  If no chain is selected, all
Packit 7b22a4
chains are listed. Like every other iptables command, it applies to the
Packit 7b22a4
specified table (filter is the default), so NAT rules get listed by
Packit 7b22a4
.nf
Packit 7b22a4
 iptables \-t nat \-n \-L
Packit 7b22a4
.fi
Packit 7b22a4
Please note that it is often used with the \fB\-n\fP
Packit 7b22a4
option, in order to avoid long reverse DNS lookups.
Packit 7b22a4
It is legal to specify the \fB\-Z\fP
Packit 7b22a4
(zero) option as well, in which case the chain(s) will be atomically
Packit 7b22a4
listed and zeroed.  The exact output is affected by the other
Packit 7b22a4
arguments given. The exact rules are suppressed until you use
Packit 7b22a4
.nf
Packit 7b22a4
 iptables \-L \-v
Packit 7b22a4
.fi
Packit 7b22a4
or
Packit 7b22a4
\fBiptables\-save\fP(8).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-S\fP, \fB\-\-list\-rules\fP [\fIchain\fP]
Packit 7b22a4
Print all rules in the selected chain.  If no chain is selected, all
Packit 7b22a4
chains are printed like iptables-save. Like every other iptables command,
Packit 7b22a4
it applies to the specified table (filter is the default).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-F\fP, \fB\-\-flush\fP [\fIchain\fP]
Packit 7b22a4
Flush the selected chain (all the chains in the table if none is given).
Packit 7b22a4
This is equivalent to deleting all the rules one by one.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-Z\fP, \fB\-\-zero\fP [\fIchain\fP [\fIrulenum\fP]]
Packit 7b22a4
Zero the packet and byte counters in all chains, or only the given chain,
Packit 7b22a4
or only the given rule in a chain. It is legal to
Packit 7b22a4
specify the
Packit 7b22a4
\fB\-L\fP, \fB\-\-list\fP
Packit 7b22a4
(list) option as well, to see the counters immediately before they are
Packit 7b22a4
cleared. (See above.)
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-N\fP, \fB\-\-new\-chain\fP \fIchain\fP
Packit 7b22a4
Create a new user-defined chain by the given name.  There must be no
Packit 7b22a4
target of that name already.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-X\fP, \fB\-\-delete\-chain\fP [\fIchain\fP]
Packit 7b22a4
Delete the optional user-defined chain specified.  There must be no references
Packit 7b22a4
to the chain.  If there are, you must delete or replace the referring rules
Packit 7b22a4
before the chain can be deleted.  The chain must be empty, i.e. not contain
Packit 7b22a4
any rules.  If no argument is given, it will attempt to delete every
Packit 7b22a4
non-builtin chain in the table.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-P\fP, \fB\-\-policy\fP \fIchain target\fP
Packit 7b22a4
Set the policy for the built-in (non-user-defined) chain to the given target.
Packit 7b22a4
The policy target must be either \fBACCEPT\fP or \fBDROP\fP.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-E\fP, \fB\-\-rename\-chain\fP \fIold\-chain new\-chain\fP
Packit 7b22a4
Rename the user specified chain to the user supplied name.  This is
Packit 7b22a4
cosmetic, and has no effect on the structure of the table.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-h\fP
Packit 7b22a4
Help.
Packit 7b22a4
Give a (currently very brief) description of the command syntax.
Packit 7b22a4
.SS PARAMETERS
Packit 7b22a4
The following parameters make up a rule specification (as used in the
Packit 7b22a4
add, delete, insert, replace and append commands).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-4\fP, \fB\-\-ipv4\fP
Packit 7b22a4
This option has no effect in iptables and iptables-restore.
Packit 7b22a4
If a rule using the \fB\-4\fP option is inserted with (and only with)
Packit 7b22a4
ip6tables-restore, it will be silently ignored. Any other uses will throw an
Packit 7b22a4
error. This option allows to put both IPv4 and IPv6 rules in a single rule file
Packit 7b22a4
for use with both iptables-restore and ip6tables-restore.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-6\fP, \fB\-\-ipv6\fP
Packit 7b22a4
If a rule using the \fB\-6\fP option is inserted with (and only with)
Packit 7b22a4
iptables-restore, it will be silently ignored. Any other uses will throw an
Packit 7b22a4
error. This option allows to put both IPv4 and IPv6 rules in a single rule file
Packit 7b22a4
for use with both iptables-restore and ip6tables-restore.
Packit 7b22a4
This option has no effect in ip6tables and ip6tables-restore.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-p\fP, \fB\-\-protocol\fP \fIprotocol\fP
Packit 7b22a4
The protocol of the rule or of the packet to check.
Packit 7b22a4
The specified protocol can be one of \fBtcp\fP, \fBudp\fP, \fBudplite\fP,
Packit 7b22a4
\fBicmp\fP, \fBicmpv6\fP,\fBesp\fP, \fBah\fP, \fBsctp\fP, \fBmh\fP or the special keyword "\fBall\fP",
Packit 7b22a4
or it can be a numeric value, representing one of these protocols or a
Packit 7b22a4
different one.  A protocol name from /etc/protocols is also allowed.
Packit 7b22a4
A "!" argument before the protocol inverts the
Packit 7b22a4
test.  The number zero is equivalent to \fBall\fP. "\fBall\fP"
Packit 7b22a4
will match with all protocols and is taken as default when this
Packit 7b22a4
option is omitted.
Packit 7b22a4
Note that, in ip6tables, IPv6 extension headers except \fBesp\fP are not allowed.
Packit 7b22a4
\fBesp\fP and \fBipv6\-nonext\fP
Packit 7b22a4
can be used with Kernel version 2.6.11 or later.
Packit 7b22a4
The number zero is equivalent to \fBall\fP, which means that you cannot
Packit 7b22a4
test the protocol field for the value 0 directly. To match on a HBH header,
Packit 7b22a4
even if it were the last, you cannot use \fB\-p 0\fP, but always need
Packit 7b22a4
\fB\-m hbh\fP.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-s\fP, \fB\-\-source\fP \fIaddress\fP[\fB/\fP\fImask\fP][\fB,\fP\fI...\fP]
Packit 7b22a4
Source specification. \fIAddress\fP
Packit 7b22a4
can be either a network name, a hostname, a network IP address (with
Packit 7b22a4
\fB/\fP\fImask\fP), or a plain IP address. Hostnames will
Packit 7b22a4
be resolved once only, before the rule is submitted to the kernel.
Packit 7b22a4
Please note that specifying any name to be resolved with a remote query such as
Packit 7b22a4
DNS is a really bad idea.
Packit 7b22a4
The \fImask\fP
Packit 7b22a4
can be either an ipv4 network mask (for iptables) or a plain number,
Packit 7b22a4
specifying the number of 1's at the left side of the network mask.
Packit 7b22a4
Thus, an iptables mask of \fI24\fP is equivalent to \fI255.255.255.0\fP.
Packit 7b22a4
A "!" argument before the address specification inverts the sense of
Packit 7b22a4
the address. The flag \fB\-\-src\fP is an alias for this option.
Packit 7b22a4
Multiple addresses can be specified, but this will \fBexpand to multiple
Packit 7b22a4
rules\fP (when adding with \-A), or will cause multiple rules to be
Packit 7b22a4
deleted (with \-D).
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-d\fP, \fB\-\-destination\fP \fIaddress\fP[\fB/\fP\fImask\fP][\fB,\fP\fI...\fP]
Packit 7b22a4
Destination specification. 
Packit 7b22a4
See the description of the \fB\-s\fP
Packit 7b22a4
(source) flag for a detailed description of the syntax.  The flag
Packit 7b22a4
\fB\-\-dst\fP is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-m\fP, \fB\-\-match\fP \fImatch\fP
Packit 7b22a4
Specifies a match to use, that is, an extension module that tests for a
Packit 7b22a4
specific property. The set of matches make up the condition under which a
Packit 7b22a4
target is invoked. Matches are evaluated first to last as specified on the
Packit 7b22a4
command line and work in short-circuit fashion, i.e. if one extension yields
Packit 7b22a4
false, evaluation will stop.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-j\fP, \fB\-\-jump\fP \fItarget\fP
Packit 7b22a4
This specifies the target of the rule; i.e., what to do if the packet
Packit 7b22a4
matches it.  The target can be a user-defined chain (other than the
Packit 7b22a4
one this rule is in), one of the special builtin targets which decide
Packit 7b22a4
the fate of the packet immediately, or an extension (see \fBEXTENSIONS\fP
Packit 7b22a4
below).  If this
Packit 7b22a4
option is omitted in a rule (and \fB\-g\fP
Packit 7b22a4
is not used), then matching the rule will have no
Packit 7b22a4
effect on the packet's fate, but the counters on the rule will be
Packit 7b22a4
incremented.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-g\fP, \fB\-\-goto\fP \fIchain\fP
Packit 7b22a4
This specifies that the processing should continue in a user
Packit 7b22a4
specified chain. Unlike the \-\-jump option return will not continue
Packit 7b22a4
processing in this chain but instead in the chain that called us via
Packit 7b22a4
\-\-jump.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-i\fP, \fB\-\-in\-interface\fP \fIname\fP
Packit 7b22a4
Name of an interface via which a packet was received (only for
Packit 7b22a4
packets entering the \fBINPUT\fP, \fBFORWARD\fP and \fBPREROUTING\fP
Packit 7b22a4
chains).  When the "!" argument is used before the interface name, the
Packit 7b22a4
sense is inverted.  If the interface name ends in a "+", then any
Packit 7b22a4
interface which begins with this name will match.  If this option is
Packit 7b22a4
omitted, any interface name will match.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-o\fP, \fB\-\-out\-interface\fP \fIname\fP
Packit 7b22a4
Name of an interface via which a packet is going to be sent (for packets
Packit 7b22a4
entering the \fBFORWARD\fP, \fBOUTPUT\fP and \fBPOSTROUTING\fP
Packit 7b22a4
chains).  When the "!" argument is used before the interface name, the
Packit 7b22a4
sense is inverted.  If the interface name ends in a "+", then any
Packit 7b22a4
interface which begins with this name will match.  If this option is
Packit 7b22a4
omitted, any interface name will match.
Packit 7b22a4
.TP
Packit 7b22a4
[\fB!\fP] \fB\-f\fP, \fB\-\-fragment\fP
Packit 7b22a4
This means that the rule only refers to second and further IPv4 fragments
Packit 7b22a4
of fragmented packets.  Since there is no way to tell the source or
Packit 7b22a4
destination ports of such a packet (or ICMP type), such a packet will
Packit 7b22a4
not match any rules which specify them.  When the "!" argument
Packit 7b22a4
precedes the "\-f" flag, the rule will only match head fragments, or
Packit 7b22a4
unfragmented packets. This option is IPv4 specific, it is not available
Packit 7b22a4
in ip6tables.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-c\fP, \fB\-\-set\-counters\fP \fIpackets bytes\fP
Packit 7b22a4
This enables the administrator to initialize the packet and byte
Packit 7b22a4
counters of a rule (during \fBINSERT\fP, \fBAPPEND\fP, \fBREPLACE\fP
Packit 7b22a4
operations).
Packit 7b22a4
.SS "OTHER OPTIONS"
Packit 7b22a4
The following additional options can be specified:
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-v\fP, \fB\-\-verbose\fP
Packit 7b22a4
Verbose output.  This option makes the list command show the interface
Packit 7b22a4
name, the rule options (if any), and the TOS masks.  The packet and
Packit 7b22a4
byte counters are also listed, with the suffix 'K', 'M' or 'G' for
Packit 7b22a4
1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
Packit 7b22a4
the \fB\-x\fP flag to change this).
Packit 7b22a4
For appending, insertion, deletion and replacement, this causes
Packit 7b22a4
detailed information on the rule or rules to be printed. \fB\-v\fP may be
Packit 7b22a4
specified multiple times to possibly emit more detailed debug statements.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-w\fP, \fB\-\-wait\fP [\fIseconds\fP]
Packit 7b22a4
Wait for the xtables lock.
Packit 7b22a4
To prevent multiple instances of the program from running concurrently,
Packit 7b22a4
an attempt will be made to obtain an exclusive lock at launch.  By default,
Packit 7b22a4
the program will exit if the lock cannot be obtained.  This option will
Packit 7b22a4
make the program wait (indefinitely or for optional \fIseconds\fP) until
Packit 7b22a4
the exclusive lock can be obtained.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-W\fP, \fB\-\-wait-interval\fP \fImicroseconds\fP
Packit 7b22a4
Interval to wait per each iteration.
Packit 7b22a4
When running latency sensitive applications, waiting for the xtables lock
Packit 7b22a4
for extended durations may not be acceptable. This option will make each
Packit 7b22a4
iteration take the amount of time specified. The default interval is
Packit 7b22a4
1 second. This option only works with \fB\-w\fP.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-n\fP, \fB\-\-numeric\fP
Packit 7b22a4
Numeric output.
Packit 7b22a4
IP addresses and port numbers will be printed in numeric format.
Packit 7b22a4
By default, the program will try to display them as host names,
Packit 7b22a4
network names, or services (whenever applicable).
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-x\fP, \fB\-\-exact\fP
Packit 7b22a4
Expand numbers.
Packit 7b22a4
Display the exact value of the packet and byte counters,
Packit 7b22a4
instead of only the rounded number in K's (multiples of 1000)
Packit 7b22a4
M's (multiples of 1000K) or G's (multiples of 1000M).  This option is
Packit 7b22a4
only relevant for the \fB\-L\fP command.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-line\-numbers\fP
Packit 7b22a4
When listing rules, add line numbers to the beginning of each rule,
Packit 7b22a4
corresponding to that rule's position in the chain.
Packit 7b22a4
.TP
Packit 7b22a4
\fB\-\-modprobe=\fP\fIcommand\fP
Packit 7b22a4
When adding or inserting rules into a chain, use \fIcommand\fP
Packit 7b22a4
to load any necessary modules (targets, match extensions, etc).
Packit 7b22a4
.SH MATCH AND TARGET EXTENSIONS
Packit 7b22a4
.PP
Packit 7b22a4
iptables can use extended packet matching and target modules.
Packit 7b22a4
A list of these is available in the \fBiptables\-extensions\fP(8) manpage.
Packit 7b22a4
.SH DIAGNOSTICS
Packit 7b22a4
Various error messages are printed to standard error.  The exit code
Packit 7b22a4
is 0 for correct functioning.  Errors which appear to be caused by
Packit 7b22a4
invalid or abused command line parameters cause an exit code of 2, and
Packit 7b22a4
other errors cause an exit code of 1.
Packit 7b22a4
.SH BUGS
Packit 7b22a4
Bugs?  What's this? ;-)
Packit 7b22a4
Well, you might want to have a look at http://bugzilla.netfilter.org/
Packit 7b22a4
.SH COMPATIBILITY WITH IPCHAINS
Packit 7b22a4
This \fBiptables\fP
Packit 7b22a4
is very similar to ipchains by Rusty Russell.  The main difference is
Packit 7b22a4
that the chains \fBINPUT\fP and \fBOUTPUT\fP
Packit 7b22a4
are only traversed for packets coming into the local host and
Packit 7b22a4
originating from the local host respectively.  Hence every packet only
Packit 7b22a4
passes through one of the three chains (except loopback traffic, which
Packit 7b22a4
involves both INPUT and OUTPUT chains); previously a forwarded packet
Packit 7b22a4
would pass through all three.
Packit 7b22a4
.PP
Packit 7b22a4
The other main difference is that \fB\-i\fP refers to the input interface;
Packit 7b22a4
\fB\-o\fP refers to the output interface, and both are available for packets
Packit 7b22a4
entering the \fBFORWARD\fP chain.
Packit 7b22a4
.PP
Packit 7b22a4
The various forms of NAT have been separated out; \fBiptables\fP
Packit 7b22a4
is a pure packet filter when using the default `filter' table, with
Packit 7b22a4
optional extension modules.  This should simplify much of the previous
Packit 7b22a4
confusion over the combination of IP masquerading and packet filtering
Packit 7b22a4
seen previously.  So the following options are handled differently:
Packit 7b22a4
.nf
Packit 7b22a4
 \-j MASQ
Packit 7b22a4
 \-M \-S
Packit 7b22a4
 \-M \-L
Packit 7b22a4
.fi
Packit 7b22a4
There are several other changes in iptables.
Packit 7b22a4
.SH SEE ALSO
Packit 7b22a4
\fBiptables\-apply\fP(8),
Packit 7b22a4
\fBiptables\-save\fP(8),
Packit 7b22a4
\fBiptables\-restore\fP(8),
Packit 7b22a4
\fBiptables\-extensions\fP(8),
Packit 7b22a4
.PP
Packit 7b22a4
The packet-filtering-HOWTO details iptables usage for
Packit 7b22a4
packet filtering, the NAT-HOWTO details NAT,
Packit 7b22a4
the netfilter-extensions-HOWTO details the extensions that are
Packit 7b22a4
not in the standard distribution,
Packit 7b22a4
and the netfilter-hacking-HOWTO details the netfilter internals.
Packit 7b22a4
.br
Packit 7b22a4
See
Packit 7b22a4
.BR "http://www.netfilter.org/" .
Packit 7b22a4
.SH AUTHORS
Packit 7b22a4
Rusty Russell originally wrote iptables, in early consultation with Michael
Packit 7b22a4
Neuling.
Packit 7b22a4
.PP
Packit 7b22a4
Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
Packit 7b22a4
selection framework in iptables, then wrote the mangle table, the owner match,
Packit 7b22a4
the mark stuff, and ran around doing cool stuff everywhere.
Packit 7b22a4
.PP
Packit 7b22a4
James Morris wrote the TOS target, and tos match.
Packit 7b22a4
.PP
Packit 7b22a4
Jozsef Kadlecsik wrote the REJECT target.
Packit 7b22a4
.PP
Packit 7b22a4
Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as the TTL, DSCP, ECN matches and targets.
Packit 7b22a4
.PP
Packit 7b22a4
The Netfilter Core Team is: Jozsef Kadlecsik, Pablo Neira Ayuso,
Packit 7b22a4
Eric Leblond, Florian Westphal and  Arturo Borrero Gonzalez.
Packit 7b22a4
Emeritus Core Team members are: Marc
Packit 7b22a4
Boucher, Martin Josefsson, Yasuyuki Kozakai, James Morris, Harald Welte and
Packit 7b22a4
Rusty Russell.
Packit 7b22a4
.PP
Packit 7b22a4
Man page originally written by Herve Eychenne <rv@wallfire.org>.
Packit 7b22a4
.\" .. and did I mention that we are incredibly cool people?
Packit 7b22a4
.\" .. sexy, too ..
Packit 7b22a4
.\" .. witty, charming, powerful ..
Packit 7b22a4
.\" .. and most of all, modest ..
Packit 7b22a4
.SH VERSION
Packit 7b22a4
.PP
Packit 7b22a4
This manual page applies to iptables/ip6tables @PACKAGE_VERSION@.