Merge commit 'origin/trunk@12184' into fedora
[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 .SS tcp
376 These extensions are loaded if `--protocol tcp' is specified. It
377 provides the following options:
378 .TP
379 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
380 Source port or port range specification. This can either be a service
381 name or a port number. An inclusive range can also be specified,
382 using the format
383 .IR port : port .
384 If the first port is omitted, "0" is assumed; if the last is omitted,
385 "65535" is assumed.
386 If the second port greater then the first they will be swapped.
387 The flag
388 .B --sport
389 is a convenient alias for this option.
390 .TP
391 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
392 Destination port or port range specification.  The flag
393 .B --dport
394 is a convenient alias for this option.
395 .TP
396 .BR "--tcp-flags " "[!] \fImask\fP \fIcomp\fP"
397 Match when the TCP flags are as specified.  The first argument is the
398 flags which we should examine, written as a comma-separated list, and
399 the second argument is a comma-separated list of flags which must be
400 set.  Flags are: 
401 .BR "SYN ACK FIN RST URG PSH ALL NONE" .
402 Hence the command
403 .nf
404  ip6tables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
405 .fi
406 will only match packets with the SYN flag set, and the ACK, FIN and
407 RST flags unset.
408 .TP
409 .B "[!] --syn"
410 Only match TCP packets with the SYN bit set and the ACK and RST bits
411 cleared.  Such packets are used to request TCP connection initiation;
412 for example, blocking such packets coming in an interface will prevent
413 incoming TCP connections, but outgoing TCP connections will be
414 unaffected.
415 It is equivalent to \fB--tcp-flags SYN,RST,ACK SYN\fP.
416 If the "!" flag precedes the "--syn", the sense of the
417 option is inverted.
418 .TP
419 .BR "--tcp-option " "[!] \fInumber\fP"
420 Match if TCP option set.
421 .SS udp
422 These extensions are loaded if `--protocol udp' is specified.  It
423 provides the following options:
424 .TP
425 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
426 Source port or port range specification.
427 See the description of the
428 .B --source-port
429 option of the TCP extension for details.
430 .TP
431 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
432 Destination port or port range specification.
433 See the description of the
434 .B --destination-port
435 option of the TCP extension for details.
436 .SS ipv6-icmp
437 This extension is loaded if `--protocol ipv6-icmp' or `--protocol icmpv6' is
438 specified. It provides the following option:
439 .TP
440 .BR "--icmpv6-type " "[!] \fItypename\fP"
441 This allows specification of the ICMP type, which can be a numeric
442 IPv6-ICMP type, or one of the IPv6-ICMP type names shown by the command
443 .nf
444  ip6tables -p ipv6-icmp -h
445 .fi
446 .SS mac
447 .TP
448 .BR "--mac-source " "[!] \fIaddress\fP"
449 Match source MAC address.  It must be of the form XX:XX:XX:XX:XX:XX.
450 Note that this only makes sense for packets coming from an Ethernet device
451 and entering the
452 .BR PREROUTING ,
453 .B FORWARD
454 or
455 .B INPUT
456 chains.
457 .SS limit
458 This module matches at a limited rate using a token bucket filter.
459 A rule using this extension will match until this limit is reached
460 (unless the `!' flag is used).  It can be used in combination with the
461 .B LOG
462 target to give limited logging, for example.
463 .TP
464 .BI "--limit " "rate"
465 Maximum average matching rate: specified as a number, with an optional
466 `/second', `/minute', `/hour', or `/day' suffix; the default is
467 3/hour.
468 .TP
469 .BI "--limit-burst " "number"
470 Maximum initial number of packets to match: this number gets
471 recharged by one every time the limit specified above is not reached,
472 up to this number; the default is 5.
473 .SS multiport
474 This module matches a set of source or destination ports.  Up to 15
475 ports can be specified.  It can only be used in conjunction with
476 .B "-p tcp"
477 or
478 .BR "-p udp" .
479 .TP
480 .BR "--source-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
481 Match if the source port is one of the given ports.  The flag
482 .B --sports
483 is a convenient alias for this option.
484 .TP
485 .BR "--destination-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
486 Match if the destination port is one of the given ports.  The flag
487 .B --dports
488 is a convenient alias for this option.
489 .TP
490 .BR "--ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
491 Match if the both the source and destination ports are equal to each
492 other and to one of the given ports.
493 .SS mark
494 This module matches the netfilter mark field associated with a packet
495 (which can be set using the
496 .B MARK
497 target below).
498 .TP
499 .BR "--mark " "\fIvalue\fP[/\fImask\fP]"
500 Matches packets with the given unsigned mark value (if a mask is
501 specified, this is logically ANDed with the mask before the
502 comparison).
503 .SS owner
504 This module attempts to match various characteristics of the packet
505 creator, for locally-generated packets.  It is only valid in the
506 .B OUTPUT
507 chain, and even this some packets (such as ICMP ping responses) may
508 have no owner, and hence never match.  This is regarded as experimental.
509 .TP
510 .BI "--uid-owner " "userid"
511 Matches if the packet was created by a process with the given
512 effective user id.
513 .TP
514 .BI "--gid-owner " "groupid"
515 Matches if the packet was created by a process with the given
516 effective group id.
517 .TP
518 .BI "--pid-owner " "processid"
519 Matches if the packet was created by a process with the given
520 process id.
521 .TP
522 .BI "--sid-owner " "sessionid"
523 Matches if the packet was created by a process in the given session
524 group.
525 .\" .SS state
526 .\" This module, when combined with connection tracking, allows access to
527 .\" the connection tracking state for this packet.
528 .\" .TP
529 .\" .BI "--state " "state"
530 .\" Where state is a comma separated list of the connection states to
531 .\" match.  Possible states are 
532 .\" .B INVALID
533 .\" meaning that the packet is associated with no known connection,
534 .\" .B ESTABLISHED
535 .\" meaning that the packet is associated with a connection which has seen
536 .\" packets in both directions,
537 .\" .B NEW
538 .\" meaning that the packet has started a new connection, or otherwise
539 .\" associated with a connection which has not seen packets in both
540 .\" directions, and
541 .\" .B RELATED
542 .\" meaning that the packet is starting a new connection, but is
543 .\" associated with an existing connection, such as an FTP data transfer,
544 .\" or an ICMP error.
545 .\" .SS unclean
546 .\" This module takes no options, but attempts to match packets which seem
547 .\" malformed or unusual.  This is regarded as experimental.
548 .\" .SS tos
549 .\" This module matches the 8 bits of Type of Service field in the IP
550 .\" header (ie. including the precedence bits). 
551 .\" .TP
552 .\" .BI "--tos " "tos"
553 .\" The argument is either a standard name, (use
554 .\" .br
555 .\" iptables -m tos -h
556 .\" .br
557 .\" to see the list), or a numeric value to match.
558 .SH TARGET EXTENSIONS
559 ip6tables can use extended target modules: the following are included
560 in the standard distribution.
561 .SS LOG
562 Turn on kernel logging of matching packets.  When this option is set
563 for a rule, the Linux kernel will print some information on all
564 matching packets (like most IPv6 IPv6-header fields) via the kernel log
565 (where it can be read with
566 .I dmesg
567 or 
568 .IR syslogd (8)).
569 This is a "non-terminating target", i.e. rule traversal continues at
570 the next rule.  So if you want to LOG the packets you refuse, use two
571 separate rules with the same matching criteria, first using target LOG
572 then DROP (or REJECT).
573 .TP
574 .BI "--log-level " "level"
575 Level of logging (numeric or see \fIsyslog.conf\fP(5)).
576 .TP
577 .BI "--log-prefix " "prefix"
578 Prefix log messages with the specified prefix; up to 29 letters long,
579 and useful for distinguishing messages in the logs.
580 .TP
581 .B --log-tcp-sequence
582 Log TCP sequence numbers. This is a security risk if the log is
583 readable by users.
584 .TP
585 .B --log-tcp-options
586 Log options from the TCP packet header.
587 .TP
588 .B --log-ip-options
589 Log options from the IPv6 packet header.
590 .SS MARK
591 This is used to set the netfilter mark value associated with the
592 packet.  It is only valid in the
593 .B mangle
594 table.
595 .TP
596 .BI "--set-mark " "mark"
597 .SS REJECT
598 This is used to send back an error packet in response to the matched
599 packet: otherwise it is equivalent to 
600 .B DROP
601 so it is a terminating TARGET, ending rule traversal.
602 This target is only valid in the
603 .BR INPUT ,
604 .B FORWARD
605 and
606 .B OUTPUT
607 chains, and user-defined chains which are only called from those
608 chains.  The following option controls the nature of the error packet
609 returned:
610 .TP
611 .BI "--reject-with " "type"
612 The type given can be
613 .nf
614 .B " icmp6-no-route"
615 .B " no-route"
616 .B " icmp6-adm-prohibited"
617 .B " adm-prohibited"
618 .B " icmp6-addr-unreachable"
619 .B " addr-unreach"
620 .B " icmp6-port-unreachable"
621 .B " port-unreach"
622 .fi
623 which return the appropriate IPv6-ICMP error message (\fBport-unreach\fP is
624 the default). Finally, the option
625 .B tcp-reset
626 can be used on rules which only match the TCP protocol: this causes a
627 TCP RST packet to be sent back.  This is mainly useful for blocking 
628 .I ident
629 (113/tcp) probes which frequently occur when sending mail to broken mail
630 hosts (which won't accept your mail otherwise).
631 .\" .SS TOS
632 .\" This is used to set the 8-bit Type of Service field in the IP header.
633 .\" It is only valid in the
634 .\" .B mangle
635 .\" table.
636 .\" .TP
637 .\" .BI "--set-tos " "tos"
638 .\" You can use a numeric TOS values, or use
639 .\" .br
640 .\" iptables -j TOS -h
641 .\" .br
642 .\" to see the list of valid TOS names.
643 .\" .SS MIRROR
644 .\" This is an experimental demonstration target which inverts the source
645 .\" and destination fields in the IP header and retransmits the packet.
646 .\" It is only valid in the
647 .\" .BR INPUT ,
648 .\" .B FORWARD
649 .\" and 
650 .\" .B PREROUTING
651 .\" chains, and user-defined chains which are only called from those
652 .\" chains.  Note that the outgoing packets are
653 .\" .B NOT
654 .\" seen by any packet filtering chains, connection tracking or NAT, to
655 .\" avoid loops and other problems.
656 .\" .SS SNAT
657 .\" This target is only valid in the 
658 .\" .B nat
659 .\" table, in the 
660 .\" .B POSTROUTING
661 .\" chain.  It specifies that the source address of the packet should be
662 .\" modified (and all future packets in this connection will also be
663 .\" mangled), and rules should cease being examined.  It takes one option:
664 .\" .TP
665 .\" .BR "--to-source  " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
666 .\" which can specify a single new source IP address, an inclusive range
667 .\" of IP addresses, and optionally, a port range (which is only valid if
668 .\" the rule also specifies
669 .\" .B "-p tcp"
670 .\" or
671 .\" .BR "-p udp" ).
672 .\" If no port range is specified, then source ports below 512 will be
673 .\" mapped to other ports below 512: those between 512 and 1023 inclusive
674 .\" will be mapped to ports below 1024, and other ports will be mapped to
675 .\" 1024 or above. Where possible, no port alteration will occur.
676 .\" .SS DNAT
677 .\" This target is only valid in the 
678 .\" .B nat
679 .\" table, in the 
680 .\" .B PREROUTING
681 .\" and
682 .\" .B OUTPUT
683 .\" chains, and user-defined chains which are only called from those
684 .\" chains.  It specifies that the destination address of the packet
685 .\" should be modified (and all future packets in this connection will
686 .\" also be mangled), and rules should cease being examined.  It takes one
687 .\" option:
688 .\" .TP
689 .\" .BR "--to-destination " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
690 .\" which can specify a single new destination IP address, an inclusive
691 .\" range of IP addresses, and optionally, a port range (which is only
692 .\" valid if the rule also specifies
693 .\" .B "-p tcp"
694 .\" or
695 .\" .BR "-p udp" ).
696 .\" If no port range is specified, then the destination port will never be
697 .\" modified.
698 .\" .SS MASQUERADE
699 .\" This target is only valid in the 
700 .\" .B nat
701 .\" table, in the 
702 .\" .B POSTROUTING
703 .\" chain.  It should only be used with dynamically assigned IP (dialup)
704 .\" connections: if you have a static IP address, you should use the SNAT
705 .\" target.  Masquerading is equivalent to specifying a mapping to the IP
706 .\" address of the interface the packet is going out, but also has the
707 .\" effect that connections are 
708 .\" .I forgotten
709 .\" when the interface goes down.  This is the correct behavior when the
710 .\" next dialup is unlikely to have the same interface address (and hence
711 .\" any established connections are lost anyway).  It takes one option:
712 .\" .TP
713 .\" .BR "--to-ports " "\fIport\fP[-\fIport\fP]"
714 .\" This specifies a range of source ports to use, overriding the default 
715 .\" .B SNAT
716 .\" source port-selection heuristics (see above).  This is only valid
717 .\" if the rule also specifies
718 .\" .B "-p tcp"
719 .\" or
720 .\" .BR "-p udp" .
721 .\" .SS REDIRECT
722 .\" This target is only valid in the 
723 .\" .B nat
724 .\" table, in the 
725 .\" .B PREROUTING
726 .\" and
727 .\" .B OUTPUT
728 .\" chains, and user-defined chains which are only called from those
729 .\" chains.  It alters the destination IP address to send the packet to
730 .\" the machine itself (locally-generated packets are mapped to the
731 .\" 127.0.0.1 address).  It takes one option:
732 .\" .TP
733 .\" .BR "--to-ports " "\fIport\fP[-\fIport\fP]"
734 .\" This specifies a destination port or range of ports to use: without
735 .\" this, the destination port is never altered.  This is only valid
736 .\" if the rule also specifies
737 .\" .B "-p tcp"
738 .\" or
739 .\" .BR "-p udp" .
740 .SH DIAGNOSTICS
741 Various error messages are printed to standard error.  The exit code
742 is 0 for correct functioning.  Errors which appear to be caused by
743 invalid or abused command line parameters cause an exit code of 2, and
744 other errors cause an exit code of 1.
745 .SH BUGS
746 Bugs?  What's this? ;-)
747 Well... the counters are not reliable on sparc64.
748 .SH COMPATIBILITY WITH IPCHAINS
749 This 
750 .B ip6tables
751 is very similar to ipchains by Rusty Russell.  The main difference is
752 that the chains 
753 .B INPUT
754 and
755 .B OUTPUT
756 are only traversed for packets coming into the local host and
757 originating from the local host respectively.  Hence every packet only
758 passes through one of the three chains (except loopback traffic, which
759 involves both INPUT and OUTPUT chains); previously a forwarded packet
760 would pass through all three.
761 .PP
762 The other main difference is that 
763 .B -i
764 refers to the input interface;
765 .B -o
766 refers to the output interface, and both are available for packets
767 entering the
768 .B FORWARD
769 chain.
770 .\" .PP The various forms of NAT have been separated out; 
771 .\" .B iptables 
772 .\" is a pure packet filter when using the default `filter' table, with
773 .\" optional extension modules.  This should simplify much of the previous
774 .\" confusion over the combination of IP masquerading and packet filtering
775 .\" seen previously.  So the following options are handled differently:
776 .\" .br
777 .\" -j MASQ
778 .\" .br
779 .\" -M -S
780 .\" .br
781 .\" -M -L
782 .\" .br
783 There are several other changes in ip6tables.
784 .SH SEE ALSO
785 .BR ip6tables-save (8),
786 .BR ip6tables-restore(8),
787 .BR iptables (8),
788 .BR iptables-save (8),
789 .BR iptables-restore (8).
790 .P
791 The packet-filtering-HOWTO details iptables usage for
792 packet filtering, the NAT-HOWTO details NAT,
793 the netfilter-extensions-HOWTO details the extensions that are
794 not in the standard distribution,
795 and the netfilter-hacking-HOWTO details the netfilter internals.
796 .br
797 See
798 .BR "http://www.netfilter.org/" .
799 .SH AUTHORS
800 Rusty Russell wrote iptables, in early consultation with Michael
801 Neuling.
802 .PP
803 Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
804 selection framework in iptables, then wrote the mangle table, the owner match,
805 the mark stuff, and ran around doing cool stuff everywhere.
806 .PP
807 James Morris wrote the TOS target, and tos match.
808 .PP
809 Jozsef Kadlecsik wrote the REJECT target.
810 .PP
811 Harald Welte wrote the ULOG target, TTL match+target and libipulog.
812 .PP
813 The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Jozsef Kadlecsik,
814 James Morris, Harald Welte and Rusty Russell.
815 .PP
816 ip6tables man page created by Andras Kis-Szabo, based on
817 iptables man page written by Herve Eychenne <rv@wallfire.org>.
818 .\" .. and did I mention that we are incredibly cool people?
819 .\" .. sexy, too ..
820 .\" .. witty, charming, powerful ..
821 .\" .. and most of all, modest ..