blob: 1d2ffece3761055d8bf81f4d0d6cb71d6b5d0dd0 [file] [log] [blame]
Jan Engelhardt55dffef2008-07-03 20:27:50 +02001.TH IPTABLES 8 "Jul 03, 2008" "" ""
Henrik Nordstromc2794132004-01-22 15:04:24 +00002.\"
3.\" Man page written by Herve Eychenne <rv@wallfire.org> (May 1999)
4.\" It is based on ipchains page.
5.\" TODO: add a word for protocol helpers (FTP, IRC, SNMP-ALG)
6.\"
7.\" ipchains page by Paul ``Rusty'' Russell March 1997
8.\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl>
9.\"
10.\" This program is free software; you can redistribute it and/or modify
11.\" it under the terms of the GNU General Public License as published by
12.\" the Free Software Foundation; either version 2 of the License, or
13.\" (at your option) any later version.
14.\"
15.\" This program is distributed in the hope that it will be useful,
16.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.\" GNU General Public License for more details.
19.\"
20.\" You should have received a copy of the GNU General Public License
21.\" along with this program; if not, write to the Free Software
22.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23.\"
24.\"
25.SH NAME
26iptables \- administration tool for IPv4 packet filtering and NAT
27.SH SYNOPSIS
Jan Engelhardtd9842a62008-07-30 12:49:47 +020028\fBiptables\fP [\fB-t\fP \fItable\fP] {\fB-A\fP|\fB-D\fP} \fIchain rule-specification\fP [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010029.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020030\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-I\fP [\fIrulenum\fP] \fIrule-specification\fP [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010031.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020032\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-R\fP \fIrulenum rule-specification\fP [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010033.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020034\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-D\fP \fIchain rulenum\fP [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010035.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020036\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-S\fP [\fIchain\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010037.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020038\fBiptables\fP [\fB-t\fP \fItable\fP] {\fB-F\fP|\fB-L\fP|\fB-Z\fP} [\fIchain\fP] [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010039.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020040\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-N\fP \fIchain\fP
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010041.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020042\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-X\fP [\fIchain\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010043.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020044\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-P\fP \fIchain target\fP [\fIoptions...\fP]
Jan Engelhardt8a679dc2008-10-29 09:48:23 +010045.PP
Jan Engelhardtd9842a62008-07-30 12:49:47 +020046\fBiptables\fP [\fB-t\fP \fItable\fP] \fB-E\fP \fIold-chain-name new-chain-name\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000047.SH DESCRIPTION
Jan Engelhardt55dffef2008-07-03 20:27:50 +020048\fBIptables\fP is used to set up, maintain, and inspect the
49tables of IPv4 packet
Henrik Nordstromc2794132004-01-22 15:04:24 +000050filter rules in the Linux kernel. Several different tables
51may be defined. Each table contains a number of built-in
52chains and may also contain user-defined chains.
53
54Each chain is a list of rules which can match a set of packets. Each
55rule specifies what to do with a packet that matches. This is called
56a `target', which may be a jump to a user-defined chain in the same
57table.
58
59.SH TARGETS
Jan Engelhardt6cf172e2008-03-10 17:48:59 +010060A firewall rule specifies criteria for a packet and a target. If the
Henrik Nordstromc2794132004-01-22 15:04:24 +000061packet does not match, the next rule in the chain is the examined; if
62it does match, then the next rule is specified by the value of the
63target, which can be the name of a user-defined chain or one of the
Jan Engelhardt55dffef2008-07-03 20:27:50 +020064special values \fBACCEPT\fP, \fBDROP\fP, \fBQUEUE\fP or \fBRETURN\fP.
Henrik Nordstromc2794132004-01-22 15:04:24 +000065.PP
Jan Engelhardt55dffef2008-07-03 20:27:50 +020066\fBACCEPT\fP means to let the packet through.
67\fBDROP\fP means to drop the packet on the floor.
68\fBQUEUE\fP means to pass the packet to userspace.
69(How the packet can be received
Harald Welte7bdfca42005-07-28 15:24:02 +000070by a userspace process differs by the particular queue handler. 2.4.x
Jan Engelhardt55dffef2008-07-03 20:27:50 +020071and 2.6.x kernels up to 2.6.13 include the \fBip_queue\fP
72queue handler. Kernels 2.6.14 and later additionally include the
73\fBnfnetlink_queue\fP queue handler. Packets with a target of QUEUE will be
74sent to queue number '0' in this case. Please also see the \fBNFQUEUE\fP
Harald Welte7bdfca42005-07-28 15:24:02 +000075target as described later in this man page.)
Jan Engelhardt55dffef2008-07-03 20:27:50 +020076\fBRETURN\fP means stop traversing this chain and resume at the next
77rule in the
Henrik Nordstromc2794132004-01-22 15:04:24 +000078previous (calling) chain. If the end of a built-in chain is reached
Jan Engelhardt55dffef2008-07-03 20:27:50 +020079or a rule in a built-in chain with target \fBRETURN\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000080is matched, the target specified by the chain policy determines the
81fate of the packet.
82.SH TABLES
83There are currently three independent tables (which tables are present
84at any time depends on the kernel configuration options and which
85modules are present).
86.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +020087\fB-t\fP, \fB--table\fP \fItable\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000088This option specifies the packet matching table which the command
89should operate on. If the kernel is configured with automatic module
90loading, an attempt will be made to load the appropriate module for
91that table if it is not already there.
92
93The tables are as follows:
94.RS
95.TP .4i
Jan Engelhardt55dffef2008-07-03 20:27:50 +020096\fBfilter\fP:
Henrik Nordstromc2794132004-01-22 15:04:24 +000097This is the default table (if no -t option is passed). It contains
Jan Engelhardt55dffef2008-07-03 20:27:50 +020098the built-in chains \fBINPUT\fP (for packets destined to local sockets),
99\fBFORWARD\fP (for packets being routed through the box), and
100\fBOUTPUT\fP (for locally-generated packets).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000101.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200102\fBnat\fP:
Henrik Nordstromc2794132004-01-22 15:04:24 +0000103This table is consulted when a packet that creates a new
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200104connection is encountered. It consists of three built-ins: \fBPREROUTING\fP
105(for altering packets as soon as they come in), \fBOUTPUT\fP
106(for altering locally-generated packets before routing), and \fBPOSTROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000107(for altering packets as they are about to go out).
108.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200109\fBmangle\fP:
Henrik Nordstromc2794132004-01-22 15:04:24 +0000110This table is used for specialized packet alteration. Until kernel
Jan Engelhardt55dffef2008-07-03 20:27:50 +02001112.4.17 it had two built-in chains: \fBPREROUTING\fP
112(for altering incoming packets before routing) and \fBOUTPUT\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000113(for altering locally-generated packets before routing).
114Since kernel 2.4.18, three other built-in chains are also supported:
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200115\fBINPUT\fP (for packets coming into the box itself), \fBFORWARD\fP
116(for altering packets being routed through the box), and \fBPOSTROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000117(for altering packets as they are about to go out).
Harald Weltea1885992004-10-06 12:32:54 +0000118.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200119\fBraw\fP:
Harald Weltea1885992004-10-06 12:32:54 +0000120This table is used mainly for configuring exemptions from connection
121tracking in combination with the NOTRACK target. It registers at the netfilter
122hooks with higher priority and is thus called before ip_conntrack, or any other
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200123IP tables. It provides the following built-in chains: \fBPREROUTING\fP
124(for packets arriving via any network interface) \fBOUTPUT\fP
Harald Weltea1885992004-10-06 12:32:54 +0000125(for packets generated by local processes)
Henrik Nordstromc2794132004-01-22 15:04:24 +0000126.RE
127.SH OPTIONS
128The options that are recognized by
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200129\fBiptables\fP can be divided into several different groups.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000130.SS COMMANDS
Jan Engelhardt6cf172e2008-03-10 17:48:59 +0100131These options specify the desired action to perform. Only one of them
132can be specified on the command line unless otherwise stated
133below. For long versions of the command and option names, you
Henrik Nordstromc2794132004-01-22 15:04:24 +0000134need to use only enough letters to ensure that
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200135\fBiptables\fP can differentiate it from all other options.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000136.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200137\fB-A\fP, \fB--append\fP \fIchain rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000138Append one or more rules to the end of the selected chain.
139When the source and/or destination names resolve to more than one
140address, a rule will be added for each possible address combination.
141.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200142\fB-D\fP, \fB--delete\fP \fIchain rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000143.ns
144.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200145\fB-D\fP, \fB--delete\fP \fIchain rulenum\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000146Delete one or more rules from the selected chain. There are two
147versions of this command: the rule can be specified as a number in the
148chain (starting at 1 for the first rule) or a rule to match.
149.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200150\fB-I\fP, \fB--insert\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000151Insert one or more rules in the selected chain as the given rule
152number. So, if the rule number is 1, the rule or rules are inserted
153at the head of the chain. This is also the default if no rule number
154is specified.
155.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200156\fB-R\fP, \fB--replace\fP \fIchain rulenum rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000157Replace a rule in the selected chain. If the source and/or
158destination names resolve to multiple addresses, the command will
159fail. Rules are numbered starting at 1.
160.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200161\fB-L\fP, \fB--list\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000162List all rules in the selected chain. If no chain is selected, all
Jan Engelhardt6cf172e2008-03-10 17:48:59 +0100163chains are listed. Like every other iptables command, it applies to the
Henrik Nordstromc2794132004-01-22 15:04:24 +0000164specified table (filter is the default), so NAT rules get listed by
165.nf
166 iptables -t nat -n -L
167.fi
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200168Please note that it is often used with the \fB-n\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000169option, in order to avoid long reverse DNS lookups.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200170It is legal to specify the \fB-Z\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000171(zero) option as well, in which case the chain(s) will be atomically
172listed and zeroed. The exact output is affected by the other
173arguments given. The exact rules are suppressed until you use
174.nf
175 iptables -L -v
176.fi
177.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200178\fB-S\fP, \fB--list-rules\fP [\fIchain\fP]
Henrik Nordstrom96296cf2008-05-13 13:08:26 +0200179Print all rules in the selected chain. If no chain is selected, all
180chains are printed like iptables-save. Like every other iptables command,
181it applies to the specified table (filter is the default).
182.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200183\fB-F\fP, \fB--flush\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000184Flush the selected chain (all the chains in the table if none is given).
185This is equivalent to deleting all the rules one by one.
186.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200187\fB-Z\fP, \fB--zero\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000188Zero the packet and byte counters in all chains. It is legal to
189specify the
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200190\fB-L\fP, \fB--list\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000191(list) option as well, to see the counters immediately before they are
192cleared. (See above.)
193.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200194\fB-N\fP, \fB--new-chain\fP \fIchain\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000195Create a new user-defined chain by the given name. There must be no
196target of that name already.
197.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200198\fB-X\fP, \fB--delete-chain\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000199Delete the optional user-defined chain specified. There must be no references
Harald Welte3a026932005-11-22 22:22:28 +0000200to the chain. If there are, you must delete or replace the referring rules
201before the chain can be deleted. The chain must be empty, i.e. not contain
202any rules. If no argument is given, it will attempt to delete every
203non-builtin chain in the table.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000204.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200205\fB-P\fP, \fB--policy\fP \fIchain target\fP
206Set the policy for the chain to the given target. See the section \fBTARGETS\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000207for the legal targets. Only built-in (non-user-defined) chains can have
208policies, and neither built-in nor user-defined chains can be policy
209targets.
210.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200211\fB-E\fP, \fB--rename-chain\fP \fIold-chain new-chain\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000212Rename the user specified chain to the user supplied name. This is
213cosmetic, and has no effect on the structure of the table.
214.TP
215.B -h
216Help.
217Give a (currently very brief) description of the command syntax.
218.SS PARAMETERS
219The following parameters make up a rule specification (as used in the
220add, delete, insert, replace and append commands).
221.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200222[\fB!\fP] \fB-p\fP, \fB--protocol\fP \fIprotocol\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000223The protocol of the rule or of the packet to check.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200224The specified protocol can be one of \fBtcp\fP, \fBudp\fP, \fBudplite\fP,
225\fBicmp\fP, \fBesp\fP, \fBah\fP, \fBsctp\fP or \fBall\fP,
Henrik Nordstromc2794132004-01-22 15:04:24 +0000226or it can be a numeric value, representing one of these protocols or a
227different one. A protocol name from /etc/protocols is also allowed.
228A "!" argument before the protocol inverts the
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200229test. The number zero is equivalent to \fBall\fP.
230Protocol \fBall\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000231will match with all protocols and is taken as default when this
232option is omitted.
233.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200234[\fB!\fP] \fB-s\fP, \fB--source\fP \fIaddress\fP[\fB/\fP\fImask\fP]
235Source specification. \fIAddress\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000236can be either a network name, a hostname (please note that specifying
237any name to be resolved with a remote query such as DNS is a really bad idea),
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200238a network IP address (with \fB/\fP\fImask\fP), or a plain IP address.
239The \fImask\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000240can be either a network mask or a plain number,
241specifying the number of 1's at the left side of the network mask.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200242Thus, a mask of \fI24\fP is equivalent to \fI255.255.255.0\fP.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000243A "!" argument before the address specification inverts the sense of
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200244the address. The flag \fB--src\fP is an alias for this option.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000245.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200246[\fB!\fP] \fB-d\fP, \fB--destination\fP \fIaddress\fP[\fB/\fP\fImask\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000247Destination specification.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200248See the description of the \fB-s\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000249(source) flag for a detailed description of the syntax. The flag
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200250\fB--dst\fP is an alias for this option.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000251.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200252\fB-j\fP, \fB--jump\fP \fItarget\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000253This specifies the target of the rule; i.e., what to do if the packet
254matches it. The target can be a user-defined chain (other than the
255one this rule is in), one of the special builtin targets which decide
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200256the fate of the packet immediately, or an extension (see \fBEXTENSIONS\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000257below). If this
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200258option is omitted in a rule (and \fB-g\fP
Henrik Nordstrom17fc1632005-11-05 09:26:40 +0000259is not used), then matching the rule will have no
Henrik Nordstromc2794132004-01-22 15:04:24 +0000260effect on the packet's fate, but the counters on the rule will be
261incremented.
262.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200263\fB-g\fP, \fB--goto\fP \fIchain\fP
Henrik Nordstrom17fc1632005-11-05 09:26:40 +0000264This specifies that the processing should continue in a user
265specified chain. Unlike the --jump option return will not continue
266processing in this chain but instead in the chain that called us via
267--jump.
268.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200269[\fB!\fP] \fB-i\fP, \fB--in-interface\fP \fIname\fP
Matthew Strait403cf6a2004-03-17 14:26:08 +0000270Name of an interface via which a packet was received (only for
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200271packets entering the \fBINPUT\fP, \fBFORWARD\fP and \fBPREROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000272chains). When the "!" argument is used before the interface name, the
273sense is inverted. If the interface name ends in a "+", then any
274interface which begins with this name will match. If this option is
275omitted, any interface name will match.
276.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200277[\fB!\fP] \fB-o\fP, \fB--out-interface\fP \fIname\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000278Name of an interface via which a packet is going to be sent (for packets
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200279entering the \fBFORWARD\fP, \fBOUTPUT\fP and \fBPOSTROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000280chains). When the "!" argument is used before the interface name, the
281sense is inverted. If the interface name ends in a "+", then any
282interface which begins with this name will match. If this option is
283omitted, any interface name will match.
284.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200285[\fB!\fP] \fB-f\fP, \fB--fragment\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000286This means that the rule only refers to second and further fragments
287of fragmented packets. Since there is no way to tell the source or
288destination ports of such a packet (or ICMP type), such a packet will
289not match any rules which specify them. When the "!" argument
290precedes the "-f" flag, the rule will only match head fragments, or
291unfragmented packets.
292.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200293\fB-c\fP, \fB--set-counters\fP \fIpackets bytes\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000294This enables the administrator to initialize the packet and byte
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200295counters of a rule (during \fBINSERT\fP, \fBAPPEND\fP, \fBREPLACE\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000296operations).
297.SS "OTHER OPTIONS"
298The following additional options can be specified:
299.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200300\fB-v\fP, \fB--verbose\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000301Verbose output. This option makes the list command show the interface
302name, the rule options (if any), and the TOS masks. The packet and
303byte counters are also listed, with the suffix 'K', 'M' or 'G' for
3041000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200305the \fB-x\fP flag to change this).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000306For appending, insertion, deletion and replacement, this causes
307detailed information on the rule or rules to be printed.
308.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200309\fB-n\fP, \fB--numeric\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000310Numeric output.
311IP addresses and port numbers will be printed in numeric format.
312By default, the program will try to display them as host names,
313network names, or services (whenever applicable).
314.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200315\fB-x\fP, \fB--exact\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000316Expand numbers.
317Display the exact value of the packet and byte counters,
318instead of only the rounded number in K's (multiples of 1000)
319M's (multiples of 1000K) or G's (multiples of 1000M). This option is
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200320only relevant for the \fB-L\fP command.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000321.TP
322.B "--line-numbers"
323When listing rules, add line numbers to the beginning of each rule,
324corresponding to that rule's position in the chain.
325.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200326\fB--modprobe=\fP\fIcommand\fP
327When adding or inserting rules into a chain, use \fIcommand\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000328to load any necessary modules (targets, match extensions, etc).
329.SH MATCH EXTENSIONS
330iptables can use extended packet matching modules. These are loaded
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200331in two ways: implicitly, when \fB-p\fP or \fB--protocol\fP
332is specified, or with the \fB-m\fP or \fB--match\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000333options, followed by the matching module name; after these, various
334extra command line options become available, depending on the specific
335module. You can specify multiple extended match modules in one line,
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200336and you can use the \fB-h\fP or \fB--help\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000337options after the module has been specified to receive help specific
338to that module.
339
340The following are included in the base package, and most of these can
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200341be preceded by a "\fB!\fP" to invert the sense of the match.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000342.\" @MATCH@
343.SH TARGET EXTENSIONS
344iptables can use extended target modules: the following are included
345in the standard distribution.
346.\" @TARGET@
347.SH DIAGNOSTICS
348Various error messages are printed to standard error. The exit code
349is 0 for correct functioning. Errors which appear to be caused by
350invalid or abused command line parameters cause an exit code of 2, and
351other errors cause an exit code of 1.
352.SH BUGS
353Bugs? What's this? ;-)
Harald Welte64d900f2005-06-24 16:37:00 +0000354Well, you might want to have a look at http://bugzilla.netfilter.org/
Henrik Nordstromc2794132004-01-22 15:04:24 +0000355.SH COMPATIBILITY WITH IPCHAINS
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200356This \fBiptables\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000357is very similar to ipchains by Rusty Russell. The main difference is
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200358that the chains \fBINPUT\fP and \fBOUTPUT\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000359are only traversed for packets coming into the local host and
360originating from the local host respectively. Hence every packet only
361passes through one of the three chains (except loopback traffic, which
362involves both INPUT and OUTPUT chains); previously a forwarded packet
363would pass through all three.
364.PP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200365The other main difference is that \fB-i\fP refers to the input interface;
366\fB-o\fP refers to the output interface, and both are available for packets
367entering the \fBFORWARD\fP chain.
368.PP
369The various forms of NAT have been separated out; \fBiptables\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000370is a pure packet filter when using the default `filter' table, with
371optional extension modules. This should simplify much of the previous
372confusion over the combination of IP masquerading and packet filtering
373seen previously. So the following options are handled differently:
374.nf
375 -j MASQ
376 -M -S
377 -M -L
378.fi
379There are several other changes in iptables.
380.SH SEE ALSO
381.BR iptables-save (8),
382.BR iptables-restore (8),
383.BR ip6tables (8),
384.BR ip6tables-save (8),
Harald Welte7bdfca42005-07-28 15:24:02 +0000385.BR ip6tables-restore (8),
386.BR libipq (3).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000387.P
388The packet-filtering-HOWTO details iptables usage for
389packet filtering, the NAT-HOWTO details NAT,
390the netfilter-extensions-HOWTO details the extensions that are
391not in the standard distribution,
392and the netfilter-hacking-HOWTO details the netfilter internals.
393.br
394See
395.BR "http://www.netfilter.org/" .
396.SH AUTHORS
Harald Welte7bdfca42005-07-28 15:24:02 +0000397Rusty Russell originally wrote iptables, in early consultation with Michael
Henrik Nordstromc2794132004-01-22 15:04:24 +0000398Neuling.
399.PP
400Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
401selection framework in iptables, then wrote the mangle table, the owner match,
402the mark stuff, and ran around doing cool stuff everywhere.
403.PP
404James Morris wrote the TOS target, and tos match.
405.PP
406Jozsef Kadlecsik wrote the REJECT target.
407.PP
Harald Welte7bdfca42005-07-28 15:24:02 +0000408Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as the TTL, DSCP, ECN matches and targets.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000409.PP
Patrick McHardy110a89a2007-01-28 01:24:55 +0000410The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai,
Yasuyuki KOZAKAIe605d762007-02-15 06:41:58 +0000411Jozsef Kadlecsik, Patrick McHardy, James Morris, Pablo Neira Ayuso,
412Harald Welte and Rusty Russell.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000413.PP
Harald Welte7bdfca42005-07-28 15:24:02 +0000414Man page originally written by Herve Eychenne <rv@wallfire.org>.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000415.\" .. and did I mention that we are incredibly cool people?
416.\" .. sexy, too ..
417.\" .. witty, charming, powerful ..
418.\" .. and most of all, modest ..