This commit was manufactured by cvs2svn to create branch
[iptables.git] / ip6tables.8
1 .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
28 ip6tables \- 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
49 is used to set up, maintain, and inspect the tables of IPv6 packet
50 filter rules in the Linux kernel.  Several different tables
51 may be defined.  Each table contains a number of built-in
52 chains and may also contain user-defined chains.
53
54 Each chain is a list of rules which can match a set of packets.  Each
55 rule specifies what to do with a packet that matches.  This is called
56 a `target', which may be a jump to a user-defined chain in the same
57 table.
58
59 .SH TARGETS
60 A firewall rule specifies criteria for a packet, and a target.  If the
61 packet does not match, the next rule in the chain is the examined; if
62 it does match, then the next rule is specified by the value of the
63 target, which can be the name of a user-defined chain or one of the
64 special values 
65 .IR ACCEPT ,
66 .IR DROP ,
67 .IR QUEUE ,
68 or
69 .IR RETURN .
70 .PP
71 .I ACCEPT 
72 means to let the packet through.
73 .I DROP
74 means to drop the packet on the floor.
75 .I QUEUE
76 means to pass the packet to userspace (if supported by the kernel).
77 .I RETURN
78 means stop traversing this chain and resume at the next rule in the
79 previous (calling) chain.  If the end of a built-in chain is reached
80 or a rule in a built-in chain with target
81 .I RETURN
82 is matched, the target specified by the chain policy determines the
83 fate of the packet.
84 .SH TABLES
85 There are currently two independent tables (which tables are present
86 at any time depends on the kernel configuration options and which
87 modules are present), as nat table has not been implemented yet.
88 .TP
89 .BI "-t, --table " "table"
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.
94
95 The tables are as follows:
96 .RS
97 .TP .4i
98 .BR "filter" :
99 This is the default table (if no -t option is passed).  It contains
100 the 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" :
109 This table is used for specialized packet alteration.  Until kernel
110 2.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).
115 Since 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
124 The options that are recognized by
125 .B ip6tables
126 can be divided into several different groups.
127 .SS COMMANDS
128 These options specify the specific action to perform.  Only one of them
129 can be specified on the command line unless otherwise specified
130 below.  For all the long versions of the command and option names, you
131 need to use only enough letters to ensure that
132 .B ip6tables
133 can differentiate it from all other options.
134 .TP
135 .BI "-A, --append " "chain rule-specification"
136 Append one or more rules to the end of the selected chain.
137 When the source and/or destination names resolve to more than one
138 address, 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"
144 Delete one or more rules from the selected chain.  There are two
145 versions of this command: the rule can be specified as a number in the
146 chain (starting at 1 for the first rule) or a rule to match.
147 .TP
148 .B "-I, --insert"
149 Insert one or more rules in the selected chain as the given rule
150 number.  So, if the rule number is 1, the rule or rules are inserted
151 at the head of the chain.  This is also the default if no rule number
152 is specified.
153 .TP
154 .BI "-R, --replace " "chain rulenum rule-specification"
155 Replace a rule in the selected chain.  If the source and/or
156 destination names resolve to multiple addresses, the command will
157 fail.  Rules are numbered starting at 1.
158 .TP
159 .BR "-L, --list " "[\fIchain\fP]"
160 List all rules in the selected chain.  If no chain is selected, all
161 chains are listed.  As every other iptables command, it applies to the
162 specified table (filter is the default), so mangle rules get listed by
163 .nf
164  ip6tables -t mangle -n -L
165 .fi
166 Please note that it is often used with the
167 .B -n
168 option, in order to avoid long reverse DNS lookups.
169 It is legal to specify the
170 .B -Z
171 (zero) option as well, in which case the chain(s) will be atomically
172 listed and zeroed.  The exact output is affected by the other
173 arguments 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]"
179 Flush the selected chain (all the chains in the table if none is given).
180 This is equivalent to deleting all the rules one by one.
181 .TP
182 .BR "-Z, --zero " "[\fIchain\fP]"
183 Zero the packet and byte counters in all chains.  It is legal to
184 specify the
185 .B "-L, --list"
186 (list) option as well, to see the counters immediately before they are
187 cleared. (See above.)
188 .TP
189 .BI "-N, --new-chain " "chain"
190 Create a new user-defined chain by the given name.  There must be no
191 target of that name already.
192 .TP
193 .BR "-X, --delete-chain " "[\fIchain\fP]"
194 Delete the optional user-defined chain specified.  There must be no references
195 to the chain.  If there are, you must delete or replace the referring
196 rules before the chain can be deleted.  If no argument is given, it
197 will attempt to delete every non-builtin chain in the table.
198 .TP
199 .BI "-P, --policy " "chain target"
200 Set the policy for the chain to the given target.  See the section
201 .B TARGETS
202 for the legal targets.  Only built-in (non-user-defined) chains can have
203 policies, and neither built-in nor user-defined chains can be policy
204 targets.
205 .TP
206 .BI "-E, --rename-chain " "old-chain new-chain"
207 Rename the user specified chain to the user supplied name.  This is
208 cosmetic, and has no effect on the structure of the table.
209 .TP
210 .B -h
211 Help.
212 Give a (currently very brief) description of the command syntax.
213 .SS PARAMETERS
214 The following parameters make up a rule specification (as used in the
215 add, delete, insert, replace and append commands).
216 .TP
217 .BR "-p, --protocol " "[!] \fIprotocol\fP"
218 The protocol of the rule or of the packet to check.
219 The specified protocol can be one of
220 .IR tcp ,
221 .IR udp ,
222 .IR ipv6-icmp|icmpv6 ,
223 or
224 .IR all ,
225 or it can be a numeric value, representing one of these protocols or a
226 different one.  A protocol name from /etc/protocols is also allowed.
227 A "!" argument before the protocol inverts the
228 test.  The number zero is equivalent to
229 .IR all .
230 Protocol
231 .I all
232 will match with all protocols and is taken as default when this
233 option is omitted.
234 .TP
235 .BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
236 Source specification.
237 .I Address
238 can be either a hostname (please note that specifying
239 any name to be resolved with a remote query such as DNS is a really bad idea),
240 a network IPv6 address (with /mask), or a plain IPv6 address.
241 (the network name isn't supported now).
242 The
243 .I mask
244 can be either a network mask or a plain number,
245 specifying the number of 1's at the left side of the network mask.
246 Thus, a mask of
247 .I 64
248 is equivalent to
249 .IR ffff:ffff:ffff:ffff:0000:0000:0000:0000 .
250 A "!" argument before the address specification inverts the sense of
251 the address. The flag
252 .B --src
253 is an alias for this option.
254 .TP
255 .BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
256 Destination specification. 
257 See the description of the
258 .B -s
259 (source) flag for a detailed description of the syntax.  The flag
260 .B --dst
261 is an alias for this option.
262 .TP
263 .BI "-j, --jump " "target"
264 This specifies the target of the rule; i.e., what to do if the packet
265 matches it.  The target can be a user-defined chain (other than the
266 one this rule is in), one of the special builtin targets which decide
267 the fate of the packet immediately, or an extension (see
268 .B EXTENSIONS
269 below).  If this
270 option is omitted in a rule, then matching the rule will have no
271 effect on the packet's fate, but the counters on the rule will be
272 incremented.
273 .TP
274 .BR "-i, --in-interface " "[!] \fIname\fP"
275 Name of an interface via which a packet is going to be received (only for
276 packets entering the 
277 .BR INPUT ,
278 .B FORWARD
279 and
280 .B PREROUTING
281 chains).  When the "!" argument is used before the interface name, the
282 sense is inverted.  If the interface name ends in a "+", then any
283 interface which begins with this name will match.  If this option is
284 omitted, any interface name will match.
285 .TP
286 .BR "-o, --out-interface " "[!] \fIname\fP"
287 Name of an interface via which a packet is going to be sent (for packets
288 entering the
289 .BR FORWARD 
290 and
291 .B OUTPUT
292 chains).  When the "!" argument is used before the interface name, the
293 sense is inverted.  If the interface name ends in a "+", then any
294 interface which begins with this name will match.  If this option is
295 omitted, 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"
308 This enables the administrator to initialize the packet and byte
309 counters of a rule (during
310 .B INSERT,
311 .B APPEND,
312 .B REPLACE
313 operations).
314 .SS "OTHER OPTIONS"
315 The following additional options can be specified:
316 .TP
317 .B "-v, --verbose"
318 Verbose output.  This option makes the list command show the interface
319 name, the rule options (if any), and the TOS masks.  The packet and
320 byte counters are also listed, with the suffix 'K', 'M' or 'G' for
321 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
322 the
323 .B -x
324 flag to change this).
325 For appending, insertion, deletion and replacement, this causes
326 detailed information on the rule or rules to be printed.
327 .TP
328 .B "-n, --numeric"
329 Numeric output.
330 IP addresses and port numbers will be printed in numeric format.
331 By default, the program will try to display them as host names,
332 network names, or services (whenever applicable).
333 .TP
334 .B "-x, --exact"
335 Expand numbers.
336 Display the exact value of the packet and byte counters,
337 instead of only the rounded number in K's (multiples of 1000)
338 M's (multiples of 1000K) or G's (multiples of 1000M).  This option is
339 only relevant for the 
340 .B -L
341 command.
342 .TP
343 .B "--line-numbers"
344 When listing rules, add line numbers to the beginning of each rule,
345 corresponding to that rule's position in the chain.
346 .TP
347 .B "--modprobe=command"
348 When adding or inserting rules into a chain, use
349 .B command
350 to load any necessary modules (targets, match extensions, etc).
351 .SH MATCH EXTENSIONS
352 ip6tables can use extended packet matching modules.  These are loaded
353 in two ways: implicitly, when
354 .B -p
355 or
356 .B --protocol
357 is specified, or with the
358 .B -m
359 or
360 .B --match
361 options, followed by the matching module name; after these, various
362 extra command line options become available, depending on the specific
363 module.  You can specify multiple extended match modules in one line,
364 and you can use the
365 .B -h
366 or
367 .B --help
368 options after the module has been specified to receive help specific
369 to that module.
370
371 The following are included in the base package, and most of these can
372 be preceded by a
373 .B !
374 to invert the sense of the match.
375 .\" @MATCH@
376 .SS ah
377 This module matches the SPIs in AH header of IPSec packets.
378 .TP
379 .BR "--ahspi " "[!] \fIspi\fP[:\fIspi\fP]"
380 .SS condition
381 This matches if a specific /proc filename is '0' or '1'.
382 .TP
383 .BI "--condition " "[!] filename"
384 Match on boolean value stored in /proc/net/ip6t_condition/filename file
385 .SS dst
386 This module matches the IPv6 destination header options
387 .TP
388 .BI "--dst-len" "[!]" "length"
389 Total length of this header
390 .TP
391 .BI "--dst-opts " "TYPE[:LEN],[,TYPE[:LEN]...]"
392 Options and it's length (List).
393 .SS esp
394 This module matches the SPIs in ESP header of IPSec packets.
395 .TP
396 .BR "--espspi " "[!] \fIspi\fP[:\fIspi\fP]"
397 .SS eui64
398 This module matches the EUI64 part of a stateless autoconfigured IPv6 address.  It compares the source MAC address with the lower 64 bits of the IPv6 address. 
399 .SS frag
400 This module matches the time IPv6 fragmentathion header
401 .TP
402 .BI "--fragid " "[!]" "id[:id]"
403 Matches the given fragmentation ID (range).
404 .TP
405 .BI "--fraglen " "[!]" "length"
406 Matches the total length of this header.
407 .TP
408 .BI "--fragres "
409 Matches the reserved field, too.
410 .TP
411 .BI "--fragfirst "
412 Matches on the first fragment.
413 .TP
414 .BI "[--fragmore]"
415 Matches if there are more fragments.
416 .TP
417 .BI "[--fraglast]"
418 Matches if this is the last fragement.
419 .SS fuzzy
420 This module matches a rate limit based on a fuzzy logic controller [FLC]
421 .TP
422 .BI "--lower-limit  "number"
423 Specifies the lower limit (in packets per second).
424 .TP
425 .BI "--upper-limit " "number"
426 Specifies the upper limit (in packets per second).
427 .SS hbh
428 This module matches the IPv6 hop-by-hop header options
429 .TP
430 .BI "--hbh-len" "[!]" "length"
431 Total length of this header
432 .TP
433 .BI "--hbh-opts " "TYPE[:LEN],[,TYPE[:LEN]...]"
434 Options and it's length (List).
435 .SS hl
436 This module matches the HOPLIMIT field in the IPv6 header.
437 .TP
438 .BI "--hl-eq " "value"
439 Matches if HOPLIMIT equals the given value.
440 .TP
441 .BI "--hl-lt " "ttl"
442 Matches if HOPLIMIT is less than the given value.
443 .TP
444 .BI "--hl-gt " "ttl"
445 Matches if HOPLIMIT is greater than the given value.
446 .SS icmpv6
447 This extension is loaded if `--protocol ipv6-icmp' or `--protocol icmpv6' is
448 specified. It provides the following option:
449 .TP
450 .BR "--icmpv6-type " "[!] \fItypename\fP"
451 This allows specification of the ICMP type, which can be a numeric
452 IPv6-ICMP type, or one of the IPv6-ICMP type names shown by the command
453 .nf
454  ip6tables -p ipv6-icmp -h
455 .fi
456 .SS ipv6header
457 This module matches on IPv6 option headers
458 .TP
459 .BI "--header " "[!]" "headers"
460 Matches the given type of headers.  
461 Names: hop,dst,route,frag,auth,esp,none,proto
462 Long Names: hop-by-hop,ipv6-opts,ipv6-route,ipv6-frag,ah,esp,ipv6-nonxt,protocol
463 Numbers: 0,60,43,44,51,50,59
464 .TP
465 .BI "--soft"
466 The header CONTAINS the specified extensions.
467 .SS length
468 This module matches the length of a packet against a specific value
469 or range of values.
470 .TP
471 .BR "--length " "\fIlength\fP[:\fIlength\fP]"
472 .SS limit
473 This module matches at a limited rate using a token bucket filter.
474 A rule using this extension will match until this limit is reached
475 (unless the `!' flag is used).  It can be used in combination with the
476 .B LOG
477 target to give limited logging, for example.
478 .TP
479 .BI "--limit " "rate"
480 Maximum average matching rate: specified as a number, with an optional
481 `/second', `/minute', `/hour', or `/day' suffix; the default is
482 3/hour.
483 .TP
484 .BI "--limit-burst " "number"
485 Maximum initial number of packets to match: this number gets
486 recharged by one every time the limit specified above is not reached,
487 up to this number; the default is 5.
488 .SS mac
489 .TP
490 .BR "--mac-source " "[!] \fIaddress\fP"
491 Match source MAC address.  It must be of the form XX:XX:XX:XX:XX:XX.
492 Note that this only makes sense for packets coming from an Ethernet device
493 and entering the
494 .BR PREROUTING ,
495 .B FORWARD
496 or
497 .B INPUT
498 chains.
499 .SS mark
500 This module matches the netfilter mark field associated with a packet
501 (which can be set using the
502 .B MARK
503 target below).
504 .TP
505 .BR "--mark " "\fIvalue\fP[/\fImask\fP]"
506 Matches packets with the given unsigned mark value (if a mask is
507 specified, this is logically ANDed with the mask before the
508 comparison).
509 .SS multiport
510 This module matches a set of source or destination ports.  Up to 15
511 ports can be specified.  A port range (port:port) counts as two
512 ports.  It can only be used in conjunction with
513 .B "-p tcp"
514 or
515 .BR "-p udp" .
516 .TP
517 .BR "--source-ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
518 Match if the source port is one of the given ports.  The flag
519 .B --sports
520 is a convenient alias for this option.
521 .TP
522 .BR "--destination-ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
523 Match if the destination port is one of the given ports.  The flag
524 .B --dports
525 is a convenient alias for this option.
526 .TP
527 .BR "--ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
528 Match if the both the source and destination ports are equal to each
529 other and to one of the given ports.
530 .SS nth
531 This module matches every `n'th packet
532 .TP
533 .BI "--every " "value"
534 Match every `value' packet
535 .TP
536 .BI "[" "--counter " "num" "]"
537 Use internal counter number `num'.  Default is `0'.
538 .TP
539 .BI "[" "--start " "num" "]"
540 Initialize the counter at the number `num' insetad of `0'.  Most between `0'
541 and `value'-1.
542 .TP
543 .BI "[" "--packet " "num" "]"
544 Match on `num' packet.  Most be between `0' and `value'-1.
545 .SS owner
546 This module attempts to match various characteristics of the packet
547 creator, for locally-generated packets.  It is only valid in the
548 .B OUTPUT
549 chain, and even this some packets (such as ICMP ping responses) may
550 have no owner, and hence never match.  This is regarded as experimental.
551 .TP
552 .BI "--uid-owner " "userid"
553 Matches if the packet was created by a process with the given
554 effective user id.
555 .TP
556 .BI "--gid-owner " "groupid"
557 Matches if the packet was created by a process with the given
558 effective group id.
559 .TP
560 .BI "--pid-owner " "processid"
561 Matches if the packet was created by a process with the given
562 process id.
563 .TP
564 .BI "--sid-owner " "sessionid"
565 Matches if the packet was created by a process in the given session
566 group.
567 .TP
568 .B NOTE: pid, sid and command matching are broken on SMP
569 .SS physdev
570 This module matches on the bridge port input and output devices enslaved
571 to a bridge device. This module is a part of the infrastructure that enables
572 a transparent bridging IP firewall and is only useful for kernel versions
573 above version 2.5.44.
574 .TP
575 .B --physdev-in name
576 Name of a bridge port via which a packet is received (only for
577 packets entering the
578 .BR INPUT ,
579 .B FORWARD
580 and
581 .B PREROUTING
582 chains). If the interface name ends in a "+", then any
583 interface which begins with this name will match. If the packet didn't arrive
584 through a bridge device, this packet won't match this option, unless '!' is used.
585 .TP
586 .B --physdev-out name
587 Name of a bridge port via which a packet is going to be sent (for packets
588 entering the
589 .BR FORWARD ,
590 .B OUTPUT
591 and
592 .B POSTROUTING
593 chains).  If the interface name ends in a "+", then any
594 interface which begins with this name will match. Note that in the
595 .BR nat " and " mangle
596 .B OUTPUT
597 chains one cannot match on the bridge output port, however one can in the
598 .B "filter OUTPUT"
599 chain. If the packet won't leave by a bridge device or it is yet unknown what
600 the output device will be, then the packet won't match this option, unless
601 '!' is used.
602 .TP
603 .B --physdev-is-in
604 Matches if the packet has entered through a bridge interface.
605 .TP
606 .B --physdev-is-out
607 Matches if the packet will leave through a bridge interface.
608 .TP
609 .B --physdev-is-bridged
610 Matches if the packet is being bridged and therefore is not being routed.
611 This is only useful in the FORWARD and POSTROUTING chains.
612 .SS random
613 This module randomly matches a certain percentage of all packets.
614 .TP
615 .BI "--average " "percent"
616 Matches the given percentage.  If omitted, a probability of 50% is set. 
617 .SS rt
618 Match on IPv6 routing header
619 .TP
620 .BI "--rt-type " "[!]" "type"
621 Match the type (numeric).
622 .TP
623 .BI "--rt-segsleft" "[!]" "num[:num]"
624 Match the `segments left' field (range).
625 .TP
626 .BI "--rt-len" "[!]" "length"
627 Match the length of this header
628 .TP
629 .BI "--rt-0-res"
630 Match the reserved field, too (type=0)
631 .TP
632 .BI "--rt-0-addrs ADDR[,ADDR...]
633 Match type=0 addresses (list).
634 .TP
635 .BI "--rt-0-not-strict"
636 List of type=0 addresses is not a strict list.
637 .SS tcp
638 These extensions are loaded if `--protocol tcp' is specified. It
639 provides the following options:
640 .TP
641 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
642 Source port or port range specification. This can either be a service
643 name or a port number. An inclusive range can also be specified,
644 using the format
645 .IR port : port .
646 If the first port is omitted, "0" is assumed; if the last is omitted,
647 "65535" is assumed.
648 If the second port greater then the first they will be swapped.
649 The flag
650 .B --sport
651 is a convenient alias for this option.
652 .TP
653 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
654 Destination port or port range specification.  The flag
655 .B --dport
656 is a convenient alias for this option.
657 .TP
658 .BR "--tcp-flags " "[!] \fImask\fP \fIcomp\fP"
659 Match when the TCP flags are as specified.  The first argument is the
660 flags which we should examine, written as a comma-separated list, and
661 the second argument is a comma-separated list of flags which must be
662 set.  Flags are: 
663 .BR "SYN ACK FIN RST URG PSH ALL NONE" .
664 Hence the command
665 .nf
666  ip6tables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
667 .fi
668 will only match packets with the SYN flag set, and the ACK, FIN and
669 RST flags unset.
670 .TP
671 .B "[!] --syn"
672 Only match TCP packets with the SYN bit set and the ACK and RST bits
673 cleared.  Such packets are used to request TCP connection initiation;
674 for example, blocking such packets coming in an interface will prevent
675 incoming TCP connections, but outgoing TCP connections will be
676 unaffected.
677 It is equivalent to \fB--tcp-flags SYN,RST,ACK SYN\fP.
678 If the "!" flag precedes the "--syn", the sense of the
679 option is inverted.
680 .TP
681 .BR "--tcp-option " "[!] \fInumber\fP"
682 Match if TCP option set.
683 .SS udp
684 These extensions are loaded if `--protocol udp' is specified.  It
685 provides the following options:
686 .TP
687 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
688 Source port or port range specification.
689 See the description of the
690 .B --source-port
691 option of the TCP extension for details.
692 .TP
693 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
694 Destination port or port range specification.
695 See the description of the
696 .B --destination-port
697 option of the TCP extension for details.
698 .SH TARGET EXTENSIONS
699 ip6tables can use extended target modules: the following are included
700 in the standard distribution.
701 .\" @TARGET@
702 .SS HL
703 This is used to modify the IPv6 HOPLIMIT header field.  The HOPLIMIT field is 
704 similar to what is known as TTL value in IPv4.  Setting or incrementing the
705 HOPLIMIT field can potentially be very dangerous, so it should be avoided at
706 any cost.  
707 .TP
708 .B Don't ever set or increment the value on packets that leave your local network!
709 .B mangle
710 table.
711 .TP
712 .BI "--hl-set " "value"
713 Set the HOPLIMIT value to `value'.
714 .TP
715 .BI "--hl-dec " "value"
716 Decrement the HOPLIMIT value `value' times.
717 .TP
718 .BI "--hl-inc " "value"
719 Increment the HOPLIMIT value `value' times.
720 .SS LOG
721 Turn on kernel logging of matching packets.  When this option is set
722 for a rule, the Linux kernel will print some information on all
723 matching packets (like most IPv6 IPv6-header fields) via the kernel log
724 (where it can be read with
725 .I dmesg
726 or 
727 .IR syslogd (8)).
728 This is a "non-terminating target", i.e. rule traversal continues at
729 the next rule.  So if you want to LOG the packets you refuse, use two
730 separate rules with the same matching criteria, first using target LOG
731 then DROP (or REJECT).
732 .TP
733 .BI "--log-level " "level"
734 Level of logging (numeric or see \fIsyslog.conf\fP(5)).
735 .TP
736 .BI "--log-prefix " "prefix"
737 Prefix log messages with the specified prefix; up to 29 letters long,
738 and useful for distinguishing messages in the logs.
739 .TP
740 .B --log-tcp-sequence
741 Log TCP sequence numbers. This is a security risk if the log is
742 readable by users.
743 .TP
744 .B --log-tcp-options
745 Log options from the TCP packet header.
746 .TP
747 .B --log-ip-options
748 Log options from the IPv6 packet header.
749 .TP
750 .B --log-uid
751 Log the userid of the process which generated the packet.
752 .SS MARK
753 This is used to set the netfilter mark value associated with the
754 packet.  It is only valid in the
755 .B mangle
756 table.
757 .TP
758 .BI "--set-mark " "mark"
759 .SS REJECT
760 This is used to send back an error packet in response to the matched
761 packet: otherwise it is equivalent to 
762 .B DROP
763 so it is a terminating TARGET, ending rule traversal.
764 This target is only valid in the
765 .BR INPUT ,
766 .B FORWARD
767 and
768 .B OUTPUT
769 chains, and user-defined chains which are only called from those
770 chains.  The following option controls the nature of the error packet
771 returned:
772 .TP
773 .BI "--reject-with " "type"
774 The type given can be
775 .nf
776 .B " icmp6-no-route"
777 .B " no-route"
778 .B " icmp6-adm-prohibited"
779 .B " adm-prohibited"
780 .B " icmp6-addr-unreachable"
781 .B " addr-unreach"
782 .B " icmp6-port-unreachable"
783 .B " port-unreach"
784 .fi
785 which return the appropriate IPv6-ICMP error message (\fBport-unreach\fP is
786 the default). Finally, the option
787 .B tcp-reset
788 can be used on rules which only match the TCP protocol: this causes a
789 TCP RST packet to be sent back.  This is mainly useful for blocking 
790 .I ident
791 (113/tcp) probes which frequently occur when sending mail to broken mail
792 hosts (which won't accept your mail otherwise).
793
794 .SS ROUTE
795 This is used to explicitly override the core network stack's routing decision.
796 .B mangle
797 table.
798 .TP
799 .BI "--oif " "ifname"
800 Route the packet through `ifname' network interface
801 .TP
802 .BI "--gw " "IPv6_address"
803 Route the packet via this gateway
804 .TP
805 .BI "--continue "
806 Behave like a non-terminating target and continue traversing the rules. Not valid in combination with `--tee'
807 .TP
808 .BI "--tee "
809 Make a copy of the packet, and route that copy to the given destination. For the original, uncopied packet, behave like a non-terminating target and continue traversing the rules.  Not valid in combination with `--continue'
810 .SS TRACE
811 This target has no options.  It just turns on 
812 .B packet tracing
813 for all packets that match this rule.
814 .SH DIAGNOSTICS
815 Various error messages are printed to standard error.  The exit code
816 is 0 for correct functioning.  Errors which appear to be caused by
817 invalid or abused command line parameters cause an exit code of 2, and
818 other errors cause an exit code of 1.
819 .SH BUGS
820 Bugs?  What's this? ;-)
821 Well... the counters are not reliable on sparc64.
822 .SH COMPATIBILITY WITH IPCHAINS
823 This 
824 .B ip6tables
825 is very similar to ipchains by Rusty Russell.  The main difference is
826 that the chains 
827 .B INPUT
828 and
829 .B OUTPUT
830 are only traversed for packets coming into the local host and
831 originating from the local host respectively.  Hence every packet only
832 passes through one of the three chains (except loopback traffic, which
833 involves both INPUT and OUTPUT chains); previously a forwarded packet
834 would pass through all three.
835 .PP
836 The other main difference is that 
837 .B -i
838 refers to the input interface;
839 .B -o
840 refers to the output interface, and both are available for packets
841 entering the
842 .B FORWARD
843 chain.
844 .\" .PP The various forms of NAT have been separated out; 
845 .\" .B iptables 
846 .\" is a pure packet filter when using the default `filter' table, with
847 .\" optional extension modules.  This should simplify much of the previous
848 .\" confusion over the combination of IP masquerading and packet filtering
849 .\" seen previously.  So the following options are handled differently:
850 .\" .br
851 .\" -j MASQ
852 .\" .br
853 .\" -M -S
854 .\" .br
855 .\" -M -L
856 .\" .br
857 There are several other changes in ip6tables.
858 .SH SEE ALSO
859 .BR ip6tables-save (8),
860 .BR ip6tables-restore(8),
861 .BR iptables (8),
862 .BR iptables-save (8),
863 .BR iptables-restore (8).
864 .P
865 The packet-filtering-HOWTO details iptables usage for
866 packet filtering, the NAT-HOWTO details NAT,
867 the netfilter-extensions-HOWTO details the extensions that are
868 not in the standard distribution,
869 and the netfilter-hacking-HOWTO details the netfilter internals.
870 .br
871 See
872 .BR "http://www.netfilter.org/" .
873 .SH AUTHORS
874 Rusty Russell wrote iptables, in early consultation with Michael
875 Neuling.
876 .PP
877 Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
878 selection framework in iptables, then wrote the mangle table, the owner match,
879 the mark stuff, and ran around doing cool stuff everywhere.
880 .PP
881 James Morris wrote the TOS target, and tos match.
882 .PP
883 Jozsef Kadlecsik wrote the REJECT target.
884 .PP
885 Harald Welte wrote the ULOG target, TTL match+target and libipulog.
886 .PP
887 The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Jozsef Kadlecsik,
888 James Morris, Harald Welte and Rusty Russell.
889 .PP
890 ip6tables man page created by Andras Kis-Szabo, based on
891 iptables man page written by Herve Eychenne <rv@wallfire.org>.
892 .\" .. and did I mention that we are incredibly cool people?
893 .\" .. sexy, too ..
894 .\" .. witty, charming, powerful ..
895 .\" .. and most of all, modest ..