iptables: refer to dmesg when we hit error
[jleu-iptables.git] / ip6tables.8.in
blob669a9618ef406125bc26b6a15b97dd48172f17ad
1 .TH IP6TABLES 8 "Jul 03, 2008" "" ""
2 .\"
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
28 ip6tables \- IPv6 packet filter administration
29 .SH SYNOPSIS
30 \fBip6tables\fP [\fB-t\fP \fItable\fP] {\fB-A\fP|\fB-D\fP} \fIchain rule-specification\fP [\fIoptions...\fP]
31 .br
32 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-I\fP [\fIrulenum\fP] \fIrule-specification\fP [\fIoptions...\fP]
33 .br
34 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-R\fP \fIrulenum rule-specification\fP [\fIoptions...\fP]
35 .br
36 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-D\fP \fIchain rulenum\fP [\fIoptions...\fP]
37 .br
38 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-S\fP [\fIchain\fP]
39 .br
40 \fBip6tables\fP [\fB-t\fP \fItable\fP] {\fB-F\fP|\fB-L\fP|\fB-Z\fP} [\fIchain\fP] [\fIoptions...\fP]
41 .br
42 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-N\fP \fIchain\fP
43 .br
44 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-X\fP [\fIchain\fP]
45 .br
46 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-P\fP \fIchain target\fP [\fIoptions...\fP]
47 .br
48 \fBip6tables\fP [\fB-t\fP \fItable\fP] \fB-E\fP \fIold-chain-name new-chain-name\fP
49 .SH DESCRIPTION
50 \fBIp6tables\fP is used to set up, maintain, and inspect the
51 tables of IPv6 packet
52 filter rules in the Linux kernel.  Several different tables
53 may be defined.  Each table contains a number of built-in
54 chains and may also contain user-defined chains.
56 Each chain is a list of rules which can match a set of packets.  Each
57 rule specifies what to do with a packet that matches.  This is called
58 a `target', which may be a jump to a user-defined chain in the same
59 table.
61 .SH TARGETS
62 A firewall rule specifies criteria for a packet and a target.  If the
63 packet does not match, the next rule in the chain is the examined; if
64 it does match, then the next rule is specified by the value of the
65 target, which can be the name of a user-defined chain or one of the
66 special values \fBACCEPT\fP, \fBDROP\fP, \fBQUEUE\fP or \fBRETURN\fP.
67 .PP
68 \fBACCEPT\fP means to let the packet through.
69 \fBDROP\fP means to drop the packet on the floor.
70 \fBQUEUE\fP means to pass the packet to userspace.
71 (How the packet can be received
72 by a userspace process differs by the particular queue handler.  2.4.x
73 and 2.6.x kernels up to 2.6.13 include the \fBip_queue\fP
74 queue handler.  Kernels 2.6.14 and later additionally include the
75 \fBnfnetlink_queue\fP queue handler.  Packets with a target of QUEUE will be
76 sent to queue number '0' in this case. Please also see the \fBNFQUEUE\fP
77 target as described later in this man page.)
78 \fBRETURN\fP means stop traversing this chain and resume at the next
79 rule in the
80 previous (calling) chain.  If the end of a built-in chain is reached
81 or a rule in a built-in chain with target \fBRETURN\fP
82 is matched, the target specified by the chain policy determines the
83 fate of the packet.
84 .SH TABLES
85 There are currently three independent tables (which tables are present
86 at any time depends on the kernel configuration options and which
87 modules are present).
88 .TP
89 \fB-t\fP, \fB--table\fP \fItable\fP
90 This option specifies the packet matching table which the command
91 should operate on.  If the kernel is configured with automatic module
92 loading, an attempt will be made to load the appropriate module for
93 that table if it is not already there.
95 The tables are as follows:
96 .RS
97 .TP .4i
98 \fBfilter\fP:
99 This is the default table (if no -t option is passed).  It contains
100 the built-in chains \fBINPUT\fP (for packets destined to local sockets),
101 \fBFORWARD\fP (for packets being routed through the box), and
102 \fBOUTPUT\fP (for locally-generated packets).
104 \fBmangle\fP:
105 This table is used for specialized packet alteration.  Until kernel
106 2.4.17 it had two built-in chains: \fBPREROUTING\fP
107 (for altering incoming packets before routing) and \fBOUTPUT\fP
108 (for altering locally-generated packets before routing).
109 Since kernel 2.4.18, three other built-in chains are also supported:
110 \fBINPUT\fP (for packets coming into the box itself), \fBFORWARD\fP
111 (for altering packets being routed through the box), and \fBPOSTROUTING\fP
112 (for altering packets as they are about to go out).
114 \fBraw\fP:
115 This table is used mainly for configuring exemptions from connection
116 tracking in combination with the NOTRACK target.  It registers at the netfilter
117 hooks with higher priority and is thus called before ip_conntrack, or any other
118 IP tables.  It provides the following built-in chains: \fBPREROUTING\fP
119 (for packets arriving via any network interface) \fBOUTPUT\fP
120 (for packets generated by local processes)
122 .SH OPTIONS
123 The options that are recognized by
124 \fBip6tables\fP can be divided into several different groups.
125 .SS COMMANDS
126 These options specify the specific action to perform.  Only one of them
127 can be specified on the command line unless otherwise specified
128 below.  For all the long versions of the command and option names, you
129 need to use only enough letters to ensure that
130 \fBip6tables\fP can differentiate it from all other options.
132 \fB-A\fP, \fB--append\fP \fIchain rule-specification\fP
133 Append one or more rules to the end of the selected chain.
134 When the source and/or destination names resolve to more than one
135 address, a rule will be added for each possible address combination.
137 \fB-D\fP, \fB--delete\fP \fIchain rule-specification\fP
140 \fB-D\fP, \fB--delete\fP \fIchain rulenum\fP
141 Delete one or more rules from the selected chain.  There are two
142 versions of this command: the rule can be specified as a number in the
143 chain (starting at 1 for the first rule) or a rule to match.
145 \fB-I\fP, \fB--insert\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP
146 Insert one or more rules in the selected chain as the given rule
147 number.  So, if the rule number is 1, the rule or rules are inserted
148 at the head of the chain.  This is also the default if no rule number
149 is specified.
151 \fB-R\fP, \fB--replace\fP \fIchain rulenum rule-specification\fP
152 Replace a rule in the selected chain.  If the source and/or
153 destination names resolve to multiple addresses, the command will
154 fail.  Rules are numbered starting at 1.
156 \fB-L\fP, \fB--list\fP [\fIchain\fP]
157 List all rules in the selected chain.  If no chain is selected, all
158 chains are listed. Like every other ip6tables command, it applies to the
159 specified table (filter is the default).
160 .IP ""
161 Please note that it is often used with the \fB-n\fP
162 option, in order to avoid long reverse DNS lookups.
163 It is legal to specify the \fB-Z\fP
164 (zero) option as well, in which case the chain(s) will be atomically
165 listed and zeroed.  The exact output is affected by the other
166 arguments given. The exact rules are suppressed until you use
168  ip6tables -L -v
171 \fB-S\fP, \fB--list-rules\fP [\fIchain\fP]
172 Print all rules in the selected chain.  If no chain is selected, all
173 chains are printed like ip6tables-save. Like every other ip6tables command,
174 it applies to the specified table (filter is the default).
176 \fB-F\fP, \fB--flush\fP [\fIchain\fP]
177 Flush the selected chain (all the chains in the table if none is given).
178 This is equivalent to deleting all the rules one by one.
180 \fB-Z\fP, \fB--zero\fP [\fIchain\fP]
181 Zero the packet and byte counters in all chains.  It is legal to
182 specify the
183 \fB-L\fP, \fB--list\fP
184 (list) option as well, to see the counters immediately before they are
185 cleared. (See above.)
187 \fB-N\fP, \fB--new-chain\fP \fIchain\fP
188 Create a new user-defined chain by the given name.  There must be no
189 target of that name already.
191 \fB-X\fP, \fB--delete-chain\fP [\fIchain\fP]
192 Delete the optional user-defined chain specified.  There must be no references
193 to the chain.  If there are, you must delete or replace the referring rules
194 before the chain can be deleted.  The chain must be empty, i.e. not contain
195 any rules.  If no argument is given, it will attempt to delete every
196 non-builtin chain in the table.
198 \fB-P\fP, \fB--policy\fP \fIchain target\fP
199 Set the policy for the chain to the given target.  See the section \fBTARGETS\fP
200 for the legal targets.  Only built-in (non-user-defined) chains can have
201 policies, and neither built-in nor user-defined chains can be policy
202 targets.
204 \fB-E\fP, \fB--rename-chain\fP \fIold-chain new-chain\fP
205 Rename the user specified chain to the user supplied name.  This is
206 cosmetic, and has no effect on the structure of the table.
207 .BI "-A, --append " "chain rule-specification"
208 Append one or more rules to the end of the selected chain.
209 When the source and/or destination names resolve to more than one
210 address, a rule will be added for each possible address combination.
212 .B -h
213 Help.
214 Give a (currently very brief) description of the command syntax.
215 .SS PARAMETERS
216 The following parameters make up a rule specification (as used in the
217 add, delete, insert, replace and append commands).
219 [\fB!\fP] \fB-p\fP, \fB--protocol\fP \fIprotocol\fP
220 The protocol of the rule or of the packet to check.
221 The specified protocol can be one of \fBtcp\fP, \fBudp\fP, \fBudplite\fP,
222 \fBicmpv6\fP, \fBesp\fP, \fBmh\fP or \fBall\fP,
223 or it can be a numeric value, representing one of these protocols or a
224 different one. A protocol name from /etc/protocols is also allowed.
225 But IPv6 extension headers except \fBesp\fP are not allowed.
226 \fBesp\fP and \fBipv6-nonext\fP
227 can be used with Kernel version 2.6.11 or later.
228 A "!" argument before the protocol inverts the
229 test.  The number zero is equivalent to \fBall\fP.
230 Protocol \fBall\fP
231 will match with all protocols and is taken as default when this
232 option is omitted.
234 [\fB!\fP] \fB-s\fP, \fB--source\fP \fIaddress\fP[\fB/\fP\fImask\fP]
235 Source specification.
236 \fIAddress\fP can be either a hostname (please note that specifying
237 any name to be resolved with a remote query such as DNS is a really bad idea),
238 a network IPv6 address (with \fB/\fP\fImask\fP), or a plain IPv6 address.
239 (the network name isn't supported now).
240 The \fImask\fP is a plain number,
241 specifying the number of 1's at the left side of the network mask.
242 A "!" argument before the address specification inverts the sense of
243 the address. The flag \fB--src\fP
244 is an alias for this option.
246 [\fB!\fP] \fB-d\fP, \fB--destination\fP \fIaddress\fP[\fB/\fP\fImask\fP]
247 Destination specification. 
248 See the description of the \fB-s\fP
249 (source) flag for a detailed description of the syntax.  The flag
250 \fB--dst\fP is an alias for this option.
252 \fB-j\fP, \fB--jump\fP \fItarget\fP
253 This specifies the target of the rule; i.e., what to do if the packet
254 matches it.  The target can be a user-defined chain (other than the
255 one this rule is in), one of the special builtin targets which decide
256 the fate of the packet immediately, or an extension (see \fBEXTENSIONS\fP
257 below).  If this
258 option is omitted in a rule (and \fB-g\fP
259 is not used), then matching the rule will have no
260 effect on the packet's fate, but the counters on the rule will be
261 incremented.
263 \fB-g\fP, \fB--goto\fP \fIchain\fP
264 This specifies that the processing should continue in a user
265 specified chain. Unlike the --jump option return will not continue
266 processing in this chain but instead in the chain that called us via
267 --jump.
269 [\fB!\fP] \fB-i\fP, \fB--in-interface\fP \fIname\fP
270 Name of an interface via which a packet was received (only for
271 packets entering the \fBINPUT\fP, \fBFORWARD\fP and \fBPREROUTING\fP
272 chains).  When the "!" argument is used before the interface name, the
273 sense is inverted.  If the interface name ends in a "+", then any
274 interface which begins with this name will match.  If this option is
275 omitted, any interface name will match.
277 [\fB!\fP] \fB-o\fP, \fB--out-interface\fP \fIname\fP
278 Name of an interface via which a packet is going to be sent (for packets
279 entering the \fBFORWARD\fP, \fBOUTPUT\fP and \fBPOSTROUTING\fP
280 chains).  When the "!" argument is used before the interface name, the
281 sense is inverted.  If the interface name ends in a "+", then any
282 interface which begins with this name will match.  If this option is
283 omitted, any interface name will match.
284 .\" Currently not supported (header-based)
285 .\" .TP
286 .\" [\fB!\fP] \fB-f\fP, \fB--fragment\fP
287 .\" This means that the rule only refers to second and further fragments
288 .\" of fragmented packets.  Since there is no way to tell the source or
289 .\" destination ports of such a packet (or ICMP type), such a packet will
290 .\" not match any rules which specify them.  When the "!" argument
291 .\" precedes the "-f" flag, the rule will only match head fragments, or
292 .\" unfragmented packets.
294 \fB-c\fP, \fB--set-counters\fP \fIpackets bytes\fP
295 This enables the administrator to initialize the packet and byte
296 counters of a rule (during \fBINSERT\fP, \fBAPPEND\fP, \fBREPLACE\fP
297 operations).
298 .SS "OTHER OPTIONS"
299 The following additional options can be specified:
301 \fB-v\fP, \fB--verbose\fP
302 Verbose output.  This option makes the list command show the interface
303 name, the rule options (if any), and the TOS masks.  The packet and
304 byte counters are also listed, with the suffix 'K', 'M' or 'G' for
305 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
306 the \fB-x\fP flag to change this).
307 For appending, insertion, deletion and replacement, this causes
308 detailed information on the rule or rules to be printed.
310 \fB-n\fP, \fB--numeric\fP
311 Numeric output.
312 IP addresses and port numbers will be printed in numeric format.
313 By default, the program will try to display them as host names,
314 network names, or services (whenever applicable).
316 \fB-x\fP, \fB--exact\fP
317 Expand numbers.
318 Display the exact value of the packet and byte counters,
319 instead of only the rounded number in K's (multiples of 1000)
320 M's (multiples of 1000K) or G's (multiples of 1000M).  This option is
321 only relevant for the \fB-L\fP command.
323 .B "--line-numbers"
324 When listing rules, add line numbers to the beginning of each rule,
325 corresponding to that rule's position in the chain.
327 \fB--modprobe=\fP\fIcommand\fP
328 When adding or inserting rules into a chain, use \fIcommand\fP
329 to load any necessary modules (targets, match extensions, etc).
330 .SH MATCH EXTENSIONS
331 ip6tables can use extended packet matching modules.  These are loaded
332 in two ways: implicitly, when \fB-p\fP or \fB--protocol\fP
333 is specified, or with the \fB-m\fP or \fB--match\fP
334 options, followed by the matching module name; after these, various
335 extra command line options become available, depending on the specific
336 module.  You can specify multiple extended match modules in one line,
337 and you can use the \fB-h\fP or \fB--help\fP
338 options after the module has been specified to receive help specific
339 to that module.
341 The following are included in the base package, and most of these can
342 be preceded by a "\fB!\fP" to invert the sense of the match.
343 .\" @MATCH@
344 .SH TARGET EXTENSIONS
345 ip6tables can use extended target modules: the following are included
346 in the standard distribution.
347 .\" @TARGET@
348 .SH DIAGNOSTICS
349 Various error messages are printed to standard error.  The exit code
350 is 0 for correct functioning.  Errors which appear to be caused by
351 invalid or abused command line parameters cause an exit code of 2, and
352 other errors cause an exit code of 1.
353 .SH BUGS
354 Bugs?  What's this? ;-)
355 Well... the counters are not reliable on sparc64.
356 .SH COMPATIBILITY WITH IPCHAINS
357 This \fBip6tables\fP
358 is very similar to ipchains by Rusty Russell.  The main difference is
359 that the chains \fBINPUT\fP and \fBOUTPUT\fP
360 are only traversed for packets coming into the local host and
361 originating from the local host respectively.  Hence every packet only
362 passes through one of the three chains (except loopback traffic, which
363 involves both INPUT and OUTPUT chains); previously a forwarded packet
364 would pass through all three.
366 The other main difference is that \fB-i\fP refers to the input interface;
367 \fB-o\fP refers to the output interface, and both are available for packets
368 entering the \fBFORWARD\fP chain.
369 There are several other changes in ip6tables.
370 .SH SEE ALSO
371 .BR ip6tables-save (8),
372 .BR ip6tables-restore(8),
373 .BR iptables (8),
374 .BR iptables-save (8),
375 .BR iptables-restore (8),
376 .BR libipq (3).
378 The packet-filtering-HOWTO details iptables usage for
379 packet filtering,
380 the netfilter-extensions-HOWTO details the extensions that are
381 not in the standard distribution,
382 and the netfilter-hacking-HOWTO details the netfilter internals.
385 .BR "http://www.netfilter.org/" .
386 .SH AUTHORS
387 Rusty Russell wrote iptables, in early consultation with Michael
388 Neuling.
390 Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
391 selection framework in iptables, then wrote the mangle table, the owner match,
392 the mark stuff, and ran around doing cool stuff everywhere.
394 James Morris wrote the TOS target, and tos match.
396 Jozsef Kadlecsik wrote the REJECT target.
398 Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as TTL match+target and libipulog.
400 The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai,
401 Jozsef Kadlecsik, Patrick McHardy, James Morris, Pablo Neira Ayuso,
402 Harald Welte and Rusty Russell.
404 ip6tables man page created by Andras Kis-Szabo, based on
405 iptables man page written by Herve Eychenne <rv@wallfire.org>.
406 .\" .. and did I mention that we are incredibly cool people?
407 .\" .. sexy, too ..
408 .\" .. witty, charming, powerful ..
409 .\" .. and most of all, modest ..