blob: 58b7bfc785b0d4266d808314438f16c72258b275 [file] [log] [blame]
Jan Engelhardt9cf0c002011-07-04 13:02:51 +02001.TH IP6TABLES 8 "" "@PACKAGE_AND_VERSION@" "@PACKAGE_AND_VERSION@"
Henrik Nordstromc2794132004-01-22 15:04:24 +00002.\"
3.\" Man page written by Andras Kis-Szabo <kisza@sch.bme.hu>
4.\" It is based on iptables man page.
5.\"
6.\" iptables page by Herve Eychenne <rv@wallfire.org>
7.\" It is based on ipchains man page.
8.\"
9.\" ipchains page by Paul ``Rusty'' Russell March 1997
10.\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl>
11.\"
12.\" This program is free software; you can redistribute it and/or modify
13.\" it under the terms of the GNU General Public License as published by
14.\" the Free Software Foundation; either version 2 of the License, or
15.\" (at your option) any later version.
16.\"
17.\" This program is distributed in the hope that it will be useful,
18.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
19.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.\" GNU General Public License for more details.
21.\"
22.\" You should have received a copy of the GNU General Public License
23.\" along with this program; if not, write to the Free Software
24.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25.\"
26.\"
27.SH NAME
Jan Engelhardt352ccfb2009-08-20 17:15:22 +020028ip6tables \(em IPv6 packet filter administration
Henrik Nordstromc2794132004-01-22 15:04:24 +000029.SH SYNOPSIS
Stefan Tomanekd59b9db2011-03-08 22:42:51 +010030\fBip6tables\fP [\fB\-t\fP \fItable\fP] {\fB\-A\fP|\fB\-C\fP|\fB\-D\fP}
31\fIchain rule-specification\fP [\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010032.PP
Jan Engelhardt1791a452009-02-20 16:39:54 +010033\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-I\fP \fIchain\fP [\fIrulenum\fP]
Jan Engelhardt0e8984a2009-01-12 07:06:12 +010034\fIrule-specification\fP [\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010035.PP
Jan Engelhardt1791a452009-02-20 16:39:54 +010036\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-R\fP \fIchain rulenum
Jan Engelhardt0e8984a2009-01-12 07:06:12 +010037rule-specification\fP [\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010038.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010039\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-D\fP \fIchain rulenum\fP
40[\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010041.PP
Jan Engelhardt1791a452009-02-20 16:39:54 +010042\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-S\fP [\fIchain\fP [\fIrulenum\fP]]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010043.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010044\fBip6tables\fP [\fB\-t\fP \fItable\fP] {\fB\-F\fP|\fB\-L\fP|\fB\-Z\fP}
Jan Engelhardtfe086ba2009-08-19 22:36:03 +020045[\fIchain\fP [\fIrulenum\fP]] [\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010046.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010047\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-N\fP \fIchain\fP
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010048.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010049\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-X\fP [\fIchain\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010050.PP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010051\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-P\fP \fIchain target\fP
52[\fIoptions...\fP]
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010053.PP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +010054\fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-E\fP \fIold-chain-name new-chain-name\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000055.SH DESCRIPTION
Jan Engelhardt55dffef2008-07-03 20:27:50 +020056\fBIp6tables\fP is used to set up, maintain, and inspect the
57tables of IPv6 packet
Henrik Nordstromc2794132004-01-22 15:04:24 +000058filter rules in the Linux kernel. Several different tables
59may be defined. Each table contains a number of built-in
60chains and may also contain user-defined chains.
Jan Engelhardt0c2b5a42009-01-08 18:04:40 +010061.PP
Henrik Nordstromc2794132004-01-22 15:04:24 +000062Each chain is a list of rules which can match a set of packets. Each
63rule specifies what to do with a packet that matches. This is called
64a `target', which may be a jump to a user-defined chain in the same
65table.
Henrik Nordstromc2794132004-01-22 15:04:24 +000066.SH TARGETS
Jan Engelhardt55dffef2008-07-03 20:27:50 +020067A firewall rule specifies criteria for a packet and a target. If the
Henrik Nordstromc2794132004-01-22 15:04:24 +000068packet does not match, the next rule in the chain is the examined; if
69it does match, then the next rule is specified by the value of the
70target, which can be the name of a user-defined chain or one of the
Jan Engelhardt55dffef2008-07-03 20:27:50 +020071special values \fBACCEPT\fP, \fBDROP\fP, \fBQUEUE\fP or \fBRETURN\fP.
Henrik Nordstromc2794132004-01-22 15:04:24 +000072.PP
Jan Engelhardt55dffef2008-07-03 20:27:50 +020073\fBACCEPT\fP means to let the packet through.
74\fBDROP\fP means to drop the packet on the floor.
75\fBQUEUE\fP means to pass the packet to userspace.
76(How the packet can be received
Harald Welte7bdfca42005-07-28 15:24:02 +000077by a userspace process differs by the particular queue handler. 2.4.x
Jan Engelhardt55dffef2008-07-03 20:27:50 +020078and 2.6.x kernels up to 2.6.13 include the \fBip_queue\fP
79queue handler. Kernels 2.6.14 and later additionally include the
80\fBnfnetlink_queue\fP queue handler. Packets with a target of QUEUE will be
81sent to queue number '0' in this case. Please also see the \fBNFQUEUE\fP
Harald Welte7bdfca42005-07-28 15:24:02 +000082target as described later in this man page.)
Jan Engelhardt55dffef2008-07-03 20:27:50 +020083\fBRETURN\fP means stop traversing this chain and resume at the next
84rule in the
Henrik Nordstromc2794132004-01-22 15:04:24 +000085previous (calling) chain. If the end of a built-in chain is reached
Jan Engelhardt55dffef2008-07-03 20:27:50 +020086or a rule in a built-in chain with target \fBRETURN\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000087is matched, the target specified by the chain policy determines the
88fate of the packet.
89.SH TABLES
Jan Engelhardt55dffef2008-07-03 20:27:50 +020090There are currently three independent tables (which tables are present
Henrik Nordstromc2794132004-01-22 15:04:24 +000091at any time depends on the kernel configuration options and which
Jan Engelhardt55dffef2008-07-03 20:27:50 +020092modules are present).
Henrik Nordstromc2794132004-01-22 15:04:24 +000093.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +010094\fB\-t\fP, \fB\-\-table\fP \fItable\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +000095This option specifies the packet matching table which the command
96should operate on. If the kernel is configured with automatic module
97loading, an attempt will be made to load the appropriate module for
98that table if it is not already there.
99
100The tables are as follows:
101.RS
102.TP .4i
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200103\fBfilter\fP:
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100104This is the default table (if no \-t option is passed). It contains
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200105the built-in chains \fBINPUT\fP (for packets destined to local sockets),
106\fBFORWARD\fP (for packets being routed through the box), and
107\fBOUTPUT\fP (for locally-generated packets).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000108.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200109\fBmangle\fP:
Henrik Nordstromc2794132004-01-22 15:04:24 +0000110This table is used for specialized packet alteration. Until kernel
Jan Engelhardt55dffef2008-07-03 20:27:50 +02001112.4.17 it had two built-in chains: \fBPREROUTING\fP
112(for altering incoming packets before routing) and \fBOUTPUT\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000113(for altering locally-generated packets before routing).
114Since kernel 2.4.18, three other built-in chains are also supported:
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200115\fBINPUT\fP (for packets coming into the box itself), \fBFORWARD\fP
116(for altering packets being routed through the box), and \fBPOSTROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000117(for altering packets as they are about to go out).
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000118.TP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200119\fBraw\fP:
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000120This table is used mainly for configuring exemptions from connection
121tracking in combination with the NOTRACK target. It registers at the netfilter
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200122hooks with higher priority and is thus called before ip_conntrack, or any other
123IP tables. It provides the following built-in chains: \fBPREROUTING\fP
124(for packets arriving via any network interface) \fBOUTPUT\fP
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000125(for packets generated by local processes)
Mark Montaguedf37d992011-04-04 14:54:52 +0200126.TP
127\fBsecurity\fP:
128This table is used for Mandatory Access Control (MAC) networking rules, such
129as those enabled by the \fBSECMARK\fP and \fBCONNSECMARK\fP targets.
130Mandatory Access Control is implemented by Linux Security Modules such as
131SELinux. The security table is called after the filter table, allowing any
132Discretionary Access Control (DAC) rules in the filter table to take effect
133before MAC rules. This table provides the following built-in chains:
134\fBINPUT\fP (for packets coming into the box itself),
135\fBOUTPUT\fP (for altering locally-generated packets before routing), and
136\fBFORWARD\fP (for altering packets being routed through the box).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000137.RE
138.SH OPTIONS
139The options that are recognized by
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200140\fBip6tables\fP can be divided into several different groups.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000141.SS COMMANDS
142These options specify the specific action to perform. Only one of them
143can be specified on the command line unless otherwise specified
144below. For all the long versions of the command and option names, you
145need to use only enough letters to ensure that
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200146\fBip6tables\fP can differentiate it from all other options.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000147.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100148\fB\-A\fP, \fB\-\-append\fP \fIchain rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000149Append one or more rules to the end of the selected chain.
150When the source and/or destination names resolve to more than one
151address, a rule will be added for each possible address combination.
152.TP
Stefan Tomanekd59b9db2011-03-08 22:42:51 +0100153\fB\-C\fP, \fB\-\-check\fP \fIchain rule-specification\fP
154Check whether a rule matching the specification does exist in the
155selected chain. This command uses the same logic as \fB\-D\fP to
156find a matching entry, but does not alter the existing iptables
157configuration and uses its exit code to indicate success or failure.
158.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100159\fB\-D\fP, \fB\-\-delete\fP \fIchain rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000160.ns
161.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100162\fB\-D\fP, \fB\-\-delete\fP \fIchain rulenum\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000163Delete one or more rules from the selected chain. There are two
164versions of this command: the rule can be specified as a number in the
165chain (starting at 1 for the first rule) or a rule to match.
166.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100167\fB\-I\fP, \fB\-\-insert\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000168Insert one or more rules in the selected chain as the given rule
169number. So, if the rule number is 1, the rule or rules are inserted
170at the head of the chain. This is also the default if no rule number
171is specified.
172.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100173\fB\-R\fP, \fB\-\-replace\fP \fIchain rulenum rule-specification\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000174Replace a rule in the selected chain. If the source and/or
175destination names resolve to multiple addresses, the command will
176fail. Rules are numbered starting at 1.
177.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100178\fB\-L\fP, \fB\-\-list\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000179List all rules in the selected chain. If no chain is selected, all
Jan Engelhardtd9842a62008-07-30 12:49:47 +0200180chains are listed. Like every other ip6tables command, it applies to the
Jan Engelhardt9c6ff6b2008-09-08 15:42:41 +0200181specified table (filter is the default).
182.IP ""
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100183Please note that it is often used with the \fB\-n\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000184option, in order to avoid long reverse DNS lookups.
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100185It is legal to specify the \fB\-Z\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000186(zero) option as well, in which case the chain(s) will be atomically
187listed and zeroed. The exact output is affected by the other
188arguments given. The exact rules are suppressed until you use
189.nf
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100190 ip6tables \-L \-v
Henrik Nordstromc2794132004-01-22 15:04:24 +0000191.fi
192.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100193\fB\-S\fP, \fB\-\-list\-rules\fP [\fIchain\fP]
Henrik Nordstrom96296cf2008-05-13 13:08:26 +0200194Print all rules in the selected chain. If no chain is selected, all
Jan Engelhardt352ccfb2009-08-20 17:15:22 +0200195chains are printed like ip6tables-save. Like every other ip6tables command,
Henrik Nordstrom96296cf2008-05-13 13:08:26 +0200196it applies to the specified table (filter is the default).
197.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100198\fB\-F\fP, \fB\-\-flush\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000199Flush the selected chain (all the chains in the table if none is given).
200This is equivalent to deleting all the rules one by one.
201.TP
Jan Engelhardtfe086ba2009-08-19 22:36:03 +0200202\fB\-Z\fP, \fB\-\-zero\fP [\fIchain\fP [\fIrulenum\fP]]
203Zero the packet and byte counters in all chains, or only the given chain,
204or only the given rule in a chain. It is legal to
Henrik Nordstromc2794132004-01-22 15:04:24 +0000205specify the
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100206\fB\-L\fP, \fB\-\-list\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000207(list) option as well, to see the counters immediately before they are
208cleared. (See above.)
209.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100210\fB\-N\fP, \fB\-\-new\-chain\fP \fIchain\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000211Create a new user-defined chain by the given name. There must be no
212target of that name already.
213.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100214\fB\-X\fP, \fB\-\-delete\-chain\fP [\fIchain\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000215Delete the optional user-defined chain specified. There must be no references
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200216to the chain. If there are, you must delete or replace the referring rules
217before the chain can be deleted. The chain must be empty, i.e. not contain
218any rules. If no argument is given, it will attempt to delete every
219non-builtin chain in the table.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000220.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100221\fB\-P\fP, \fB\-\-policy\fP \fIchain target\fP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200222Set the policy for the chain to the given target. See the section \fBTARGETS\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000223for the legal targets. Only built-in (non-user-defined) chains can have
224policies, and neither built-in nor user-defined chains can be policy
225targets.
226.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100227\fB\-E\fP, \fB\-\-rename\-chain\fP \fIold\-chain new\-chain\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000228Rename the user specified chain to the user supplied name. This is
229cosmetic, and has no effect on the structure of the table.
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100230.TP
231\fB\-A\fP, \fB\-\-append\fP \fIchain rule-specification\fP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200232Append one or more rules to the end of the selected chain.
233When the source and/or destination names resolve to more than one
234address, a rule will be added for each possible address combination.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000235.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100236\fB\-h\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000237Help.
238Give a (currently very brief) description of the command syntax.
239.SS PARAMETERS
240The following parameters make up a rule specification (as used in the
241add, delete, insert, replace and append commands).
242.TP
Jan Engelhardt983196c2012-12-25 13:11:28 +0000243\fB\-4\fP, \fB\-\-ipv4\fP
244If a rule using the \fB\-4\fP option is inserted with (and only with)
245ip6tables-restore, it will be silently ignored. Any other uses will throw an
246error. This option allows to put both IPv4 and IPv6 rules in a single rule file
247for use with both iptables-restore and ip6tables-restore.
248.TP
249\fB\-6\fP, \fB\-\-ipv6\fP
250This option has no effect in ip6tables and ip6tables-restore.
251.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100252[\fB!\fP] \fB\-p\fP, \fB\-\-protocol\fP \fIprotocol\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000253The protocol of the rule or of the packet to check.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200254The specified protocol can be one of \fBtcp\fP, \fBudp\fP, \fBudplite\fP,
Jan Engelhardt10345ca2011-05-21 00:58:44 +0200255\fBicmpv6\fP, \fBesp\fP, \fBmh\fP or the special keyword "\fBall\fP",
Henrik Nordstromc2794132004-01-22 15:04:24 +0000256or it can be a numeric value, representing one of these protocols or a
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000257different one. A protocol name from /etc/protocols is also allowed.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200258But IPv6 extension headers except \fBesp\fP are not allowed.
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100259\fBesp\fP and \fBipv6\-nonext\fP
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000260can be used with Kernel version 2.6.11 or later.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000261A "!" argument before the protocol inverts the
Jan Engelhardt70af5592011-12-18 02:44:05 +0100262test. The number zero is equivalent to \fBall\fP, which means that you cannot
263test the protocol field for the value 0 directly. To match on a HBH header,
264even if it were the last, you cannot use \fB\-p 0\fP, but always need
265\fB\-m hbh\fP.
266"\fBall\fP"
Henrik Nordstromc2794132004-01-22 15:04:24 +0000267will match with all protocols and is taken as default when this
268option is omitted.
269.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100270[\fB!\fP] \fB\-s\fP, \fB\-\-source\fP \fIaddress\fP[\fB/\fP\fImask\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000271Source specification.
Jan Engelhardt1bd2f0a2009-11-18 00:00:37 +0100272\fIAddress\fP can be either be a hostname,
273a network IP address (with \fB/\fP\fImask\fP), or a plain IP address.
274Names will be resolved once only, before the rule is submitted to the kernel.
275Please note that specifying any name to be resolved with a remote query such as
276DNS is a really bad idea.
277(Resolving network names is not supported at this time.)
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200278The \fImask\fP is a plain number,
Henrik Nordstromc2794132004-01-22 15:04:24 +0000279specifying the number of 1's at the left side of the network mask.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000280A "!" argument before the address specification inverts the sense of
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100281the address. The flag \fB\-\-src\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000282is an alias for this option.
Michael Granzow332e4ac2009-04-09 18:24:36 +0100283Multiple addresses can be specified, but this will \fBexpand to multiple
284rules\fP (when adding with \-A), or will cause multiple rules to be
285deleted (with \-D).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000286.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100287[\fB!\fP] \fB\-d\fP, \fB\-\-destination\fP \fIaddress\fP[\fB/\fP\fImask\fP]
Henrik Nordstromc2794132004-01-22 15:04:24 +0000288Destination specification.
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100289See the description of the \fB\-s\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000290(source) flag for a detailed description of the syntax. The flag
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100291\fB\-\-dst\fP is an alias for this option.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000292.TP
Jan Engelhardtdb1414e2012-12-25 13:11:27 +0000293\fB\-m\fP, \fB\-\-match\fP \fImatch\fP
294Specifies a match to use, that is, an extension module that tests for a
295specific property. The set of matches make up the condition under which a
296target is invoked. Matches are evaluated first to last as specified on the
297command line and work in short-circuit fashion, i.e. if one extension yields
298false, evaluation will stop.
299.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100300\fB\-j\fP, \fB\-\-jump\fP \fItarget\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000301This specifies the target of the rule; i.e., what to do if the packet
302matches it. The target can be a user-defined chain (other than the
303one this rule is in), one of the special builtin targets which decide
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200304the fate of the packet immediately, or an extension (see \fBEXTENSIONS\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000305below). If this
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100306option is omitted in a rule (and \fB\-g\fP
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200307is not used), then matching the rule will have no
Henrik Nordstromc2794132004-01-22 15:04:24 +0000308effect on the packet's fate, but the counters on the rule will be
309incremented.
310.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100311\fB\-g\fP, \fB\-\-goto\fP \fIchain\fP
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200312This specifies that the processing should continue in a user
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100313specified chain. Unlike the \-\-jump option return will not continue
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200314processing in this chain but instead in the chain that called us via
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100315\-\-jump.
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200316.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100317[\fB!\fP] \fB\-i\fP, \fB\-\-in\-interface\fP \fIname\fP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200318Name of an interface via which a packet was received (only for
319packets entering the \fBINPUT\fP, \fBFORWARD\fP and \fBPREROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000320chains). When the "!" argument is used before the interface name, the
321sense is inverted. If the interface name ends in a "+", then any
322interface which begins with this name will match. If this option is
323omitted, any interface name will match.
324.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100325[\fB!\fP] \fB\-o\fP, \fB\-\-out\-interface\fP \fIname\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000326Name of an interface via which a packet is going to be sent (for packets
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200327entering the \fBFORWARD\fP, \fBOUTPUT\fP and \fBPOSTROUTING\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000328chains). When the "!" argument is used before the interface name, the
329sense is inverted. If the interface name ends in a "+", then any
330interface which begins with this name will match. If this option is
331omitted, any interface name will match.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000332.\" Currently not supported (header-based)
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200333.\" .TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100334.\" [\fB!\fP] \fB\-f\fP, \fB\-\-fragment\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000335.\" This means that the rule only refers to second and further fragments
336.\" of fragmented packets. Since there is no way to tell the source or
337.\" destination ports of such a packet (or ICMP type), such a packet will
338.\" not match any rules which specify them. When the "!" argument
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100339.\" precedes the "\-f" flag, the rule will only match head fragments, or
Henrik Nordstromc2794132004-01-22 15:04:24 +0000340.\" unfragmented packets.
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200341.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100342\fB\-c\fP, \fB\-\-set\-counters\fP \fIpackets bytes\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000343This enables the administrator to initialize the packet and byte
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200344counters of a rule (during \fBINSERT\fP, \fBAPPEND\fP, \fBREPLACE\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000345operations).
346.SS "OTHER OPTIONS"
347The following additional options can be specified:
348.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100349\fB\-v\fP, \fB\-\-verbose\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000350Verbose output. This option makes the list command show the interface
351name, the rule options (if any), and the TOS masks. The packet and
352byte counters are also listed, with the suffix 'K', 'M' or 'G' for
3531000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100354the \fB\-x\fP flag to change this).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000355For appending, insertion, deletion and replacement, this causes
Jan Engelhardt1c9508e2011-06-30 13:19:15 +0200356detailed information on the rule or rules to be printed. \fB\-v\fP may be
357specified multiple times to possibly emit more detailed debug statements.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000358.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100359\fB\-n\fP, \fB\-\-numeric\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000360Numeric output.
361IP addresses and port numbers will be printed in numeric format.
362By default, the program will try to display them as host names,
363network names, or services (whenever applicable).
364.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100365\fB\-x\fP, \fB\-\-exact\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000366Expand numbers.
367Display the exact value of the packet and byte counters,
368instead of only the rounded number in K's (multiples of 1000)
369M's (multiples of 1000K) or G's (multiples of 1000M). This option is
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100370only relevant for the \fB\-L\fP command.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000371.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100372\fB\-\-line\-numbers\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000373When listing rules, add line numbers to the beginning of each rule,
374corresponding to that rule's position in the chain.
375.TP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100376\fB\-\-modprobe=\fP\fIcommand\fP
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200377When adding or inserting rules into a chain, use \fIcommand\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000378to load any necessary modules (targets, match extensions, etc).
379.SH MATCH EXTENSIONS
Jan Engelhardt70af5592011-12-18 02:44:05 +0100380.PP
Jan Engelhardt44968012012-09-28 10:43:06 +0200381iptables can use extended packet matching and target modules.
382A list of these is available in the \fBiptables\-extensions\fP(8) manpage.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000383.SH DIAGNOSTICS
384Various error messages are printed to standard error. The exit code
385is 0 for correct functioning. Errors which appear to be caused by
386invalid or abused command line parameters cause an exit code of 2, and
387other errors cause an exit code of 1.
388.SH BUGS
389Bugs? What's this? ;-)
390Well... the counters are not reliable on sparc64.
391.SH COMPATIBILITY WITH IPCHAINS
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200392This \fBip6tables\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000393is very similar to ipchains by Rusty Russell. The main difference is
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200394that the chains \fBINPUT\fP and \fBOUTPUT\fP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000395are only traversed for packets coming into the local host and
396originating from the local host respectively. Hence every packet only
397passes through one of the three chains (except loopback traffic, which
398involves both INPUT and OUTPUT chains); previously a forwarded packet
399would pass through all three.
400.PP
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100401The other main difference is that \fB\-i\fP refers to the input interface;
402\fB\-o\fP refers to the output interface, and both are available for packets
Jan Engelhardt55dffef2008-07-03 20:27:50 +0200403entering the \fBFORWARD\fP chain.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000404There are several other changes in ip6tables.
405.SH SEE ALSO
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100406\fBip6tables\-save\fP(8),
407\fBip6tables\-restore\fP(8),
408\fBiptables\fP(8),
Jan Engelhardt7b5ba432012-09-28 10:57:45 +0200409\fBiptables\-apply\fP(8),
Jan Engelhardt44968012012-09-28 10:43:06 +0200410\fBiptables\-extensions\fP(8),
Jan Engelhardt0e8984a2009-01-12 07:06:12 +0100411\fBiptables\-save\fP(8),
412\fBiptables\-restore\fP(8),
413\fBlibipq\fP(3).
414.PP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000415The packet-filtering-HOWTO details iptables usage for
Jan Engelhardt9c6ff6b2008-09-08 15:42:41 +0200416packet filtering,
Henrik Nordstromc2794132004-01-22 15:04:24 +0000417the netfilter-extensions-HOWTO details the extensions that are
418not in the standard distribution,
419and the netfilter-hacking-HOWTO details the netfilter internals.
420.br
421See
422.BR "http://www.netfilter.org/" .
423.SH AUTHORS
424Rusty Russell wrote iptables, in early consultation with Michael
425Neuling.
426.PP
427Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
428selection framework in iptables, then wrote the mangle table, the owner match,
429the mark stuff, and ran around doing cool stuff everywhere.
430.PP
431James Morris wrote the TOS target, and tos match.
432.PP
433Jozsef Kadlecsik wrote the REJECT target.
434.PP
Jan Engelhardt6cf172e2008-03-10 17:48:59 +0100435Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as TTL match+target and libipulog.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000436.PP
Patrick McHardy110a89a2007-01-28 01:24:55 +0000437The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai,
Yasuyuki KOZAKAIe605d762007-02-15 06:41:58 +0000438Jozsef Kadlecsik, Patrick McHardy, James Morris, Pablo Neira Ayuso,
439Harald Welte and Rusty Russell.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000440.PP
441ip6tables man page created by Andras Kis-Szabo, based on
442iptables man page written by Herve Eychenne <rv@wallfire.org>.
443.\" .. and did I mention that we are incredibly cool people?
444.\" .. sexy, too ..
445.\" .. witty, charming, powerful ..
446.\" .. and most of all, modest ..
Jan Engelhardtf96cb802011-03-01 12:51:21 +0100447.SH VERSION
448.PP
449This manual page applies to ip6tables @PACKAGE_VERSION@.