blob: b79f1ecea28cb614ae6f786474f5ba62d1b85d66 [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é Eychennef3ed8602003-06-29 18:00:08 +000028.BR "iptables [-t table] -[AD] " "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:
Hervé Eychennef3ed8602003-06-29 18:00:08 +000094.RS
95.TP .4i
96.BR "filter" :
Hervé Eychennee644cb02002-06-22 18:23:48 +000097This is the default table (if no -t option is passed). It contains
98the built-in chains
Hervé Eychennecea2ca32002-05-27 11:16:09 +000099.B INPUT
100(for packets coming into the box itself),
101.B FORWARD
102(for packets being routed through the box), and
103.B OUTPUT
104(for locally-generated packets).
Harald Welte87d4be42001-07-05 06:26:37 +0000105.TP
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000106.BR "nat" :
Harald Welte0112abb2001-02-19 21:48:13 +0000107This table is consulted when a packet that creates a new
Hervé Eychennecea2ca32002-05-27 11:16:09 +0000108connection is encountered. It consists of three built-ins:
109.B PREROUTING
110(for altering packets as soon as they come in),
111.B OUTPUT
112(for altering locally-generated packets before routing), and
113.B POSTROUTING
114(for altering packets as they are about to go out).
Harald Welte87d4be42001-07-05 06:26:37 +0000115.TP
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000116.BR "mangle" :
Hervé Eychenne9e518062002-03-14 09:25:40 +0000117This table is used for specialized packet alteration. Until kernel
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001182.4.17 it had two built-in chains:
119.B PREROUTING
120(for altering incoming packets before routing) and
121.B OUTPUT
122(for altering locally-generated packets before routing).
123Since kernel 2.4.18, three other built-in chains are also supported:
124.B INPUT
125(for packets coming into the box itself),
126.B FORWARD
127(for altering packets being routed through the box), and
128.B POSTROUTING
129(for altering packets as they are about to go out).
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000130.RE
Marc Bouchere6869a82000-03-20 06:03:29 +0000131.SH OPTIONS
132The options that are recognized by
133.B iptables
134can be divided into several different groups.
135.SS COMMANDS
Harald Welte0112abb2001-02-19 21:48:13 +0000136These options specify the specific action to perform. Only one of them
137can be specified on the command line unless otherwise specified
Marc Bouchere6869a82000-03-20 06:03:29 +0000138below. For all the long versions of the command and option names, you
Harald Welte0112abb2001-02-19 21:48:13 +0000139need to use only enough letters to ensure that
Marc Bouchere6869a82000-03-20 06:03:29 +0000140.B iptables
141can differentiate it from all other options.
142.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000143.BI "-A, --append " "chain rule-specification"
Marc Bouchere6869a82000-03-20 06:03:29 +0000144Append one or more rules to the end of the selected chain.
145When the source and/or destination names resolve to more than one
146address, a rule will be added for each possible address combination.
147.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000148.BI "-D, --delete " "chain rule-specification"
149.ns
150.TP
151.BI "-D, --delete " "chain rulenum"
Marc Bouchere6869a82000-03-20 06:03:29 +0000152Delete one or more rules from the selected chain. There are two
153versions of this command: the rule can be specified as a number in the
154chain (starting at 1 for the first rule) or a rule to match.
155.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000156.BR "-I, --insert " "\fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP"
Marc Bouchere6869a82000-03-20 06:03:29 +0000157Insert one or more rules in the selected chain as the given rule
158number. So, if the rule number is 1, the rule or rules are inserted
159at the head of the chain. This is also the default if no rule number
160is specified.
161.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000162.BI "-R, --replace " "chain rulenum rule-specification"
163Replace a rule in the selected chain. If the source and/or
164destination names resolve to multiple addresses, the command will
165fail. Rules are numbered starting at 1.
166.TP
167.BR "-L, --list " "[\fIchain\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000168List all rules in the selected chain. If no chain is selected, all
Hervé Eychenne9e518062002-03-14 09:25:40 +0000169chains are listed. As every other iptables command, it applies to the
170specified table (filter is the default), so NAT rules get listed by
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000171.nf
Hervé Eychenne9e518062002-03-14 09:25:40 +0000172 iptables -t nat -n -L
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000173.fi
Hervé Eychenne9e518062002-03-14 09:25:40 +0000174Please note that it is often used with the
175.B -n
176option, in order to avoid long reverse DNS lookups.
177It is legal to specify the
Marc Bouchere6869a82000-03-20 06:03:29 +0000178.B -Z
179(zero) option as well, in which case the chain(s) will be atomically
Harald Welte0112abb2001-02-19 21:48:13 +0000180listed and zeroed. The exact output is affected by the other
Harald Weltebfc33692002-08-07 09:52:22 +0000181arguments given. The exact rules are suppressed until you use
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000182.nf
Harald Weltebfc33692002-08-07 09:52:22 +0000183 iptables -L -v
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000184.fi
Marc Bouchere6869a82000-03-20 06:03:29 +0000185.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000186.BR "-F, --flush " "[\fIchain\fP]"
187Flush the selected chain (all the chains in the table if none is given).
188This is equivalent to deleting all the rules one by one.
Marc Bouchere6869a82000-03-20 06:03:29 +0000189.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000190.BR "-Z, --zero " "[\fIchain\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000191Zero the packet and byte counters in all chains. It is legal to
192specify the
193.B "-L, --list"
194(list) option as well, to see the counters immediately before they are
Harald Welte0112abb2001-02-19 21:48:13 +0000195cleared. (See above.)
Marc Bouchere6869a82000-03-20 06:03:29 +0000196.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000197.BI "-N, --new-chain " "chain"
Harald Welte0112abb2001-02-19 21:48:13 +0000198Create a new user-defined chain by the given name. There must be no
Marc Bouchere6869a82000-03-20 06:03:29 +0000199target of that name already.
200.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000201.BR "-X, --delete-chain " "[\fIchain\fP]"
202Delete the optional user-defined chain specified. There must be no references
Harald Welte0112abb2001-02-19 21:48:13 +0000203to the chain. If there are, you must delete or replace the referring
204rules before the chain can be deleted. If no argument is given, it
Rusty Russell363112d2000-08-11 13:49:26 +0000205will attempt to delete every non-builtin chain in the table.
Marc Bouchere6869a82000-03-20 06:03:29 +0000206.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000207.BI "-P, --policy " "chain target"
Marc Bouchere6869a82000-03-20 06:03:29 +0000208Set the policy for the chain to the given target. See the section
Rusty Russell363112d2000-08-11 13:49:26 +0000209.B TARGETS
Hervé Eychenne9e518062002-03-14 09:25:40 +0000210for the legal targets. Only built-in (non-user-defined) chains can have
211policies, and neither built-in nor user-defined chains can be policy
212targets.
Marc Bouchere6869a82000-03-20 06:03:29 +0000213.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000214.BI "-E, --rename-chain " "old-chain new-chain"
Harald Welte0112abb2001-02-19 21:48:13 +0000215Rename the user specified chain to the user supplied name. This is
Marc Bouchere6869a82000-03-20 06:03:29 +0000216cosmetic, and has no effect on the structure of the table.
Marc Bouchere6869a82000-03-20 06:03:29 +0000217.TP
218.B -h
219Help.
220Give a (currently very brief) description of the command syntax.
221.SS PARAMETERS
222The following parameters make up a rule specification (as used in the
Harald Welte0112abb2001-02-19 21:48:13 +0000223add, delete, insert, replace and append commands).
Marc Bouchere6869a82000-03-20 06:03:29 +0000224.TP
Rusty Russell2e0a3212000-04-19 11:23:18 +0000225.BR "-p, --protocol " "[!] \fIprotocol\fP"
Marc Bouchere6869a82000-03-20 06:03:29 +0000226The protocol of the rule or of the packet to check.
227The specified protocol can be one of
228.IR tcp ,
229.IR udp ,
230.IR icmp ,
231or
232.IR all ,
233or it can be a numeric value, representing one of these protocols or a
Rusty Russell363112d2000-08-11 13:49:26 +0000234different one. A protocol name from /etc/protocols is also allowed.
Marc Bouchere6869a82000-03-20 06:03:29 +0000235A "!" argument before the protocol inverts the
236test. The number zero is equivalent to
237.IR all .
238Protocol
239.I all
240will match with all protocols and is taken as default when this
241option is omitted.
Marc Bouchere6869a82000-03-20 06:03:29 +0000242.TP
243.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
244Source specification.
245.I Address
Hervé Eychenne9e518062002-03-14 09:25:40 +0000246can be either a network name, a hostname (please note that specifying
247any name to be resolved with a remote query such as DNS is a really bad idea),
248a network IP address (with /mask), or a plain IP address.
Marc Bouchere6869a82000-03-20 06:03:29 +0000249The
250.I mask
251can be either a network mask or a plain number,
252specifying the number of 1's at the left side of the network mask.
253Thus, a mask of
254.I 24
255is equivalent to
256.IR 255.255.255.0 .
257A "!" argument before the address specification inverts the sense of
258the address. The flag
259.B --src
Hervé Eychenne9e518062002-03-14 09:25:40 +0000260is an alias for this option.
Marc Bouchere6869a82000-03-20 06:03:29 +0000261.TP
262.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
263Destination specification.
264See the description of the
265.B -s
266(source) flag for a detailed description of the syntax. The flag
267.B --dst
268is an alias for this option.
269.TP
270.BI "-j, --jump " "target"
Harald Welte0112abb2001-02-19 21:48:13 +0000271This specifies the target of the rule; i.e., what to do if the packet
272matches it. The target can be a user-defined chain (other than the
273one this rule is in), one of the special builtin targets which decide
274the fate of the packet immediately, or an extension (see
Marc Bouchere6869a82000-03-20 06:03:29 +0000275.B EXTENSIONS
276below). If this
277option is omitted in a rule, then matching the rule will have no
278effect on the packet's fate, but the counters on the rule will be
279incremented.
280.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000281.BR "-i, --in-interface " "[!] \fIname\fP"
282Name of an interface via which a packet is going to be received (only for
Marc Bouchere6869a82000-03-20 06:03:29 +0000283packets entering the
284.BR INPUT ,
285.B FORWARD
286and
287.B PREROUTING
288chains). When the "!" argument is used before the interface name, the
289sense is inverted. If the interface name ends in a "+", then any
290interface which begins with this name will match. If this option is
Hervé Eychenne9e518062002-03-14 09:25:40 +0000291omitted, any interface name will match.
Marc Bouchere6869a82000-03-20 06:03:29 +0000292.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000293.BR "-o, --out-interface " "[!] \fIname\fP"
294Name of an interface via which a packet is going to be sent (for packets
295entering the
Marc Bouchere6869a82000-03-20 06:03:29 +0000296.BR FORWARD ,
297.B OUTPUT
298and
299.B POSTROUTING
Hervé Eychenne9e518062002-03-14 09:25:40 +0000300chains). When the "!" argument is used before the interface name, the
301sense is inverted. If the interface name ends in a "+", then any
Marc Bouchere6869a82000-03-20 06:03:29 +0000302interface which begins with this name will match. If this option is
Hervé Eychenne9e518062002-03-14 09:25:40 +0000303omitted, any interface name will match.
Marc Bouchere6869a82000-03-20 06:03:29 +0000304.TP
305.B "[!] " "-f, --fragment"
306This means that the rule only refers to second and further fragments
307of fragmented packets. Since there is no way to tell the source or
308destination ports of such a packet (or ICMP type), such a packet will
309not match any rules which specify them. When the "!" argument
Rusty Russell363112d2000-08-11 13:49:26 +0000310precedes the "-f" flag, the rule will only match head fragments, or
311unfragmented packets.
Harald Welteccd49e52001-01-23 22:54:34 +0000312.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000313.BI "-c, --set-counters " "PKTS BYTES"
Fabrice MARIEb0d84602002-06-14 07:39:58 +0000314This enables the administrator to initialize the packet and byte
Harald Welteccd49e52001-01-23 22:54:34 +0000315counters of a rule (during
316.B INSERT,
317.B APPEND,
318.B REPLACE
Hervé Eychenne9e518062002-03-14 09:25:40 +0000319operations).
Marc Bouchere6869a82000-03-20 06:03:29 +0000320.SS "OTHER OPTIONS"
321The following additional options can be specified:
322.TP
323.B "-v, --verbose"
324Verbose output. This option makes the list command show the interface
Harald Weltebfc33692002-08-07 09:52:22 +0000325name, the rule options (if any), and the TOS masks. The packet and
Marc Bouchere6869a82000-03-20 06:03:29 +0000326byte counters are also listed, with the suffix 'K', 'M' or 'G' for
3271000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
328the
329.B -x
330flag to change this).
331For appending, insertion, deletion and replacement, this causes
332detailed information on the rule or rules to be printed.
333.TP
334.B "-n, --numeric"
335Numeric output.
336IP addresses and port numbers will be printed in numeric format.
337By default, the program will try to display them as host names,
338network names, or services (whenever applicable).
339.TP
340.B "-x, --exact"
341Expand numbers.
342Display the exact value of the packet and byte counters,
343instead of only the rounded number in K's (multiples of 1000)
344M's (multiples of 1000K) or G's (multiples of 1000M). This option is
Marc Boucherf127a192000-03-20 08:32:15 +0000345only relevant for the
Marc Bouchere6869a82000-03-20 06:03:29 +0000346.B -L
347command.
348.TP
349.B "--line-numbers"
350When listing rules, add line numbers to the beginning of each rule,
351corresponding to that rule's position in the chain.
Chapman Brad45493a82001-02-23 09:08:13 +0000352.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000353.B "--modprobe=command"
Chapman Brad45493a82001-02-23 09:08:13 +0000354When adding or inserting rules into a chain, use
355.B command
356to load any necessary modules (targets, match extensions, etc).
Marc Bouchere6869a82000-03-20 06:03:29 +0000357.SH MATCH EXTENSIONS
Rusty Russell363112d2000-08-11 13:49:26 +0000358iptables can use extended packet matching modules. These are loaded
359in two ways: implicitly, when
360.B -p
361or
362.B --protocol
363is specified, or with the
364.B -m
365or
366.B --match
367options, followed by the matching module name; after these, various
368extra command line options become available, depending on the specific
Hervé Eychenne9e518062002-03-14 09:25:40 +0000369module. You can specify multiple extended match modules in one line,
370and you can use the
Rusty Russell363112d2000-08-11 13:49:26 +0000371.B -h
372or
373.B --help
374options after the module has been specified to receive help specific
375to that module.
376
377The following are included in the base package, and most of these can
378be preceded by a
Marc Bouchere6869a82000-03-20 06:03:29 +0000379.B !
380to invert the sense of the match.
Harald Welte282d6692003-02-14 07:34:09 +0000381.SS ah
382This module matches the SPIs in AH header of IPSec packets.
Marc Bouchere6869a82000-03-20 06:03:29 +0000383.TP
Harald Welte282d6692003-02-14 07:34:09 +0000384.BR "--ahspi " "[!] \fIspi\fP[:\fIspi\fP]"
Harald Weltebfc33692002-08-07 09:52:22 +0000385.SS conntrack
386This module, when combined with connection tracking, allows access to
387more connection tracking information than the "state" match.
388(this module is present only if iptables was compiled under a kernel
389supporting this feature)
390.TP
391.BI "--ctstate " "state"
392Where state is a comma separated list of the connection states to
Harald Welte282d6692003-02-14 07:34:09 +0000393match. Possible states are
Harald Weltebfc33692002-08-07 09:52:22 +0000394.B INVALID
395meaning that the packet is associated with no known connection,
396.B ESTABLISHED
397meaning that the packet is associated with a connection which has seen
398packets in both directions,
399.B NEW
400meaning that the packet has started a new connection, or otherwise
401associated with a connection which has not seen packets in both
402directions, and
403.B RELATED
404meaning that the packet is starting a new connection, but is
405associated with an existing connection, such as an FTP data transfer,
406or an ICMP error.
407.B SNAT
Harald Welte282d6692003-02-14 07:34:09 +0000408A virtual state, matching if the original source address differs from
Harald Weltebfc33692002-08-07 09:52:22 +0000409the reply destination.
410.B DNAT
Harald Welte282d6692003-02-14 07:34:09 +0000411A virtual state, matching if the original destination differs from the
Harald Weltebfc33692002-08-07 09:52:22 +0000412reply source.
413.TP
414.BI "--ctproto " "proto"
415Protocol to match (by number or name)
416.TP
417.BI "--ctorigsrc " "[!] \fIaddress\fP[/\fImask\fP]"
418Match against original source address
419.TP
420.BI "--ctorigdst " "[!] \fIaddress\fP[/\fImask\fP]"
421Match against original destination address
422.TP
423.BI "--ctreplsrc " "[!] \fIaddress\fP[/\fImask\fP]"
424Match against reply source address
425.TP
426.BI "--ctrepldst " "[!] \fIaddress\fB[/\fImask\fP]"
427Match against reply destination address
428.TP
429.BI "--ctstatus " "[\fINONE|EXPECTED|SEEN_REPLY|ASSURED\fP][,...]"
430Match against internal conntrack states
431.TP
432.BI "--ctexpire " "\fItime\fP[\fI:time\fP]"
433Match remaining lifetime in seconds against given value
434or range of values (inclusive)
435.SS dscp
436This module matches the 6 bit DSCP field within the TOS field in the
437IP header. DSCP has superseded TOS within the IETF.
438.TP
439.BI "--dscp " "value"
440Match against a numeric (decimal or hex) value [0-32].
441.TP
442.BI "--dscp-class " "\fIDiffServ Class\fP"
Harald Welte282d6692003-02-14 07:34:09 +0000443Match the DiffServ class. This value may be any of the
Harald Weltebfc33692002-08-07 09:52:22 +0000444BE, EF, AFxx or CSx classes. It will then be converted
445into it's according numeric value.
Harald Welte282d6692003-02-14 07:34:09 +0000446.SS esp
447This module matches the SPIs in ESP header of IPSec packets.
448.TP
449.BR "--espspi " "[!] \fIspi\fP[:\fIspi\fP]"
Hervé Eychenne9230c112003-03-03 22:23:22 +0000450.SS helper
451This module matches packets related to a specific conntrack-helper.
452.TP
453.BI "--helper " "string"
454Matches packets related to the specified conntrack-helper.
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000455.RS
456.PP
Hervé Eychenne9230c112003-03-03 22:23:22 +0000457string can be "ftp" for packets related to a ftp-session on default port.
458For other ports append -portnr to the value, ie. "ftp-2121".
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000459.PP
Hervé Eychenne9230c112003-03-03 22:23:22 +0000460Same rules apply for other conntrack-helpers.
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000461.RE
Harald Welte282d6692003-02-14 07:34:09 +0000462.SS icmp
463This extension is loaded if `--protocol icmp' is specified. It
464provides the following option:
465.TP
466.BR "--icmp-type " "[!] \fItypename\fP"
467This allows specification of the ICMP type, which can be a numeric
468ICMP type, or one of the ICMP type names shown by the command
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000469.nf
Harald Welte282d6692003-02-14 07:34:09 +0000470 iptables -p icmp -h
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000471.fi
Harald Welte282d6692003-02-14 07:34:09 +0000472.SS length
473This module matches the length of a packet against a specific value
474or range of values.
475.TP
476.BR "--length " "\fIlength\fP[:\fIlength\fP]"
477.SS limit
478This module matches at a limited rate using a token bucket filter.
479A rule using this extension will match until this limit is reached
480(unless the `!' flag is used). It can be used in combination with the
481.B LOG
482target to give limited logging, for example.
483.TP
484.BI "--limit " "rate"
485Maximum average matching rate: specified as a number, with an optional
486`/second', `/minute', `/hour', or `/day' suffix; the default is
4873/hour.
488.TP
489.BI "--limit-burst " "number"
490Maximum initial number of packets to match: this number gets
491recharged by one every time the limit specified above is not reached,
492up to this number; the default is 5.
493.SS mac
494.TP
495.BR "--mac-source " "[!] \fIaddress\fP"
496Match source MAC address. It must be of the form XX:XX:XX:XX:XX:XX.
497Note that this only makes sense for packets coming from an Ethernet device
498and entering the
499.BR PREROUTING ,
500.B FORWARD
501or
502.B INPUT
503chains.
504.SS mark
505This module matches the netfilter mark field associated with a packet
506(which can be set using the
507.B MARK
508target below).
509.TP
510.BR "--mark " "\fIvalue\fP[/\fImask\fP]"
511Matches packets with the given unsigned mark value (if a mask is
512specified, this is logically ANDed with the mask before the
513comparison).
514.SS multiport
515This module matches a set of source or destination ports. Up to 15
516ports can be specified. It can only be used in conjunction with
517.B "-p tcp"
518or
519.BR "-p udp" .
520.TP
521.BR "--source-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
522Match if the source port is one of the given ports. The flag
523.B --sports
524is a convenient alias for this option.
525.TP
526.BR "--destination-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
527Match if the destination port is one of the given ports. The flag
528.B --dports
529is a convenient alias for this option.
530.TP
531.BR "--ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
532Match if the both the source and destination ports are equal to each
533other and to one of the given ports.
534.SS owner
535This module attempts to match various characteristics of the packet
536creator, for locally-generated packets. It is only valid in the
537.B OUTPUT
538chain, and even this some packets (such as ICMP ping responses) may
539have no owner, and hence never match.
540.TP
541.BI "--uid-owner " "userid"
542Matches if the packet was created by a process with the given
543effective user id.
544.TP
545.BI "--gid-owner " "groupid"
546Matches if the packet was created by a process with the given
547effective group id.
548.TP
549.BI "--pid-owner " "processid"
550Matches if the packet was created by a process with the given
551process id.
552.TP
553.BI "--sid-owner " "sessionid"
554Matches if the packet was created by a process in the given session
555group.
556.TP
557.BI "--cmd-owner " "name"
558Matches if the packet was created by a process with the given command name.
559(this option is present only if iptables was compiled under a kernel
560supporting this feature)
561.SS physdev
562This module matches on the bridge port input and output devices enslaved
Bart De Schuymer30596a52003-04-27 10:01:44 +0000563to a bridge device. This module is a part of the infrastructure that enables
Harald Welte282d6692003-02-14 07:34:09 +0000564a transparent bridging IP firewall and is only useful for kernel versions
565above version 2.5.44.
566.TP
567.B --physdev-in name
568Name of a bridge port via which a packet is received (only for
569packets entering the
570.BR INPUT ,
571.B FORWARD
572and
573.B PREROUTING
574chains). If the interface name ends in a "+", then any
Bart De Schuymer30596a52003-04-27 10:01:44 +0000575interface which begins with this name will match. If the packet didn't arrive
576through a bridge device, this packet won't match this option, unless '!' is used.
Harald Welte282d6692003-02-14 07:34:09 +0000577.TP
578.B --physdev-out name
579Name of a bridge port via which a packet is going to be sent (for packets
580entering the
581.BR FORWARD ,
582.B OUTPUT
583and
584.B POSTROUTING
585chains). If the interface name ends in a "+", then any
586interface which begins with this name will match. Note that in the
587.BR nat " and " mangle
588.B OUTPUT
589chains one cannot match on the bridge output port, however one can in the
590.B "filter OUTPUT"
Bart De Schuymer30596a52003-04-27 10:01:44 +0000591chain. If the packet won't leave by a bridge device or it is yet unknown what
592the output device will be, then the packet won't match this option, unless
593'!' is used.
594.TP
595.B --physdev-is-in
596Matches if the packet has entered through a bridge interface.
597.TP
598.B --physdev-is-out
599Matches if the packet will leave through a bridge interface.
600.TP
601.B --physdev-is-bridged
602Matches if the packet is being bridged and therefore is not being routed.
603This is only useful in the FORWARD and POSTROUTING chains.
Harald Weltebfc33692002-08-07 09:52:22 +0000604.SS pkttype
605This module matches the link-layer packet type.
606.TP
607.BI "--pkt-type " "[\fIunicast\fP|\fIbroadcast\fP|\fImulticast\fP]"
Harald Welte282d6692003-02-14 07:34:09 +0000608.SS state
609This module, when combined with connection tracking, allows access to
610the connection tracking state for this packet.
611.TP
612.BI "--state " "state"
613Where state is a comma separated list of the connection states to
614match. Possible states are
615.B INVALID
Cedric Blancherdfb0a582003-06-29 17:35:03 +0000616meaning that the packet could not be identified for some reason which
617includes running out of memory and ICMP errors which don't correspond to any
618known connection,
Harald Welte282d6692003-02-14 07:34:09 +0000619.B ESTABLISHED
620meaning that the packet is associated with a connection which has seen
621packets in both directions,
622.B NEW
623meaning that the packet has started a new connection, or otherwise
624associated with a connection which has not seen packets in both
625directions, and
626.B RELATED
627meaning that the packet is starting a new connection, but is
628associated with an existing connection, such as an FTP data transfer,
629or an ICMP error.
630.SS tcp
631These extensions are loaded if `--protocol tcp' is specified. It
632provides the following options:
633.TP
634.BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
635Source port or port range specification. This can either be a service
636name or a port number. An inclusive range can also be specified,
637using the format
638.IR port : port .
639If the first port is omitted, "0" is assumed; if the last is omitted,
640"65535" is assumed.
641If the second port greater then the first they will be swapped.
642The flag
643.B --sport
644is a convenient alias for this option.
645.TP
646.BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
647Destination port or port range specification. The flag
648.B --dport
649is a convenient alias for this option.
650.TP
651.BR "--tcp-flags " "[!] \fImask\fP \fIcomp\fP"
652Match when the TCP flags are as specified. The first argument is the
653flags which we should examine, written as a comma-separated list, and
654the second argument is a comma-separated list of flags which must be
655set. Flags are:
656.BR "SYN ACK FIN RST URG PSH ALL NONE" .
657Hence the command
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000658.nf
Harald Welte282d6692003-02-14 07:34:09 +0000659 iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000660.fi
Harald Welte282d6692003-02-14 07:34:09 +0000661will only match packets with the SYN flag set, and the ACK, FIN and
662RST flags unset.
663.TP
664.B "[!] --syn"
665Only match TCP packets with the SYN bit set and the ACK and RST bits
666cleared. Such packets are used to request TCP connection initiation;
667for example, blocking such packets coming in an interface will prevent
668incoming TCP connections, but outgoing TCP connections will be
669unaffected.
670It is equivalent to \fB--tcp-flags SYN,RST,ACK SYN\fP.
671If the "!" flag precedes the "--syn", the sense of the
672option is inverted.
673.TP
674.BR "--tcp-option " "[!] \fInumber\fP"
675Match if TCP option set.
676.TP
677.BR "--mss " "\fIvalue\fP[:\fIvalue\fP]"
678Match TCP SYN or SYN/ACK packets with the specified MSS value (or range),
679which control the maximum packet size for that connection.
Marc Bouchere6869a82000-03-20 06:03:29 +0000680.SS tos
681This module matches the 8 bits of Type of Service field in the IP
Harald Welte282d6692003-02-14 07:34:09 +0000682header (ie. including the precedence bits).
Marc Bouchere6869a82000-03-20 06:03:29 +0000683.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000684.BI "--tos " "tos"
Marc Bouchere6869a82000-03-20 06:03:29 +0000685The argument is either a standard name, (use
686.br
687 iptables -m tos -h
688.br
689to see the list), or a numeric value to match.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000690.SS ttl
691This module matches the time to live field in the IP header.
692.TP
693.BI "--ttl " "ttl"
694Matches the given TTL value.
Harald Welte282d6692003-02-14 07:34:09 +0000695.SS udp
696These extensions are loaded if `--protocol udp' is specified. It
697provides the following options:
698.TP
699.BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
700Source port or port range specification.
701See the description of the
702.B --source-port
703option of the TCP extension for details.
704.TP
705.BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
706Destination port or port range specification.
707See the description of the
708.B --destination-port
709option of the TCP extension for details.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000710.SS unclean
711This module takes no options, but attempts to match packets which seem
712malformed or unusual. This is regarded as experimental.
Marc Bouchere6869a82000-03-20 06:03:29 +0000713.SH TARGET EXTENSIONS
714iptables can use extended target modules: the following are included
715in the standard distribution.
Harald Welte282d6692003-02-14 07:34:09 +0000716.SS DNAT
717This target is only valid in the
718.B nat
719table, in the
720.B PREROUTING
721and
722.B OUTPUT
723chains, and user-defined chains which are only called from those
724chains. It specifies that the destination address of the packet
725should be modified (and all future packets in this connection will
726also be mangled), and rules should cease being examined. It takes one
727type of option:
728.TP
729.BR "--to-destination " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
730which can specify a single new destination IP address, an inclusive
731range of IP addresses, and optionally, a port range (which is only
732valid if the rule also specifies
733.B "-p tcp"
734or
735.BR "-p udp" ).
736If no port range is specified, then the destination port will never be
737modified.
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000738.RS
739.PP
Harald Welte282d6692003-02-14 07:34:09 +0000740You can add several --to-destination options. If you specify more
741than one destination address, either via an address range or multiple
742--to-destination options, a simple round-robin (one after another in
743cycle) load balancing takes place between these adresses.
744.SS DSCP
745This target allows to alter the value of the DSCP bits within the TOS
746header of the IPv4 packet. As this manipulates a packet, it can only
747be used in the mangle table.
748.TP
749.BI "--set-dscp " "value"
750Set the DSCP field to a numerical value (can be decimal or hex)
751.TP
752.BI "--set-dscp-class " "class"
753Set the DSCP field to a DiffServ class.
754.SS ECN
755This target allows to selectively work around known ECN blackholes.
756It can only be used in the mangle table.
757.TP
758.BI "--ecn-tcp-remove"
759Remove all ECN bits from the TCP header. Of course, it can only be used
760in conjunction with
761.BR "-p tcp" .
Marc Bouchere6869a82000-03-20 06:03:29 +0000762.SS LOG
763Turn on kernel logging of matching packets. When this option is set
764for a rule, the Linux kernel will print some information on all
Rusty Russell363112d2000-08-11 13:49:26 +0000765matching packets (like most IP header fields) via the kernel log
766(where it can be read with
767.I dmesg
768or
769.IR syslogd (8)).
Hervé Eychenne9e518062002-03-14 09:25:40 +0000770This is a "non-terminating target", i.e. rule traversal continues at
771the next rule. So if you want to LOG the packets you refuse, use two
Hervé Eychennee644cb02002-06-22 18:23:48 +0000772separate rules with the same matching criteria, first using target LOG
Hervé Eychenne9e518062002-03-14 09:25:40 +0000773then DROP (or REJECT).
Marc Bouchere6869a82000-03-20 06:03:29 +0000774.TP
775.BI "--log-level " "level"
776Level of logging (numeric or see \fIsyslog.conf\fP(5)).
777.TP
778.BI "--log-prefix " "prefix"
Rusty Russellf81427e2000-09-13 04:20:38 +0000779Prefix log messages with the specified prefix; up to 29 letters long,
Marc Bouchere6869a82000-03-20 06:03:29 +0000780and useful for distinguishing messages in the logs.
781.TP
782.B --log-tcp-sequence
783Log TCP sequence numbers. This is a security risk if the log is
784readable by users.
785.TP
786.B --log-tcp-options
787Log options from the TCP packet header.
788.TP
789.B --log-ip-options
790Log options from the IP packet header.
791.SS MARK
792This is used to set the netfilter mark value associated with the
793packet. It is only valid in the
794.B mangle
Hervé Eychenne9e518062002-03-14 09:25:40 +0000795table. It can for example be used in conjunction with iproute2.
Marc Bouchere6869a82000-03-20 06:03:29 +0000796.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000797.BI "--set-mark " "mark"
Harald Welte282d6692003-02-14 07:34:09 +0000798.SS MASQUERADE
799This target is only valid in the
800.B nat
801table, in the
802.B POSTROUTING
803chain. It should only be used with dynamically assigned IP (dialup)
804connections: if you have a static IP address, you should use the SNAT
805target. Masquerading is equivalent to specifying a mapping to the IP
806address of the interface the packet is going out, but also has the
807effect that connections are
808.I forgotten
809when the interface goes down. This is the correct behavior when the
810next dialup is unlikely to have the same interface address (and hence
811any established connections are lost anyway). It takes one option:
812.TP
813.BR "--to-ports " "\fIport\fP[-\fIport\fP]"
814This specifies a range of source ports to use, overriding the default
815.B SNAT
816source port-selection heuristics (see above). This is only valid
817if the rule also specifies
818.B "-p tcp"
819or
820.BR "-p udp" .
821.SS MIRROR
822This is an experimental demonstration target which inverts the source
823and destination fields in the IP header and retransmits the packet.
824It is only valid in the
825.BR INPUT ,
826.B FORWARD
827and
828.B PREROUTING
829chains, and user-defined chains which are only called from those
830chains. Note that the outgoing packets are
831.B NOT
832seen by any packet filtering chains, connection tracking or NAT, to
833avoid loops and other problems.
834.SS REDIRECT
835This target is only valid in the
836.B nat
837table, in the
838.B PREROUTING
839and
840.B OUTPUT
841chains, and user-defined chains which are only called from those
842chains. It alters the destination IP address to send the packet to
843the machine itself (locally-generated packets are mapped to the
844127.0.0.1 address). It takes one option:
845.TP
846.BR "--to-ports " "\fIport\fP[-\fIport\fP]"
847This specifies a destination port or range of ports to use: without
848this, the destination port is never altered. This is only valid
849if the rule also specifies
850.B "-p tcp"
851or
852.BR "-p udp" .
Marc Bouchere6869a82000-03-20 06:03:29 +0000853.SS REJECT
854This is used to send back an error packet in response to the matched
Harald Welte282d6692003-02-14 07:34:09 +0000855packet: otherwise it is equivalent to
Hervé Eychenne9e518062002-03-14 09:25:40 +0000856.B DROP
857so it is a terminating TARGET, ending rule traversal.
Marc Bouchere6869a82000-03-20 06:03:29 +0000858This target is only valid in the
859.BR INPUT ,
860.B FORWARD
861and
862.B OUTPUT
Rusty Russell9cadb432000-05-10 00:18:06 +0000863chains, and user-defined chains which are only called from those
Hervé Eychenne9e518062002-03-14 09:25:40 +0000864chains. The following option controls the nature of the error packet
Marc Bouchere6869a82000-03-20 06:03:29 +0000865returned:
866.TP
Bert Hubert20ecf7a2000-03-24 01:56:37 +0000867.BI "--reject-with " "type"
Harald Welte282d6692003-02-14 07:34:09 +0000868The type given can be
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000869.nf
870.B " icmp-net-unreachable"
871.B " icmp-host-unreachable"
872.B " icmp-port-unreachable"
873.B " icmp-proto-unreachable"
874.B " icmp-net-prohibited"
875.B " icmp-host-prohibited or"
876.B " icmp-admin-prohibited (*)"
877.fi
Hervé Eychenne9e518062002-03-14 09:25:40 +0000878which return the appropriate ICMP error message (\fBport-unreachable\fP is
879the default). The option
Rusty Russell14f390f2000-07-30 01:10:04 +0000880.B tcp-reset
Rusty Russell363112d2000-08-11 13:49:26 +0000881can be used on rules which only match the TCP protocol: this causes a
882TCP RST packet to be sent back. This is mainly useful for blocking
883.I ident
Hervé Eychenne9e518062002-03-14 09:25:40 +0000884(113/tcp) probes which frequently occur when sending mail to broken mail
885hosts (which won't accept your mail otherwise).
Harald Welte5a52c512003-05-24 11:44:18 +0000886.TP
887(*) 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 +0000888.SS SNAT
Harald Welte282d6692003-02-14 07:34:09 +0000889This target is only valid in the
Marc Bouchere6869a82000-03-20 06:03:29 +0000890.B nat
Harald Welte282d6692003-02-14 07:34:09 +0000891table, in the
Marc Bouchere6869a82000-03-20 06:03:29 +0000892.B POSTROUTING
893chain. It specifies that the source address of the packet should be
894modified (and all future packets in this connection will also be
Hervé Eychennee644cb02002-06-22 18:23:48 +0000895mangled), and rules should cease being examined. It takes one type
896of option:
Marc Bouchere6869a82000-03-20 06:03:29 +0000897.TP
Hervé Eychenne9e518062002-03-14 09:25:40 +0000898.BR "--to-source " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
Marc Bouchere6869a82000-03-20 06:03:29 +0000899which can specify a single new source IP address, an inclusive range
900of IP addresses, and optionally, a port range (which is only valid if
901the rule also specifies
902.B "-p tcp"
903or
904.BR "-p udp" ).
905If no port range is specified, then source ports below 512 will be
Harald Welte0112abb2001-02-19 21:48:13 +0000906mapped to other ports below 512: those between 512 and 1023 inclusive
907will be mapped to ports below 1024, and other ports will be mapped to
9081024 or above. Where possible, no port alteration will occur.
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000909.RS
910.PP
Hervé Eychennee644cb02002-06-22 18:23:48 +0000911You can add several --to-source options. If you specify more
912than one source address, either via an address range or multiple
913--to-source options, a simple round-robin (one after another in
914cycle) takes place between these adresses.
Hervé Eychenne9e518062002-03-14 09:25:40 +0000915.SS TCPMSS
916This target allows to alter the MSS value of TCP SYN packets, to control
917the maximum size for that connection (usually limiting it to your
Hervé Eychennecea2ca32002-05-27 11:16:09 +0000918outgoing interface's MTU minus 40). Of course, it can only be used
Hervé Eychenne9e518062002-03-14 09:25:40 +0000919in conjunction with
920.BR "-p tcp" .
921.br
922This target is used to overcome criminally braindead ISPs or servers
923which block ICMP Fragmentation Needed packets. The symptoms of this
924problem are that everything works fine from your Linux
925firewall/router, but machines behind it can never exchange large
926packets:
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000927.PD 0
928.RS 0.1i
929.TP 0.3i
9301)
931Web browsers connect, then hang with no data received.
932.TP
9332)
934Small mail works fine, but large emails hang.
935.TP
9363)
937ssh works fine, but scp hangs after initial handshaking.
938.RE
939.PD
Hervé Eychenne9e518062002-03-14 09:25:40 +0000940Workaround: activate this option and add a rule to your firewall
941configuration like:
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000942.nf
Hervé Eychenne9e518062002-03-14 09:25:40 +0000943 iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN \\
Hervé Eychenne9e518062002-03-14 09:25:40 +0000944 -j TCPMSS --clamp-mss-to-pmtu
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000945.fi
Hervé Eychenne9e518062002-03-14 09:25:40 +0000946.TP
947.BI "--set-mss " "value"
948Explicitly set MSS option to specified value.
949.TP
950.B "--clamp-mss-to-pmtu"
951Automatically clamp MSS value to (path_MTU - 40).
952.TP
953These options are mutually exclusive.
Harald Welte282d6692003-02-14 07:34:09 +0000954.SS TOS
955This is used to set the 8-bit Type of Service field in the IP header.
956It is only valid in the
957.B mangle
958table.
Harald Weltebfc33692002-08-07 09:52:22 +0000959.TP
Harald Welte282d6692003-02-14 07:34:09 +0000960.BI "--set-tos " "tos"
961You can use a numeric TOS values, or use
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000962.nf
Harald Welte282d6692003-02-14 07:34:09 +0000963 iptables -j TOS -h
Hervé Eychennef3ed8602003-06-29 18:00:08 +0000964.fi
Harald Welte282d6692003-02-14 07:34:09 +0000965to see the list of valid TOS names.
966.SS ULOG
967This target provides userspace logging of matching packets. When this
968target is set for a rule, the Linux kernel will multicast this packet
969through a
970.IR netlink
971socket. One or more userspace processes may then subscribe to various
972multicast groups and receive the packets.
973Like LOG, this is a "non-terminating target", i.e. rule traversal
974continues at the next rule.
Harald Weltebfc33692002-08-07 09:52:22 +0000975.TP
Harald Welte282d6692003-02-14 07:34:09 +0000976.BI "--ulog-nlgroup " "nlgroup"
977This specifies the netlink group (1-32) to which the packet is sent.
978Default value is 1.
Harald Weltebfc33692002-08-07 09:52:22 +0000979.TP
Harald Welte282d6692003-02-14 07:34:09 +0000980.BI "--ulog-prefix " "prefix"
981Prefix log messages with the specified prefix; up to 32 characters
982long, and useful for distinguishing messages in the logs.
983.TP
984.BI "--ulog-cprange " "size"
985Number of bytes to be copied to userspace. A value of 0 always copies
986the entire packet, regardless of its size. Default is 0.
987.TP
988.BI "--ulog-qthreshold " "size"
989Number of packet to queue inside kernel. Setting this value to, e.g. 10
990accumulates ten packets inside the kernel and transmits them as one
991netlink multipart message to userspace. Default is 1 (for backwards
992compatibility).
Harald Weltebfc33692002-08-07 09:52:22 +0000993.br
Rusty Russell86573e52000-10-11 06:01:13 +0000994.SH DIAGNOSTICS
995Various error messages are printed to standard error. The exit code
996is 0 for correct functioning. Errors which appear to be caused by
997invalid or abused command line parameters cause an exit code of 2, and
998other errors cause an exit code of 1.
Marc Bouchere6869a82000-03-20 06:03:29 +0000999.SH BUGS
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001000Bugs? What's this? ;-)
Hervé Eychennee644cb02002-06-22 18:23:48 +00001001Well... the counters are not reliable on sparc64.
Marc Bouchere6869a82000-03-20 06:03:29 +00001002.SH COMPATIBILITY WITH IPCHAINS
Harald Welte282d6692003-02-14 07:34:09 +00001003This
Marc Bouchere6869a82000-03-20 06:03:29 +00001004.B iptables
1005is very similar to ipchains by Rusty Russell. The main difference is
Harald Welte282d6692003-02-14 07:34:09 +00001006that the chains
Marc Bouchere6869a82000-03-20 06:03:29 +00001007.B INPUT
1008and
1009.B OUTPUT
1010are only traversed for packets coming into the local host and
1011originating from the local host respectively. Hence every packet only
Hervé Eychennef3ed8602003-06-29 18:00:08 +00001012passes through one of the three chains (except loopback traffic, which
1013involves both INPUT and OUTPUT chains); previously a forwarded packet
Marc Bouchere6869a82000-03-20 06:03:29 +00001014would pass through all three.
1015.PP
Harald Welte282d6692003-02-14 07:34:09 +00001016The other main difference is that
Marc Bouchere6869a82000-03-20 06:03:29 +00001017.B -i
1018refers to the input interface;
1019.B -o
1020refers to the output interface, and both are available for packets
1021entering the
1022.B FORWARD
1023chain.
1024.PP The various forms of NAT have been separated out;
1025.B iptables
1026is a pure packet filter when using the default `filter' table, with
1027optional extension modules. This should simplify much of the previous
1028confusion over the combination of IP masquerading and packet filtering
1029seen previously. So the following options are handled differently:
Hervé Eychennef3ed8602003-06-29 18:00:08 +00001030.nf
Marc Bouchere6869a82000-03-20 06:03:29 +00001031 -j MASQ
Marc Bouchere6869a82000-03-20 06:03:29 +00001032 -M -S
Marc Bouchere6869a82000-03-20 06:03:29 +00001033 -M -L
Hervé Eychennef3ed8602003-06-29 18:00:08 +00001034.fi
Marc Bouchere6869a82000-03-20 06:03:29 +00001035There are several other changes in iptables.
1036.SH SEE ALSO
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001037.BR iptables-save (8),
1038.BR iptables-restore (8),
1039.BR ip6tables (8),
1040.BR ip6tables-save (8),
Harald Welte282d6692003-02-14 07:34:09 +00001041.BR ip6tables-restore (8).
Hervé Eychennecea2ca32002-05-27 11:16:09 +00001042.P
1043The packet-filtering-HOWTO details iptables usage for
1044packet filtering, the NAT-HOWTO details NAT,
1045the netfilter-extensions-HOWTO details the extensions that are
1046not in the standard distribution,
1047and the netfilter-hacking-HOWTO details the netfilter internals.
Hervé Eychenne9e518062002-03-14 09:25:40 +00001048.br
1049See
1050.BR "http://www.netfilter.org/" .
Marc Boucherf127a192000-03-20 08:32:15 +00001051.SH AUTHORS
Marc Bouchere6869a82000-03-20 06:03:29 +00001052Rusty Russell wrote iptables, in early consultation with Michael
1053Neuling.
1054.PP
Marc Boucherf127a192000-03-20 08:32:15 +00001055Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
1056selection framework in iptables, then wrote the mangle table, the owner match,
1057the mark stuff, and ran around doing cool stuff everywhere.
Marc Bouchere6869a82000-03-20 06:03:29 +00001058.PP
1059James Morris wrote the TOS target, and tos match.
1060.PP
1061Jozsef Kadlecsik wrote the REJECT target.
1062.PP
Harald Weltebfc33692002-08-07 09:52:22 +00001063Harald Welte wrote the ULOG target, TTL, DSCP, ECN matches and targets.
Rusty Russell52451822000-08-27 07:47:46 +00001064.PP
Joszef Kadlecsik2c386d22003-05-12 11:38:16 +00001065The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Jozsef Kadlecsik,
1066James Morris, Harald Welte and Rusty Russell.
Hervé Eychenne9e518062002-03-14 09:25:40 +00001067.PP
1068Man page written by Herve Eychenne <rv@wallfire.org>.
Marc Bouchere6869a82000-03-20 06:03:29 +00001069.\" .. and did I mention that we are incredibly cool people?
Rusty Russell363112d2000-08-11 13:49:26 +00001070.\" .. sexy, too ..
Rusty Russell86573e52000-10-11 06:01:13 +00001071.\" .. witty, charming, powerful ..
James Morris060ae4c2000-10-29 01:29:57 +00001072.\" .. and most of all, modest ..