blob: f5d33db195448051e4769fb7a3995b7eacdfb0e4 [file] [log] [blame]
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +00001.TH IP6TABLES 8 "Jan 22, 2006" "" ""
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
28ip6tables \- IPv6 packet filter administration
29.SH SYNOPSIS
30.BR "ip6tables [-t table] -[AD] " "chain rule-specification [options]"
31.br
32.BR "ip6tables [-t table] -I " "chain [rulenum] rule-specification [options]"
33.br
34.BR "ip6tables [-t table] -R " "chain rulenum rule-specification [options]"
35.br
36.BR "ip6tables [-t table] -D " "chain rulenum [options]"
37.br
38.BR "ip6tables [-t table] -[LFZ] " "[chain] [options]"
39.br
40.BR "ip6tables [-t table] -N " "chain"
41.br
42.BR "ip6tables [-t table] -X " "[chain]"
43.br
44.BR "ip6tables [-t table] -P " "chain target [options]"
45.br
46.BR "ip6tables [-t table] -E " "old-chain-name new-chain-name"
47.SH DESCRIPTION
48.B Ip6tables
49is used to set up, maintain, and inspect the tables of IPv6 packet
50filter rules in the Linux kernel. Several different tables
51may be defined. Each table contains a number of built-in
52chains and may also contain user-defined chains.
53
54Each chain is a list of rules which can match a set of packets. Each
55rule specifies what to do with a packet that matches. This is called
56a `target', which may be a jump to a user-defined chain in the same
57table.
58
59.SH TARGETS
60A firewall rule specifies criteria for a packet, and a target. If the
61packet does not match, the next rule in the chain is the examined; if
62it does match, then the next rule is specified by the value of the
63target, which can be the name of a user-defined chain or one of the
64special values
65.IR ACCEPT ,
66.IR DROP ,
67.IR QUEUE ,
68or
69.IR RETURN .
70.PP
71.I ACCEPT
72means to let the packet through.
73.I DROP
74means to drop the packet on the floor.
75.I QUEUE
Harald Welte7bdfca42005-07-28 15:24:02 +000076means to pass the packet to userspace. (How the packet can be received
77by a userspace process differs by the particular queue handler. 2.4.x
78and 2.6.x kernels up to 2.6.13 include the
79.B
80ip_queue
81queue handler. Kernels 2.6.14 and later additionally include the
82.B
83nfnetlink_queue
84queue handler. Packets with a target of QUEUE will be sent to queue number '0'
85in this case. Please also see the
86.B
87NFQUEUE
88target as described later in this man page.)
Henrik Nordstromc2794132004-01-22 15:04:24 +000089.I RETURN
90means stop traversing this chain and resume at the next rule in the
91previous (calling) chain. If the end of a built-in chain is reached
92or a rule in a built-in chain with target
93.I RETURN
94is matched, the target specified by the chain policy determines the
95fate of the packet.
96.SH TABLES
97There are currently two independent tables (which tables are present
98at any time depends on the kernel configuration options and which
99modules are present), as nat table has not been implemented yet.
100.TP
101.BI "-t, --table " "table"
102This option specifies the packet matching table which the command
103should operate on. If the kernel is configured with automatic module
104loading, an attempt will be made to load the appropriate module for
105that table if it is not already there.
106
107The tables are as follows:
108.RS
109.TP .4i
110.BR "filter" :
111This is the default table (if no -t option is passed). It contains
112the built-in chains
113.B INPUT
114(for packets coming into the box itself),
115.B FORWARD
116(for packets being routed through the box), and
117.B OUTPUT
118(for locally-generated packets).
119.TP
120.BR "mangle" :
121This table is used for specialized packet alteration. Until kernel
1222.4.17 it had two built-in chains:
123.B PREROUTING
124(for altering incoming packets before routing) and
125.B OUTPUT
126(for altering locally-generated packets before routing).
127Since kernel 2.4.18, three other built-in chains are also supported:
128.B INPUT
129(for packets coming into the box itself),
130.B FORWARD
131(for altering packets being routed through the box), and
132.B POSTROUTING
133(for altering packets as they are about to go out).
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000134.TP
135.BR "raw" :
136This table is used mainly for configuring exemptions from connection
137tracking in combination with the NOTRACK target. It registers at the netfilter
138hooks with higher priority and is thus called before nf_conntrack, or any other
139IP6 tables. It provides the following built-in chains:
140.B PREROUTING
141(for packets arriving via any network interface)
142.B OUTPUT
143(for packets generated by local processes)
Henrik Nordstromc2794132004-01-22 15:04:24 +0000144.RE
145.SH OPTIONS
146The options that are recognized by
147.B ip6tables
148can be divided into several different groups.
149.SS COMMANDS
150These options specify the specific action to perform. Only one of them
151can be specified on the command line unless otherwise specified
152below. For all the long versions of the command and option names, you
153need to use only enough letters to ensure that
154.B ip6tables
155can differentiate it from all other options.
156.TP
157.BI "-A, --append " "chain rule-specification"
158Append one or more rules to the end of the selected chain.
159When the source and/or destination names resolve to more than one
160address, a rule will be added for each possible address combination.
161.TP
162.BI "-D, --delete " "chain rule-specification"
163.ns
164.TP
165.BI "-D, --delete " "chain rulenum"
166Delete one or more rules from the selected chain. There are two
167versions of this command: the rule can be specified as a number in the
168chain (starting at 1 for the first rule) or a rule to match.
169.TP
170.B "-I, --insert"
171Insert one or more rules in the selected chain as the given rule
172number. So, if the rule number is 1, the rule or rules are inserted
173at the head of the chain. This is also the default if no rule number
174is specified.
175.TP
176.BI "-R, --replace " "chain rulenum rule-specification"
177Replace a rule in the selected chain. If the source and/or
178destination names resolve to multiple addresses, the command will
179fail. Rules are numbered starting at 1.
180.TP
181.BR "-L, --list " "[\fIchain\fP]"
182List all rules in the selected chain. If no chain is selected, all
183chains are listed. As every other iptables command, it applies to the
184specified table (filter is the default), so mangle rules get listed by
185.nf
186 ip6tables -t mangle -n -L
187.fi
188Please note that it is often used with the
189.B -n
190option, in order to avoid long reverse DNS lookups.
191It is legal to specify the
192.B -Z
193(zero) option as well, in which case the chain(s) will be atomically
194listed and zeroed. The exact output is affected by the other
195arguments given. The exact rules are suppressed until you use
196.nf
197 ip6tables -L -v
198.fi
199.TP
Henrik Nordstrom96296cf2008-05-13 13:08:26 +0200200.BR "-S, --list-rules " "[\fIchain\fP]"
201Print all rules in the selected chain. If no chain is selected, all
202chains are printed like iptables-save. Like every other iptables command,
203it applies to the specified table (filter is the default).
204.TP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000205.BR "-F, --flush " "[\fIchain\fP]"
206Flush the selected chain (all the chains in the table if none is given).
207This is equivalent to deleting all the rules one by one.
208.TP
209.BR "-Z, --zero " "[\fIchain\fP]"
210Zero the packet and byte counters in all chains. It is legal to
211specify the
212.B "-L, --list"
213(list) option as well, to see the counters immediately before they are
214cleared. (See above.)
215.TP
216.BI "-N, --new-chain " "chain"
217Create a new user-defined chain by the given name. There must be no
218target of that name already.
219.TP
220.BR "-X, --delete-chain " "[\fIchain\fP]"
221Delete the optional user-defined chain specified. There must be no references
222to the chain. If there are, you must delete or replace the referring
223rules before the chain can be deleted. If no argument is given, it
224will attempt to delete every non-builtin chain in the table.
225.TP
226.BI "-P, --policy " "chain target"
227Set the policy for the chain to the given target. See the section
228.B TARGETS
229for the legal targets. Only built-in (non-user-defined) chains can have
230policies, and neither built-in nor user-defined chains can be policy
231targets.
232.TP
233.BI "-E, --rename-chain " "old-chain new-chain"
234Rename the user specified chain to the user supplied name. This is
235cosmetic, and has no effect on the structure of the table.
236.TP
237.B -h
238Help.
239Give a (currently very brief) description of the command syntax.
240.SS PARAMETERS
241The following parameters make up a rule specification (as used in the
242add, delete, insert, replace and append commands).
243.TP
244.BR "-p, --protocol " "[!] \fIprotocol\fP"
245The protocol of the rule or of the packet to check.
246The specified protocol can be one of
247.IR tcp ,
248.IR udp ,
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000249.IR icmpv6 ,
250.IR esp ,
Henrik Nordstromc2794132004-01-22 15:04:24 +0000251.IR all ,
252or it can be a numeric value, representing one of these protocols or a
Yasuyuki KOZAKAI28e5b792006-01-30 08:50:09 +0000253different one. A protocol name from /etc/protocols is also allowed.
254But IPv6 extension headers except
255.IR esp
256are not allowed.
257.IR esp ,
258and
259.IR ipv6-nonext
260can be used with Kernel version 2.6.11 or later.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000261A "!" argument before the protocol inverts the
262test. The number zero is equivalent to
263.IR all .
264Protocol
265.I all
266will match with all protocols and is taken as default when this
267option is omitted.
268.TP
269.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
270Source specification.
271.I Address
272can be either a hostname (please note that specifying
273any name to be resolved with a remote query such as DNS is a really bad idea),
274a network IPv6 address (with /mask), or a plain IPv6 address.
275(the network name isn't supported now).
276The
277.I mask
278can be either a network mask or a plain number,
279specifying the number of 1's at the left side of the network mask.
280Thus, a mask of
281.I 64
282is equivalent to
283.IR ffff:ffff:ffff:ffff:0000:0000:0000:0000 .
284A "!" argument before the address specification inverts the sense of
285the address. The flag
286.B --src
287is an alias for this option.
288.TP
289.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
290Destination specification.
291See the description of the
292.B -s
293(source) flag for a detailed description of the syntax. The flag
294.B --dst
295is an alias for this option.
296.TP
297.BI "-j, --jump " "target"
298This specifies the target of the rule; i.e., what to do if the packet
299matches it. The target can be a user-defined chain (other than the
300one this rule is in), one of the special builtin targets which decide
301the fate of the packet immediately, or an extension (see
302.B EXTENSIONS
303below). If this
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200304option is omitted in a rule (and
305.B -g
306is not used), then matching the rule will have no
Henrik Nordstromc2794132004-01-22 15:04:24 +0000307effect on the packet's fate, but the counters on the rule will be
308incremented.
309.TP
Thomas Jacobeaf831e2008-06-23 11:35:29 +0200310.BI "-g, --goto " "chain"
311This specifies that the processing should continue in a user
312specified chain. Unlike the --jump option return will not continue
313processing in this chain but instead in the chain that called us via
314--jump.
315.TP
Henrik Nordstromc2794132004-01-22 15:04:24 +0000316.BR "-i, --in-interface " "[!] \fIname\fP"
317Name of an interface via which a packet is going to be received (only for
318packets entering the
319.BR INPUT ,
320.B FORWARD
321and
322.B PREROUTING
323chains). When the "!" argument is used before the interface name, the
324sense is inverted. If the interface name ends in a "+", then any
325interface which begins with this name will match. If this option is
326omitted, any interface name will match.
327.TP
328.BR "-o, --out-interface " "[!] \fIname\fP"
329Name of an interface via which a packet is going to be sent (for packets
330entering the
331.BR FORWARD
332and
333.B OUTPUT
334chains). When the "!" argument is used before the interface name, the
335sense is inverted. If the interface name ends in a "+", then any
336interface which begins with this name will match. If this option is
337omitted, any interface name will match.
338.TP
339.\" Currently not supported (header-based)
340.\"
341.\" .B "[!] " "-f, --fragment"
342.\" This means that the rule only refers to second and further fragments
343.\" of fragmented packets. Since there is no way to tell the source or
344.\" destination ports of such a packet (or ICMP type), such a packet will
345.\" not match any rules which specify them. When the "!" argument
346.\" precedes the "-f" flag, the rule will only match head fragments, or
347.\" unfragmented packets.
348.\" .TP
349.B "-c, --set-counters " "PKTS BYTES"
350This enables the administrator to initialize the packet and byte
351counters of a rule (during
352.B INSERT,
353.B APPEND,
354.B REPLACE
355operations).
356.SS "OTHER OPTIONS"
357The following additional options can be specified:
358.TP
359.B "-v, --verbose"
360Verbose output. This option makes the list command show the interface
361name, the rule options (if any), and the TOS masks. The packet and
362byte counters are also listed, with the suffix 'K', 'M' or 'G' for
3631000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
364the
365.B -x
366flag to change this).
367For appending, insertion, deletion and replacement, this causes
368detailed information on the rule or rules to be printed.
369.TP
370.B "-n, --numeric"
371Numeric output.
372IP addresses and port numbers will be printed in numeric format.
373By default, the program will try to display them as host names,
374network names, or services (whenever applicable).
375.TP
376.B "-x, --exact"
377Expand numbers.
378Display the exact value of the packet and byte counters,
379instead of only the rounded number in K's (multiples of 1000)
380M's (multiples of 1000K) or G's (multiples of 1000M). This option is
381only relevant for the
382.B -L
383command.
384.TP
385.B "--line-numbers"
386When listing rules, add line numbers to the beginning of each rule,
387corresponding to that rule's position in the chain.
388.TP
389.B "--modprobe=command"
390When adding or inserting rules into a chain, use
391.B command
392to load any necessary modules (targets, match extensions, etc).
393.SH MATCH EXTENSIONS
394ip6tables can use extended packet matching modules. These are loaded
395in two ways: implicitly, when
396.B -p
397or
398.B --protocol
399is specified, or with the
400.B -m
401or
402.B --match
403options, followed by the matching module name; after these, various
404extra command line options become available, depending on the specific
405module. You can specify multiple extended match modules in one line,
406and you can use the
407.B -h
408or
409.B --help
410options after the module has been specified to receive help specific
411to that module.
412
413The following are included in the base package, and most of these can
414be preceded by a
415.B !
416to invert the sense of the match.
417.\" @MATCH@
418.SH TARGET EXTENSIONS
419ip6tables can use extended target modules: the following are included
420in the standard distribution.
421.\" @TARGET@
422.SH DIAGNOSTICS
423Various error messages are printed to standard error. The exit code
424is 0 for correct functioning. Errors which appear to be caused by
425invalid or abused command line parameters cause an exit code of 2, and
426other errors cause an exit code of 1.
427.SH BUGS
428Bugs? What's this? ;-)
429Well... the counters are not reliable on sparc64.
430.SH COMPATIBILITY WITH IPCHAINS
431This
432.B ip6tables
433is very similar to ipchains by Rusty Russell. The main difference is
434that the chains
435.B INPUT
436and
437.B OUTPUT
438are only traversed for packets coming into the local host and
439originating from the local host respectively. Hence every packet only
440passes through one of the three chains (except loopback traffic, which
441involves both INPUT and OUTPUT chains); previously a forwarded packet
442would pass through all three.
443.PP
444The other main difference is that
445.B -i
446refers to the input interface;
447.B -o
448refers to the output interface, and both are available for packets
449entering the
450.B FORWARD
451chain.
452.\" .PP The various forms of NAT have been separated out;
453.\" .B iptables
454.\" is a pure packet filter when using the default `filter' table, with
455.\" optional extension modules. This should simplify much of the previous
456.\" confusion over the combination of IP masquerading and packet filtering
457.\" seen previously. So the following options are handled differently:
458.\" .br
459.\" -j MASQ
460.\" .br
461.\" -M -S
462.\" .br
463.\" -M -L
464.\" .br
465There are several other changes in ip6tables.
466.SH SEE ALSO
467.BR ip6tables-save (8),
468.BR ip6tables-restore(8),
469.BR iptables (8),
470.BR iptables-save (8),
Harald Welte7bdfca42005-07-28 15:24:02 +0000471.BR iptables-restore (8),
472.BR libipq (3).
Henrik Nordstromc2794132004-01-22 15:04:24 +0000473.P
474The packet-filtering-HOWTO details iptables usage for
475packet filtering, the NAT-HOWTO details NAT,
476the netfilter-extensions-HOWTO details the extensions that are
477not in the standard distribution,
478and the netfilter-hacking-HOWTO details the netfilter internals.
479.br
480See
481.BR "http://www.netfilter.org/" .
482.SH AUTHORS
483Rusty Russell wrote iptables, in early consultation with Michael
484Neuling.
485.PP
486Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
487selection framework in iptables, then wrote the mangle table, the owner match,
488the mark stuff, and ran around doing cool stuff everywhere.
489.PP
490James Morris wrote the TOS target, and tos match.
491.PP
492Jozsef Kadlecsik wrote the REJECT target.
493.PP
Jan Engelhardt6cf172e2008-03-10 17:48:59 +0100494Harald 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 +0000495.PP
Patrick McHardy110a89a2007-01-28 01:24:55 +0000496The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai,
Yasuyuki KOZAKAIe605d762007-02-15 06:41:58 +0000497Jozsef Kadlecsik, Patrick McHardy, James Morris, Pablo Neira Ayuso,
498Harald Welte and Rusty Russell.
Henrik Nordstromc2794132004-01-22 15:04:24 +0000499.PP
500ip6tables man page created by Andras Kis-Szabo, based on
501iptables man page written by Herve Eychenne <rv@wallfire.org>.
502.\" .. and did I mention that we are incredibly cool people?
503.\" .. sexy, too ..
504.\" .. witty, charming, powerful ..
505.\" .. and most of all, modest ..