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