blob: f73ff4628a867bfd439fbd2c47ba436ce88d207f [file] [log] [blame]
Hervé Eychenne9e518062002-03-14 09:25:40 +00001.TH IPTABLES 8 "Mar 09, 2002" "" ""
Marc Bouchere6869a82000-03-20 06:03:29 +00002.\"
Hervé Eychenne9e518062002-03-14 09:25:40 +00003.\" Man page written by Herve Eychenne <rv@wallfire.org> (May 1999)
4.\" It is based on ipchains page.
Hervé Eychennecea2ca32002-05-27 11:16:09 +00005.\" TODO: add a word for protocol helpers (FTP, IRC, SNMP-ALG)
Marc Bouchere6869a82000-03-20 06:03:29 +00006.\"
7.\" ipchains page by Paul ``Rusty'' Russell March 1997
Hervé Eychenne9e518062002-03-14 09:25:40 +00008.\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl>
Marc Bouchere6869a82000-03-20 06:03:29 +00009.\"
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
Hervé Eychennecea2ca32002-05-27 11:16:09 +000026iptables \- administration tool for IPv4 packet filtering and NAT
Marc Bouchere6869a82000-03-20 06:03:29 +000027.SH SYNOPSIS
Hervé Eychennee644cb02002-06-22 18:23:48 +000028.BR "iptables [-t table] -[ADC] " "chain rule-specification [options]"
Marc Bouchere6869a82000-03-20 06:03:29 +000029.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000030.BR "iptables [-t table] -I " "chain [rulenum] rule-specification [options]"
Hervé Eychenne9e518062002-03-14 09:25:40 +000031.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000032.BR "iptables [-t table] -R " "chain rulenum rule-specification [options]"
Marc Bouchere6869a82000-03-20 06:03:29 +000033.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000034.BR "iptables [-t table] -D " "chain rulenum [options]"
Marc Bouchere6869a82000-03-20 06:03:29 +000035.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000036.BR "iptables [-t table] -[LFZ] " "[chain] [options]"
Marc Bouchere6869a82000-03-20 06:03:29 +000037.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000038.BR "iptables [-t table] -N " "chain"
Hervé Eychenne9e518062002-03-14 09:25:40 +000039.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000040.BR "iptables [-t table] -X " "[chain]"
Marc Bouchere6869a82000-03-20 06:03:29 +000041.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000042.BR "iptables [-t table] -P " "chain target [options]"
Marc Bouchere6869a82000-03-20 06:03:29 +000043.br
Hervé Eychennee644cb02002-06-22 18:23:48 +000044.BR "iptables [-t table] -E " "old-chain-name new-chain-name"
Marc Bouchere6869a82000-03-20 06:03:29 +000045.SH DESCRIPTION
46.B Iptables
47is used to set up, maintain, and inspect the tables of IP packet
Harald Welte0112abb2001-02-19 21:48:13 +000048filter rules in the Linux kernel. Several different tables
49may be defined. Each table contains a number of built-in
50chains and may also contain user-defined chains.
Marc Bouchere6869a82000-03-20 06:03:29 +000051
Harald Welte0112abb2001-02-19 21:48:13 +000052Each chain is a list of rules which can match a set of packets. Each
53rule specifies what to do with a packet that matches. This is called
Marc Bouchere6869a82000-03-20 06:03:29 +000054a `target', which may be a jump to a user-defined chain in the same
55table.
56
57.SH TARGETS
58A firewall rule specifies criteria for a packet, and a target. If the
59packet does not match, the next rule in the chain is the examined; if
60it does match, then the next rule is specified by the value of the
Harald Welte0112abb2001-02-19 21:48:13 +000061target, which can be the name of a user-defined chain or one of the
Marc Bouchere6869a82000-03-20 06:03:29 +000062special values
63.IR ACCEPT ,
64.IR DROP ,
65.IR QUEUE ,
66or
67.IR RETURN .
68.PP
69.I ACCEPT
70means to let the packet through.
71.I DROP
72means to drop the packet on the floor.
73.I QUEUE
Rusty Russell363112d2000-08-11 13:49:26 +000074means to pass the packet to userspace (if supported by the kernel).
Marc Bouchere6869a82000-03-20 06:03:29 +000075.I RETURN
Harald Welte0112abb2001-02-19 21:48:13 +000076means stop traversing this chain and resume at the next rule in the
77previous (calling) chain. If the end of a built-in chain is reached
Marc Bouchere6869a82000-03-20 06:03:29 +000078or a rule in a built-in chain with target
79.I RETURN
80is matched, the target specified by the chain policy determines the
81fate of the packet.
82.SH TABLES
Hervé Eychennee644cb02002-06-22 18:23:48 +000083There are currently three independent tables (which tables are present
Rusty Russell363112d2000-08-11 13:49:26 +000084at any time depends on the kernel configuration options and which
85modules are present).
Marc Bouchere6869a82000-03-20 06:03:29 +000086.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +000087.BI "-t, --table " "table"
Marc Bouchere6869a82000-03-20 06:03:29 +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:
Harald Welte87d4be42001-07-05 06:26:37 +000094.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +000095.B "filter"
Hervé Eychennee644cb02002-06-22 18:23:48 +000096This is the default table (if no -t option is passed). It contains
97the built-in chains
Hervé Eychennecea2ca32002-05-27 11:16:09 +000098.B INPUT
99(for packets coming into the box itself),
100.B FORWARD
101(for packets being routed through the box), and
102.B OUTPUT
103(for locally-generated packets).
Harald Welte87d4be42001-07-05 06:26:37 +0000104.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000105.B "nat"
Harald Welte0112abb2001-02-19 21:48:13 +0000106This table is consulted when a packet that creates a new
Hervé Eychennecea2ca32002-05-27 11:16:09 +0000107connection is encountered. It consists of three built-ins:
108.B PREROUTING
109(for altering packets as soon as they come in),
110.B OUTPUT
111(for altering locally-generated packets before routing), and
112.B POSTROUTING
113(for altering packets as they are about to go out).
Harald Welte87d4be42001-07-05 06:26:37 +0000114.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000115.B "mangle"
116This table is used for specialized packet alteration. Until kernel
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001172.4.17 it had two built-in chains:
118.B PREROUTING
119(for altering incoming packets before routing) and
120.B OUTPUT
121(for altering locally-generated packets before routing).
122Since kernel 2.4.18, three other built-in chains are also supported:
123.B INPUT
124(for packets coming into the box itself),
125.B FORWARD
126(for altering packets being routed through the box), and
127.B POSTROUTING
128(for altering packets as they are about to go out).
Marc Bouchere6869a82000-03-20 06:03:29 +0000129.SH OPTIONS
130The options that are recognized by
131.B iptables
132can be divided into several different groups.
133.SS COMMANDS
Harald Welte0112abb2001-02-19 21:48:13 +0000134These options specify the specific action to perform. Only one of them
135can be specified on the command line unless otherwise specified
Marc Bouchere6869a82000-03-20 06:03:29 +0000136below. For all the long versions of the command and option names, you
Harald Welte0112abb2001-02-19 21:48:13 +0000137need to use only enough letters to ensure that
Marc Bouchere6869a82000-03-20 06:03:29 +0000138.B iptables
139can differentiate it from all other options.
140.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000141.BI "-A, --append " "chain rule-specification"
Marc Bouchere6869a82000-03-20 06:03:29 +0000142Append one or more rules to the end of the selected chain.
143When the source and/or destination names resolve to more than one
144address, a rule will be added for each possible address combination.
145.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000146.BI "-D, --delete " "chain rule-specification"
147.ns
148.TP
149.BI "-D, --delete " "chain rulenum"
Marc Bouchere6869a82000-03-20 06:03:29 +0000150Delete one or more rules from the selected chain. There are two
151versions of this command: the rule can be specified as a number in the
152chain (starting at 1 for the first rule) or a rule to match.
153.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000154.BR "-I, --insert " "\fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP"
Marc Bouchere6869a82000-03-20 06:03:29 +0000155Insert one or more rules in the selected chain as the given rule
156number. So, if the rule number is 1, the rule or rules are inserted
157at the head of the chain. This is also the default if no rule number
158is specified.
159.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000160.BI "-R, --replace " "chain rulenum rule-specification"
161Replace a rule in the selected chain. If the source and/or
162destination names resolve to multiple addresses, the command will
163fail. Rules are numbered starting at 1.
164.TP
165.BR "-L, --list " "[\fIchain\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000166List all rules in the selected chain. If no chain is selected, all
Hervé Eychenne9e518062002-03-14 09:25:40 +0000167chains are listed. As every other iptables command, it applies to the
168specified table (filter is the default), so NAT rules get listed by
169.br
170 iptables -t nat -n -L
171.br
172Please note that it is often used with the
173.B -n
174option, in order to avoid long reverse DNS lookups.
175It is legal to specify the
Marc Bouchere6869a82000-03-20 06:03:29 +0000176.B -Z
177(zero) option as well, in which case the chain(s) will be atomically
Harald Welte0112abb2001-02-19 21:48:13 +0000178listed and zeroed. The exact output is affected by the other
Harald Weltebfc33692002-08-07 09:52:22 +0000179arguments given. The exact rules are suppressed until you use
180.br
181 iptables -L -v
182.br
Marc Bouchere6869a82000-03-20 06:03:29 +0000183.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000184.BR "-F, --flush " "[\fIchain\fP]"
185Flush the selected chain (all the chains in the table if none is given).
186This is equivalent to deleting all the rules one by one.
Marc Bouchere6869a82000-03-20 06:03:29 +0000187.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000188.BR "-Z, --zero " "[\fIchain\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000189Zero the packet and byte counters in all chains. It is legal to
190specify the
191.B "-L, --list"
192(list) option as well, to see the counters immediately before they are
Harald Welte0112abb2001-02-19 21:48:13 +0000193cleared. (See above.)
Marc Bouchere6869a82000-03-20 06:03:29 +0000194.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000195.BI "-N, --new-chain " "chain"
Harald Welte0112abb2001-02-19 21:48:13 +0000196Create a new user-defined chain by the given name. There must be no
Marc Bouchere6869a82000-03-20 06:03:29 +0000197target of that name already.
198.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000199.BR "-X, --delete-chain " "[\fIchain\fP]"
200Delete the optional user-defined chain specified. There must be no references
Harald Welte0112abb2001-02-19 21:48:13 +0000201to the chain. If there are, you must delete or replace the referring
202rules before the chain can be deleted. If no argument is given, it
Rusty Russell363112d2000-08-11 13:49:26 +0000203will attempt to delete every non-builtin chain in the table.
Marc Bouchere6869a82000-03-20 06:03:29 +0000204.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000205.BI "-P, --policy " "chain target"
Marc Bouchere6869a82000-03-20 06:03:29 +0000206Set the policy for the chain to the given target. See the section
Rusty Russell363112d2000-08-11 13:49:26 +0000207.B TARGETS
Hervé Eychenne9e518062002-03-14 09:25:40 +0000208for the legal targets. Only built-in (non-user-defined) chains can have
209policies, and neither built-in nor user-defined chains can be policy
210targets.
Marc Bouchere6869a82000-03-20 06:03:29 +0000211.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000212.BI "-E, --rename-chain " "old-chain new-chain"
Harald Welte0112abb2001-02-19 21:48:13 +0000213Rename the user specified chain to the user supplied name. This is
Marc Bouchere6869a82000-03-20 06:03:29 +0000214cosmetic, and has no effect on the structure of the table.
Marc Bouchere6869a82000-03-20 06:03:29 +0000215.TP
216.B -h
217Help.
218Give a (currently very brief) description of the command syntax.
219.SS PARAMETERS
220The following parameters make up a rule specification (as used in the
Harald Welte0112abb2001-02-19 21:48:13 +0000221add, delete, insert, replace and append commands).
Marc Bouchere6869a82000-03-20 06:03:29 +0000222.TP
Rusty Russell2e0a3212000-04-19 11:23:18 +0000223.BR "-p, --protocol " "[!] \fIprotocol\fP"
Marc Bouchere6869a82000-03-20 06:03:29 +0000224The protocol of the rule or of the packet to check.
225The specified protocol can be one of
226.IR tcp ,
227.IR udp ,
228.IR icmp ,
229or
230.IR all ,
231or it can be a numeric value, representing one of these protocols or a
Rusty Russell363112d2000-08-11 13:49:26 +0000232different one. A protocol name from /etc/protocols is also allowed.
Marc Bouchere6869a82000-03-20 06:03:29 +0000233A "!" argument before the protocol inverts the
234test. The number zero is equivalent to
235.IR all .
236Protocol
237.I all
238will match with all protocols and is taken as default when this
239option is omitted.
Marc Bouchere6869a82000-03-20 06:03:29 +0000240.TP
241.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
242Source specification.
243.I Address
Hervé Eychenne9e518062002-03-14 09:25:40 +0000244can be either a network name, a hostname (please note that specifying
245any name to be resolved with a remote query such as DNS is a really bad idea),
246a network IP address (with /mask), or a plain IP address.
Marc Bouchere6869a82000-03-20 06:03:29 +0000247The
248.I mask
249can be either a network mask or a plain number,
250specifying the number of 1's at the left side of the network mask.
251Thus, a mask of
252.I 24
253is equivalent to
254.IR 255.255.255.0 .
255A "!" argument before the address specification inverts the sense of
256the address. The flag
257.B --src
Hervé Eychenne9e518062002-03-14 09:25:40 +0000258is an alias for this option.
Marc Bouchere6869a82000-03-20 06:03:29 +0000259.TP
260.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
261Destination specification.
262See the description of the
263.B -s
264(source) flag for a detailed description of the syntax. The flag
265.B --dst
266is an alias for this option.
267.TP
268.BI "-j, --jump " "target"
Harald Welte0112abb2001-02-19 21:48:13 +0000269This specifies the target of the rule; i.e., what to do if the packet
270matches it. The target can be a user-defined chain (other than the
271one this rule is in), one of the special builtin targets which decide
272the fate of the packet immediately, or an extension (see
Marc Bouchere6869a82000-03-20 06:03:29 +0000273.B EXTENSIONS
274below). If this
275option is omitted in a rule, then matching the rule will have no
276effect on the packet's fate, but the counters on the rule will be
277incremented.
278.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000279.BR "-i, --in-interface " "[!] \fIname\fP"
280Name of an interface via which a packet is going to be received (only for
Marc Bouchere6869a82000-03-20 06:03:29 +0000281packets entering the
282.BR INPUT ,
283.B FORWARD
284and
285.B PREROUTING
286chains). When the "!" argument is used before the interface name, the
287sense is inverted. If the interface name ends in a "+", then any
288interface which begins with this name will match. If this option is
Hervé Eychenne9e518062002-03-14 09:25:40 +0000289omitted, any interface name will match.
Marc Bouchere6869a82000-03-20 06:03:29 +0000290.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000291.BR "-o, --out-interface " "[!] \fIname\fP"
292Name of an interface via which a packet is going to be sent (for packets
293entering the
Marc Bouchere6869a82000-03-20 06:03:29 +0000294.BR FORWARD ,
295.B OUTPUT
296and
297.B POSTROUTING
Hervé Eychenne9e518062002-03-14 09:25:40 +0000298chains). When the "!" argument is used before the interface name, the
299sense is inverted. If the interface name ends in a "+", then any
Marc Bouchere6869a82000-03-20 06:03:29 +0000300interface which begins with this name will match. If this option is
Hervé Eychenne9e518062002-03-14 09:25:40 +0000301omitted, any interface name will match.
Marc Bouchere6869a82000-03-20 06:03:29 +0000302.TP
303.B "[!] " "-f, --fragment"
304This means that the rule only refers to second and further fragments
305of fragmented packets. Since there is no way to tell the source or
306destination ports of such a packet (or ICMP type), such a packet will
307not match any rules which specify them. When the "!" argument
Rusty Russell363112d2000-08-11 13:49:26 +0000308precedes the "-f" flag, the rule will only match head fragments, or
309unfragmented packets.
Harald Welteccd49e52001-01-23 22:54:34 +0000310.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000311.BI "-c, --set-counters " "PKTS BYTES"
Fabrice MARIEb0d84602002-06-14 07:39:58 +0000312This enables the administrator to initialize the packet and byte
Harald Welteccd49e52001-01-23 22:54:34 +0000313counters of a rule (during
314.B INSERT,
315.B APPEND,
316.B REPLACE
Hervé Eychenne9e518062002-03-14 09:25:40 +0000317operations).
Marc Bouchere6869a82000-03-20 06:03:29 +0000318.SS "OTHER OPTIONS"
319The following additional options can be specified:
320.TP
321.B "-v, --verbose"
322Verbose output. This option makes the list command show the interface
Harald Weltebfc33692002-08-07 09:52:22 +0000323name, the rule options (if any), and the TOS masks. The packet and
Marc Bouchere6869a82000-03-20 06:03:29 +0000324byte counters are also listed, with the suffix 'K', 'M' or 'G' for
3251000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
326the
327.B -x
328flag to change this).
329For appending, insertion, deletion and replacement, this causes
330detailed information on the rule or rules to be printed.
331.TP
332.B "-n, --numeric"
333Numeric output.
334IP addresses and port numbers will be printed in numeric format.
335By default, the program will try to display them as host names,
336network names, or services (whenever applicable).
337.TP
338.B "-x, --exact"
339Expand numbers.
340Display the exact value of the packet and byte counters,
341instead of only the rounded number in K's (multiples of 1000)
342M's (multiples of 1000K) or G's (multiples of 1000M). This option is
Marc Boucherf127a192000-03-20 08:32:15 +0000343only relevant for the
Marc Bouchere6869a82000-03-20 06:03:29 +0000344.B -L
345command.
346.TP
347.B "--line-numbers"
348When listing rules, add line numbers to the beginning of each rule,
349corresponding to that rule's position in the chain.
Chapman Brad45493a82001-02-23 09:08:13 +0000350.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000351.B "--modprobe=command"
Chapman Brad45493a82001-02-23 09:08:13 +0000352When adding or inserting rules into a chain, use
353.B command
354to load any necessary modules (targets, match extensions, etc).
Marc Bouchere6869a82000-03-20 06:03:29 +0000355.SH MATCH EXTENSIONS
Rusty Russell363112d2000-08-11 13:49:26 +0000356iptables can use extended packet matching modules. These are loaded
357in two ways: implicitly, when
358.B -p
359or
360.B --protocol
361is specified, or with the
362.B -m
363or
364.B --match
365options, followed by the matching module name; after these, various
366extra command line options become available, depending on the specific
Hervé Eychenne9e518062002-03-14 09:25:40 +0000367module. You can specify multiple extended match modules in one line,
368and you can use the
Rusty Russell363112d2000-08-11 13:49:26 +0000369.B -h
370or
371.B --help
372options after the module has been specified to receive help specific
373to that module.
374
375The following are included in the base package, and most of these can
376be preceded by a
Marc Bouchere6869a82000-03-20 06:03:29 +0000377.B !
378to invert the sense of the match.
Harald Welte282d6692003-02-14 07:34:09 +0000379.SS ah
380This module matches the SPIs in AH header of IPSec packets.
Marc Bouchere6869a82000-03-20 06:03:29 +0000381.TP
Harald Welte282d6692003-02-14 07:34:09 +0000382.BR "--ahspi " "[!] \fIspi\fP[:\fIspi\fP]"
Harald Weltebfc33692002-08-07 09:52:22 +0000383.SS conntrack
384This module, when combined with connection tracking, allows access to
385more connection tracking information than the "state" match.
386(this module is present only if iptables was compiled under a kernel
387supporting this feature)
388.TP
389.BI "--ctstate " "state"
390Where state is a comma separated list of the connection states to
Harald Welte282d6692003-02-14 07:34:09 +0000391match. Possible states are
Harald Weltebfc33692002-08-07 09:52:22 +0000392.B INVALID
393meaning that the packet is associated with no known connection,
394.B ESTABLISHED
395meaning that the packet is associated with a connection which has seen
396packets in both directions,
397.B NEW
398meaning that the packet has started a new connection, or otherwise
399associated with a connection which has not seen packets in both
400directions, and
401.B RELATED
402meaning that the packet is starting a new connection, but is
403associated with an existing connection, such as an FTP data transfer,
404or an ICMP error.
405.B SNAT
Harald Welte282d6692003-02-14 07:34:09 +0000406A virtual state, matching if the original source address differs from
Harald Weltebfc33692002-08-07 09:52:22 +0000407the reply destination.
408.B DNAT
Harald Welte282d6692003-02-14 07:34:09 +0000409A virtual state, matching if the original destination differs from the
Harald Weltebfc33692002-08-07 09:52:22 +0000410reply source.
411.TP
412.BI "--ctproto " "proto"
413Protocol to match (by number or name)
414.TP
415.BI "--ctorigsrc " "[!] \fIaddress\fP[/\fImask\fP]"
416Match against original source address
417.TP
418.BI "--ctorigdst " "[!] \fIaddress\fP[/\fImask\fP]"
419Match against original destination address
420.TP
421.BI "--ctreplsrc " "[!] \fIaddress\fP[/\fImask\fP]"
422Match against reply source address
423.TP
424.BI "--ctrepldst " "[!] \fIaddress\fB[/\fImask\fP]"
425Match against reply destination address
426.TP
427.BI "--ctstatus " "[\fINONE|EXPECTED|SEEN_REPLY|ASSURED\fP][,...]"
428Match against internal conntrack states
429.TP
430.BI "--ctexpire " "\fItime\fP[\fI:time\fP]"
431Match remaining lifetime in seconds against given value
432or range of values (inclusive)
433.SS dscp
434This module matches the 6 bit DSCP field within the TOS field in the
435IP header. DSCP has superseded TOS within the IETF.
436.TP
437.BI "--dscp " "value"
438Match against a numeric (decimal or hex) value [0-32].
439.TP
440.BI "--dscp-class " "\fIDiffServ Class\fP"
Harald Welte282d6692003-02-14 07:34:09 +0000441Match the DiffServ class. This value may be any of the
Harald Weltebfc33692002-08-07 09:52:22 +0000442BE, EF, AFxx or CSx classes. It will then be converted
443into it's according numeric value.
Harald Welte282d6692003-02-14 07:34:09 +0000444.SS esp
445This module matches the SPIs in ESP header of IPSec packets.
446.TP
447.BR "--espspi " "[!] \fIspi\fP[:\fIspi\fP]"
Hervé Eychenne9230c112003-03-03 22:23:22 +0000448.SS helper
449This module matches packets related to a specific conntrack-helper.
450.TP
451.BI "--helper " "string"
452Matches packets related to the specified conntrack-helper.
453.TP
454string can be "ftp" for packets related to a ftp-session on default port.
455For other ports append -portnr to the value, ie. "ftp-2121".
456.br
457Same rules apply for other conntrack-helpers.
458.br
Harald Welte282d6692003-02-14 07:34:09 +0000459.SS icmp
460This extension is loaded if `--protocol icmp' is specified. It
461provides the following option:
462.TP
463.BR "--icmp-type " "[!] \fItypename\fP"
464This allows specification of the ICMP type, which can be a numeric
465ICMP type, or one of the ICMP type names shown by the command
466.br
467 iptables -p icmp -h
468.br
469.SS length
470This module matches the length of a packet against a specific value
471or range of values.
472.TP
473.BR "--length " "\fIlength\fP[:\fIlength\fP]"
474.SS limit
475This module matches at a limited rate using a token bucket filter.
476A rule using this extension will match until this limit is reached
477(unless the `!' flag is used). It can be used in combination with the
478.B LOG
479target to give limited logging, for example.
480.TP
481.BI "--limit " "rate"
482Maximum average matching rate: specified as a number, with an optional
483`/second', `/minute', `/hour', or `/day' suffix; the default is
4843/hour.
485.TP
486.BI "--limit-burst " "number"
487Maximum initial number of packets to match: this number gets
488recharged by one every time the limit specified above is not reached,
489up to this number; the default is 5.
490.SS mac
491.TP
492.BR "--mac-source " "[!] \fIaddress\fP"
493Match source MAC address. It must be of the form XX:XX:XX:XX:XX:XX.
494Note that this only makes sense for packets coming from an Ethernet device
495and entering the
496.BR PREROUTING ,
497.B FORWARD
498or
499.B INPUT
500chains.
501.SS mark
502This module matches the netfilter mark field associated with a packet
503(which can be set using the
504.B MARK
505target below).
506.TP
507.BR "--mark " "\fIvalue\fP[/\fImask\fP]"
508Matches packets with the given unsigned mark value (if a mask is
509specified, this is logically ANDed with the mask before the
510comparison).
511.SS multiport
512This module matches a set of source or destination ports. Up to 15
513ports can be specified. It can only be used in conjunction with
514.B "-p tcp"
515or
516.BR "-p udp" .
517.TP
518.BR "--source-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
519Match if the source port is one of the given ports. The flag
520.B --sports
521is a convenient alias for this option.
522.TP
523.BR "--destination-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
524Match if the destination port is one of the given ports. The flag
525.B --dports
526is a convenient alias for this option.
527.TP
528.BR "--ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
529Match if the both the source and destination ports are equal to each
530other and to one of the given ports.
531.SS owner
532This module attempts to match various characteristics of the packet
533creator, for locally-generated packets. It is only valid in the
534.B OUTPUT
535chain, and even this some packets (such as ICMP ping responses) may
536have no owner, and hence never match.
537.TP
538.BI "--uid-owner " "userid"
539Matches if the packet was created by a process with the given
540effective user id.
541.TP
542.BI "--gid-owner " "groupid"
543Matches if the packet was created by a process with the given
544effective group id.
545.TP
546.BI "--pid-owner " "processid"
547Matches if the packet was created by a process with the given
548process id.
549.TP
550.BI "--sid-owner " "sessionid"
551Matches if the packet was created by a process in the given session
552group.
553.TP
554.BI "--cmd-owner " "name"
555Matches if the packet was created by a process with the given command name.
556(this option is present only if iptables was compiled under a kernel
557supporting this feature)
558.SS physdev
559This module matches on the bridge port input and output devices enslaved
Bart De Schuymer30596a52003-04-27 10:01:44 +0000560to a bridge device. This module is a part of the infrastructure that enables
Harald Welte282d6692003-02-14 07:34:09 +0000561a transparent bridging IP firewall and is only useful for kernel versions
562above version 2.5.44.
563.TP
564.B --physdev-in name
565Name of a bridge port via which a packet is received (only for
566packets entering the
567.BR INPUT ,
568.B FORWARD
569and
570.B PREROUTING
571chains). If the interface name ends in a "+", then any
Bart De Schuymer30596a52003-04-27 10:01:44 +0000572interface which begins with this name will match. If the packet didn't arrive
573through a bridge device, this packet won't match this option, unless '!' is used.
Harald Welte282d6692003-02-14 07:34:09 +0000574.TP
575.B --physdev-out name
576Name of a bridge port via which a packet is going to be sent (for packets
577entering the
578.BR FORWARD ,
579.B OUTPUT
580and
581.B POSTROUTING
582chains). If the interface name ends in a "+", then any
583interface which begins with this name will match. Note that in the
584.BR nat " and " mangle
585.B OUTPUT
586chains one cannot match on the bridge output port, however one can in the
587.B "filter OUTPUT"
Bart De Schuymer30596a52003-04-27 10:01:44 +0000588chain. If the packet won't leave by a bridge device or it is yet unknown what
589the output device will be, then the packet won't match this option, unless
590'!' is used.
591.TP
592.B --physdev-is-in
593Matches if the packet has entered through a bridge interface.
594.TP
595.B --physdev-is-out
596Matches if the packet will leave through a bridge interface.
597.TP
598.B --physdev-is-bridged
599Matches if the packet is being bridged and therefore is not being routed.
600This is only useful in the FORWARD and POSTROUTING chains.
Harald Weltebfc33692002-08-07 09:52:22 +0000601.SS pkttype
602This module matches the link-layer packet type.
603.TP
604.BI "--pkt-type " "[\fIunicast\fP|\fIbroadcast\fP|\fImulticast\fP]"
Harald Welte282d6692003-02-14 07:34:09 +0000605.SS state
606This module, when combined with connection tracking, allows access to
607the connection tracking state for this packet.
608.TP
609.BI "--state " "state"
610Where state is a comma separated list of the connection states to
611match. Possible states are
612.B INVALID
613meaning that the packet is associated with no known connection,
614.B ESTABLISHED
615meaning that the packet is associated with a connection which has seen
616packets in both directions,
617.B NEW
618meaning that the packet has started a new connection, or otherwise
619associated with a connection which has not seen packets in both
620directions, and
621.B RELATED
622meaning that the packet is starting a new connection, but is
623associated with an existing connection, such as an FTP data transfer,
624or an ICMP error.
625.SS tcp
626These extensions are loaded if `--protocol tcp' is specified. It
627provides the following options:
628.TP
629.BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
630Source port or port range specification. This can either be a service
631name or a port number. An inclusive range can also be specified,
632using the format
633.IR port : port .
634If the first port is omitted, "0" is assumed; if the last is omitted,
635"65535" is assumed.
636If the second port greater then the first they will be swapped.
637The flag
638.B --sport
639is a convenient alias for this option.
640.TP
641.BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
642Destination port or port range specification. The flag
643.B --dport
644is a convenient alias for this option.
645.TP
646.BR "--tcp-flags " "[!] \fImask\fP \fIcomp\fP"
647Match when the TCP flags are as specified. The first argument is the
648flags which we should examine, written as a comma-separated list, and
649the second argument is a comma-separated list of flags which must be
650set. Flags are:
651.BR "SYN ACK FIN RST URG PSH ALL NONE" .
652Hence the command
653.br
654 iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
655.br
656will only match packets with the SYN flag set, and the ACK, FIN and
657RST flags unset.
658.TP
659.B "[!] --syn"
660Only match TCP packets with the SYN bit set and the ACK and RST bits
661cleared. Such packets are used to request TCP connection initiation;
662for example, blocking such packets coming in an interface will prevent
663incoming TCP connections, but outgoing TCP connections will be
664unaffected.
665It is equivalent to \fB--tcp-flags SYN,RST,ACK SYN\fP.
666If the "!" flag precedes the "--syn", the sense of the
667option is inverted.
668.TP
669.BR "--tcp-option " "[!] \fInumber\fP"
670Match if TCP option set.
671.TP
672.BR "--mss " "\fIvalue\fP[:\fIvalue\fP]"
673Match TCP SYN or SYN/ACK packets with the specified MSS value (or range),
674which control the maximum packet size for that connection.
Marc Bouchere6869a82000-03-20 06:03:29 +0000675.SS tos
676This module matches the 8 bits of Type of Service field in the IP
Harald Welte282d6692003-02-14 07:34:09 +0000677header (ie. including the precedence bits).
Marc Bouchere6869a82000-03-20 06:03:29 +0000678.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000679.BI "--tos " "tos"
Marc Bouchere6869a82000-03-20 06:03:29 +0000680The argument is either a standard name, (use
681.br
682 iptables -m tos -h
683.br
684to see the list), or a numeric value to match.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000685.SS ttl
686This module matches the time to live field in the IP header.
687.TP
688.BI "--ttl " "ttl"
689Matches the given TTL value.
Harald Welte282d6692003-02-14 07:34:09 +0000690.SS udp
691These extensions are loaded if `--protocol udp' is specified. It
692provides the following options:
693.TP
694.BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
695Source port or port range specification.
696See the description of the
697.B --source-port
698option of the TCP extension for details.
699.TP
700.BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
701Destination port or port range specification.
702See the description of the
703.B --destination-port
704option of the TCP extension for details.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000705.SS unclean
706This module takes no options, but attempts to match packets which seem
707malformed or unusual. This is regarded as experimental.
Marc Bouchere6869a82000-03-20 06:03:29 +0000708.SH TARGET EXTENSIONS
709iptables can use extended target modules: the following are included
710in the standard distribution.
Harald Welte282d6692003-02-14 07:34:09 +0000711.SS DNAT
712This target is only valid in the
713.B nat
714table, in the
715.B PREROUTING
716and
717.B OUTPUT
718chains, and user-defined chains which are only called from those
719chains. It specifies that the destination address of the packet
720should be modified (and all future packets in this connection will
721also be mangled), and rules should cease being examined. It takes one
722type of option:
723.TP
724.BR "--to-destination " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
725which can specify a single new destination IP address, an inclusive
726range of IP addresses, and optionally, a port range (which is only
727valid if the rule also specifies
728.B "-p tcp"
729or
730.BR "-p udp" ).
731If no port range is specified, then the destination port will never be
732modified.
733.TP
734You can add several --to-destination options. If you specify more
735than one destination address, either via an address range or multiple
736--to-destination options, a simple round-robin (one after another in
737cycle) load balancing takes place between these adresses.
738.SS DSCP
739This target allows to alter the value of the DSCP bits within the TOS
740header of the IPv4 packet. As this manipulates a packet, it can only
741be used in the mangle table.
742.TP
743.BI "--set-dscp " "value"
744Set the DSCP field to a numerical value (can be decimal or hex)
745.TP
746.BI "--set-dscp-class " "class"
747Set the DSCP field to a DiffServ class.
748.SS ECN
749This target allows to selectively work around known ECN blackholes.
750It can only be used in the mangle table.
751.TP
752.BI "--ecn-tcp-remove"
753Remove all ECN bits from the TCP header. Of course, it can only be used
754in conjunction with
755.BR "-p tcp" .
Marc Bouchere6869a82000-03-20 06:03:29 +0000756.SS LOG
757Turn on kernel logging of matching packets. When this option is set
758for a rule, the Linux kernel will print some information on all
Rusty Russell363112d2000-08-11 13:49:26 +0000759matching packets (like most IP header fields) via the kernel log
760(where it can be read with
761.I dmesg
762or
763.IR syslogd (8)).
Hervé Eychenne9e518062002-03-14 09:25:40 +0000764This is a "non-terminating target", i.e. rule traversal continues at
765the next rule. So if you want to LOG the packets you refuse, use two
Hervé Eychennee644cb02002-06-22 18:23:48 +0000766separate rules with the same matching criteria, first using target LOG
Hervé Eychenne9e518062002-03-14 09:25:40 +0000767then DROP (or REJECT).
Marc Bouchere6869a82000-03-20 06:03:29 +0000768.TP
769.BI "--log-level " "level"
770Level of logging (numeric or see \fIsyslog.conf\fP(5)).
771.TP
772.BI "--log-prefix " "prefix"
Rusty Russellf81427e2000-09-13 04:20:38 +0000773Prefix log messages with the specified prefix; up to 29 letters long,
Marc Bouchere6869a82000-03-20 06:03:29 +0000774and useful for distinguishing messages in the logs.
775.TP
776.B --log-tcp-sequence
777Log TCP sequence numbers. This is a security risk if the log is
778readable by users.
779.TP
780.B --log-tcp-options
781Log options from the TCP packet header.
782.TP
783.B --log-ip-options
784Log options from the IP packet header.
785.SS MARK
786This is used to set the netfilter mark value associated with the
787packet. It is only valid in the
788.B mangle
Hervé Eychenne9e518062002-03-14 09:25:40 +0000789table. It can for example be used in conjunction with iproute2.
Marc Bouchere6869a82000-03-20 06:03:29 +0000790.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000791.BI "--set-mark " "mark"
Harald Welte282d6692003-02-14 07:34:09 +0000792.SS MASQUERADE
793This target is only valid in the
794.B nat
795table, in the
796.B POSTROUTING
797chain. It should only be used with dynamically assigned IP (dialup)
798connections: if you have a static IP address, you should use the SNAT
799target. Masquerading is equivalent to specifying a mapping to the IP
800address of the interface the packet is going out, but also has the
801effect that connections are
802.I forgotten
803when the interface goes down. This is the correct behavior when the
804next dialup is unlikely to have the same interface address (and hence
805any established connections are lost anyway). It takes one option:
806.TP
807.BR "--to-ports " "\fIport\fP[-\fIport\fP]"
808This specifies a range of source ports to use, overriding the default
809.B SNAT
810source port-selection heuristics (see above). This is only valid
811if the rule also specifies
812.B "-p tcp"
813or
814.BR "-p udp" .
815.SS MIRROR
816This is an experimental demonstration target which inverts the source
817and destination fields in the IP header and retransmits the packet.
818It is only valid in the
819.BR INPUT ,
820.B FORWARD
821and
822.B PREROUTING
823chains, and user-defined chains which are only called from those
824chains. Note that the outgoing packets are
825.B NOT
826seen by any packet filtering chains, connection tracking or NAT, to
827avoid loops and other problems.
828.SS REDIRECT
829This target is only valid in the
830.B nat
831table, in the
832.B PREROUTING
833and
834.B OUTPUT
835chains, and user-defined chains which are only called from those
836chains. It alters the destination IP address to send the packet to
837the machine itself (locally-generated packets are mapped to the
838127.0.0.1 address). It takes one option:
839.TP
840.BR "--to-ports " "\fIport\fP[-\fIport\fP]"
841This specifies a destination port or range of ports to use: without
842this, the destination port is never altered. This is only valid
843if the rule also specifies
844.B "-p tcp"
845or
846.BR "-p udp" .
Marc Bouchere6869a82000-03-20 06:03:29 +0000847.SS REJECT
848This is used to send back an error packet in response to the matched
Harald Welte282d6692003-02-14 07:34:09 +0000849packet: otherwise it is equivalent to
Hervé Eychenne9e518062002-03-14 09:25:40 +0000850.B DROP
851so it is a terminating TARGET, ending rule traversal.
Marc Bouchere6869a82000-03-20 06:03:29 +0000852This target is only valid in the
853.BR INPUT ,
854.B FORWARD
855and
856.B OUTPUT
Rusty Russell9cadb432000-05-10 00:18:06 +0000857chains, and user-defined chains which are only called from those
Hervé Eychenne9e518062002-03-14 09:25:40 +0000858chains. The following option controls the nature of the error packet
Marc Bouchere6869a82000-03-20 06:03:29 +0000859returned:
860.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000861.BI "--reject-with " "type"
Harald Welte282d6692003-02-14 07:34:09 +0000862The type given can be
Marc Bouchere6869a82000-03-20 06:03:29 +0000863.BR icmp-net-unreachable ,
864.BR icmp-host-unreachable ,
Rusty Russell14f390f2000-07-30 01:10:04 +0000865.BR icmp-port-unreachable ,
866.BR icmp-proto-unreachable ,
Harald Welte5a52c512003-05-24 11:44:18 +0000867.BR icmp-net-prohibited ,
868.BR "icmp-host-prohibited or"
869.BR "icmp-admin-prohibited (*)"
Hervé Eychenne9e518062002-03-14 09:25:40 +0000870which return the appropriate ICMP error message (\fBport-unreachable\fP is
871the default). The option
Rusty Russell14f390f2000-07-30 01:10:04 +0000872.B tcp-reset
Rusty Russell363112d2000-08-11 13:49:26 +0000873can be used on rules which only match the TCP protocol: this causes a
874TCP RST packet to be sent back. This is mainly useful for blocking
875.I ident
Hervé Eychenne9e518062002-03-14 09:25:40 +0000876(113/tcp) probes which frequently occur when sending mail to broken mail
877hosts (which won't accept your mail otherwise).
Harald Welte5a52c512003-05-24 11:44:18 +0000878.TP
879(*) Using icmp-admin-prohibited with kernels that do not support it will result in a plain DROP instead of REJECT
Marc Bouchere6869a82000-03-20 06:03:29 +0000880.SS SNAT
Harald Welte282d6692003-02-14 07:34:09 +0000881This target is only valid in the
Marc Bouchere6869a82000-03-20 06:03:29 +0000882.B nat
Harald Welte282d6692003-02-14 07:34:09 +0000883table, in the
Marc Bouchere6869a82000-03-20 06:03:29 +0000884.B POSTROUTING
885chain. It specifies that the source address of the packet should be
886modified (and all future packets in this connection will also be
Hervé Eychennee644cb02002-06-22 18:23:48 +0000887mangled), and rules should cease being examined. It takes one type
888of option:
Marc Bouchere6869a82000-03-20 06:03:29 +0000889.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000890.BR "--to-source " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000891which can specify a single new source IP address, an inclusive range
892of IP addresses, and optionally, a port range (which is only valid if
893the rule also specifies
894.B "-p tcp"
895or
896.BR "-p udp" ).
897If no port range is specified, then source ports below 512 will be
Harald Welte0112abb2001-02-19 21:48:13 +0000898mapped to other ports below 512: those between 512 and 1023 inclusive
899will be mapped to ports below 1024, and other ports will be mapped to
9001024 or above. Where possible, no port alteration will occur.
Hervé Eychennee644cb02002-06-22 18:23:48 +0000901.TP
902You can add several --to-source options. If you specify more
903than one source address, either via an address range or multiple
904--to-source options, a simple round-robin (one after another in
905cycle) takes place between these adresses.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000906.SS TCPMSS
907This target allows to alter the MSS value of TCP SYN packets, to control
908the maximum size for that connection (usually limiting it to your
Hervé Eychennecea2ca32002-05-27 11:16:09 +0000909outgoing interface's MTU minus 40). Of course, it can only be used
Hervé Eychenne9e518062002-03-14 09:25:40 +0000910in conjunction with
911.BR "-p tcp" .
912.br
913This target is used to overcome criminally braindead ISPs or servers
914which block ICMP Fragmentation Needed packets. The symptoms of this
915problem are that everything works fine from your Linux
916firewall/router, but machines behind it can never exchange large
917packets:
918.br
919 1) Web browsers connect, then hang with no data received.
920.br
921 2) Small mail works fine, but large emails hang.
922.br
923 3) ssh works fine, but scp hangs after initial handshaking.
924.br
925Workaround: activate this option and add a rule to your firewall
926configuration like:
927.br
928 iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN \\
929.br
930 -j TCPMSS --clamp-mss-to-pmtu
931.TP
932.BI "--set-mss " "value"
933Explicitly set MSS option to specified value.
934.TP
935.B "--clamp-mss-to-pmtu"
936Automatically clamp MSS value to (path_MTU - 40).
937.TP
938These options are mutually exclusive.
Harald Welte282d6692003-02-14 07:34:09 +0000939.SS TOS
940This is used to set the 8-bit Type of Service field in the IP header.
941It is only valid in the
942.B mangle
943table.
Harald Weltebfc33692002-08-07 09:52:22 +0000944.TP
Harald Welte282d6692003-02-14 07:34:09 +0000945.BI "--set-tos " "tos"
946You can use a numeric TOS values, or use
947.br
948 iptables -j TOS -h
949.br
950to see the list of valid TOS names.
951.SS ULOG
952This target provides userspace logging of matching packets. When this
953target is set for a rule, the Linux kernel will multicast this packet
954through a
955.IR netlink
956socket. One or more userspace processes may then subscribe to various
957multicast groups and receive the packets.
958Like LOG, this is a "non-terminating target", i.e. rule traversal
959continues at the next rule.
Harald Weltebfc33692002-08-07 09:52:22 +0000960.TP
Harald Welte282d6692003-02-14 07:34:09 +0000961.BI "--ulog-nlgroup " "nlgroup"
962This specifies the netlink group (1-32) to which the packet is sent.
963Default value is 1.
Harald Weltebfc33692002-08-07 09:52:22 +0000964.TP
Harald Welte282d6692003-02-14 07:34:09 +0000965.BI "--ulog-prefix " "prefix"
966Prefix log messages with the specified prefix; up to 32 characters
967long, and useful for distinguishing messages in the logs.
968.TP
969.BI "--ulog-cprange " "size"
970Number of bytes to be copied to userspace. A value of 0 always copies
971the entire packet, regardless of its size. Default is 0.
972.TP
973.BI "--ulog-qthreshold " "size"
974Number of packet to queue inside kernel. Setting this value to, e.g. 10
975accumulates ten packets inside the kernel and transmits them as one
976netlink multipart message to userspace. Default is 1 (for backwards
977compatibility).
Harald Weltebfc33692002-08-07 09:52:22 +0000978.br
Rusty Russell86573e52000-10-11 06:01:13 +0000979.SH DIAGNOSTICS
980Various error messages are printed to standard error. The exit code
981is 0 for correct functioning. Errors which appear to be caused by
982invalid or abused command line parameters cause an exit code of 2, and
983other errors cause an exit code of 1.
Marc Bouchere6869a82000-03-20 06:03:29 +0000984.SH BUGS
Hervé Eychennecea2ca32002-05-27 11:16:09 +0000985Bugs? What's this? ;-)
Hervé Eychennee644cb02002-06-22 18:23:48 +0000986Well... the counters are not reliable on sparc64.
Marc Bouchere6869a82000-03-20 06:03:29 +0000987.SH COMPATIBILITY WITH IPCHAINS
Harald Welte282d6692003-02-14 07:34:09 +0000988This
Marc Bouchere6869a82000-03-20 06:03:29 +0000989.B iptables
990is very similar to ipchains by Rusty Russell. The main difference is
Harald Welte282d6692003-02-14 07:34:09 +0000991that the chains
Marc Bouchere6869a82000-03-20 06:03:29 +0000992.B INPUT
993and
994.B OUTPUT
995are only traversed for packets coming into the local host and
996originating from the local host respectively. Hence every packet only
997passes through one of the three chains; previously a forwarded packet
998would pass through all three.
999.PP
Harald Welte282d6692003-02-14 07:34:09 +00001000The other main difference is that
Marc Bouchere6869a82000-03-20 06:03:29 +00001001.B -i
1002refers to the input interface;
1003.B -o
1004refers to the output interface, and both are available for packets
1005entering the
1006.B FORWARD
1007chain.
1008.PP The various forms of NAT have been separated out;
1009.B iptables
1010is a pure packet filter when using the default `filter' table, with
1011optional extension modules. This should simplify much of the previous
1012confusion over the combination of IP masquerading and packet filtering
1013seen previously. So the following options are handled differently:
1014.br
1015 -j MASQ
1016.br
1017 -M -S
1018.br
1019 -M -L
1020.br
1021There are several other changes in iptables.
1022.SH SEE ALSO
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001023.BR iptables-save (8),
1024.BR iptables-restore (8),
1025.BR ip6tables (8),
1026.BR ip6tables-save (8),
Harald Welte282d6692003-02-14 07:34:09 +00001027.BR ip6tables-restore (8).
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001028.P
1029The packet-filtering-HOWTO details iptables usage for
1030packet filtering, the NAT-HOWTO details NAT,
1031the netfilter-extensions-HOWTO details the extensions that are
1032not in the standard distribution,
1033and the netfilter-hacking-HOWTO details the netfilter internals.
Hervé Eychenne9e518062002-03-14 09:25:40 +00001034.br
1035See
1036.BR "http://www.netfilter.org/" .
Marc Boucherf127a192000-03-20 08:32:15 +00001037.SH AUTHORS
Marc Bouchere6869a82000-03-20 06:03:29 +00001038Rusty Russell wrote iptables, in early consultation with Michael
1039Neuling.
1040.PP
Marc Boucherf127a192000-03-20 08:32:15 +00001041Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
1042selection framework in iptables, then wrote the mangle table, the owner match,
1043the mark stuff, and ran around doing cool stuff everywhere.
Marc Bouchere6869a82000-03-20 06:03:29 +00001044.PP
1045James Morris wrote the TOS target, and tos match.
1046.PP
1047Jozsef Kadlecsik wrote the REJECT target.
1048.PP
Harald Weltebfc33692002-08-07 09:52:22 +00001049Harald Welte wrote the ULOG target, TTL, DSCP, ECN matches and targets.
Rusty Russell52451822000-08-27 07:47:46 +00001050.PP
Joszef Kadlecsik2c386d22003-05-12 11:38:16 +00001051The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Jozsef Kadlecsik,
1052James Morris, Harald Welte and Rusty Russell.
Hervé Eychenne9e518062002-03-14 09:25:40 +00001053.PP
1054Man page written by Herve Eychenne <rv@wallfire.org>.
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001055
Marc Bouchere6869a82000-03-20 06:03:29 +00001056.\" .. and did I mention that we are incredibly cool people?
Rusty Russell363112d2000-08-11 13:49:26 +00001057.\" .. sexy, too ..
Rusty Russell86573e52000-10-11 06:01:13 +00001058.\" .. witty, charming, powerful ..
James Morris060ae4c2000-10-29 01:29:57 +00001059.\" .. and most of all, modest ..