311a0303206dd52926ee90c58a5348a54babf710
[iptables.git] / iptables.8
1 .TH IPTABLES 8 "Mar 09, 2002" "" ""
2 .\"
3 .\" Man page written by Herve Eychenne <rv@wallfire.org> (May 1999)
4 .\" It is based on ipchains page.
5 .\" TODO: add a word for protocol helpers (FTP, IRC, SNMP-ALG)
6 .\"
7 .\" ipchains page by Paul ``Rusty'' Russell March 1997
8 .\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl>
9 .\"
10 .\"     This program is free software; you can redistribute it and/or modify
11 .\"     it under the terms of the GNU General Public License as published by
12 .\"     the Free Software Foundation; either version 2 of the License, or
13 .\"     (at your option) any later version.
14 .\"
15 .\"     This program is distributed in the hope that it will be useful,
16 .\"     but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\"     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\"     GNU General Public License for more details.
19 .\"
20 .\"     You should have received a copy of the GNU General Public License
21 .\"     along with this program; if not, write to the Free Software
22 .\"     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 .\"
24 .\"
25 .SH NAME
26 iptables \- administration tool for IPv4 packet filtering and NAT
27 .SH SYNOPSIS
28 .BR "iptables [-t table] -[AD] " "chain rule-specification [options]"
29 .br
30 .BR "iptables [-t table] -I " "chain [rulenum] rule-specification [options]"
31 .br
32 .BR "iptables [-t table] -R " "chain rulenum rule-specification [options]"
33 .br
34 .BR "iptables [-t table] -D " "chain rulenum [options]"
35 .br
36 .BR "iptables [-t table] -[LFZ] " "[chain] [options]"
37 .br
38 .BR "iptables [-t table] -N " "chain"
39 .br
40 .BR "iptables [-t table] -X " "[chain]"
41 .br
42 .BR "iptables [-t table] -P " "chain target [options]"
43 .br
44 .BR "iptables [-t table] -E " "old-chain-name new-chain-name"
45 .SH DESCRIPTION
46 .B Iptables
47 is used to set up, maintain, and inspect the tables of IP packet
48 filter rules in the Linux kernel.  Several different tables
49 may be defined.  Each table contains a number of built-in
50 chains and may also contain user-defined chains.
51
52 Each chain is a list of rules which can match a set of packets.  Each
53 rule specifies what to do with a packet that matches.  This is called
54 a `target', which may be a jump to a user-defined chain in the same
55 table.
56
57 .SH TARGETS
58 A firewall rule specifies criteria for a packet, and a target.  If the
59 packet does not match, the next rule in the chain is the examined; if
60 it does match, then the next rule is specified by the value of the
61 target, which can be the name of a user-defined chain or one of the
62 special values 
63 .IR ACCEPT ,
64 .IR DROP ,
65 .IR QUEUE ,
66 or
67 .IR RETURN .
68 .PP
69 .I ACCEPT 
70 means to let the packet through.
71 .I DROP
72 means to drop the packet on the floor.
73 .I QUEUE
74 means to pass the packet to userspace (if supported by the kernel).
75 .I RETURN
76 means stop traversing this chain and resume at the next rule in the
77 previous (calling) chain.  If the end of a built-in chain is reached
78 or a rule in a built-in chain with target
79 .I RETURN
80 is matched, the target specified by the chain policy determines the
81 fate of the packet.
82 .SH TABLES
83 There are currently three independent tables (which tables are present
84 at any time depends on the kernel configuration options and which
85 modules are present).
86 .TP
87 .BI "-t, --table " "table"
88 This option specifies the packet matching table which the command
89 should operate on.  If the kernel is configured with automatic module
90 loading, an attempt will be made to load the appropriate module for
91 that table if it is not already there.
92
93 The tables are as follows:
94 .RS
95 .TP .4i
96 .BR "filter" :
97 This is the default table (if no -t option is passed).  It contains
98 the built-in chains
99 .B INPUT
100 (for packets destined to local sockets),
101 .B FORWARD
102 (for packets being routed through the box), and
103 .B OUTPUT
104 (for locally-generated packets).
105 .TP
106 .BR "nat" :
107 This table is consulted when a packet that creates a new
108 connection is encountered.  It consists of three built-ins:
109 .B PREROUTING
110 (for altering packets as soon as they come in),
111 .B OUTPUT
112 (for altering locally-generated packets before routing), and
113 .B POSTROUTING
114 (for altering packets as they are about to go out).
115 .TP
116 .BR "mangle" :
117 This table is used for specialized packet alteration.  Until kernel
118 2.4.17 it had two built-in chains:
119 .B PREROUTING
120 (for altering incoming packets before routing) and
121 .B OUTPUT
122 (for altering locally-generated packets before routing).
123 Since kernel 2.4.18, three other built-in chains are also supported:
124 .B INPUT
125 (for packets coming into the box itself),
126 .B FORWARD
127 (for altering packets being routed through the box), and
128 .B POSTROUTING
129 (for altering packets as they are about to go out).
130 .TP
131 .BR "raw" :
132 This table is used mainly for configuring exemptions from connection
133 tracking in combination with the NOTRACK target.  It registers at the netfilter
134 hooks with higher priority and is thus called before ip_conntrack, or any other
135 IP tables.  It provides the following built-in chains:
136 .B PREROUTING
137 (for packets arriving via any network interface)
138 .B OUTPUT
139 (for packets generated by local processes)
140 .RE
141 .SH OPTIONS
142 The options that are recognized by
143 .B iptables
144 can be divided into several different groups.
145 .SS COMMANDS
146 These options specify the specific action to perform.  Only one of them
147 can be specified on the command line unless otherwise specified
148 below.  For all the long versions of the command and option names, you
149 need to use only enough letters to ensure that
150 .B iptables
151 can differentiate it from all other options.
152 .TP
153 .BI "-A, --append " "chain rule-specification"
154 Append one or more rules to the end of the selected chain.
155 When the source and/or destination names resolve to more than one
156 address, a rule will be added for each possible address combination.
157 .TP
158 .BI "-D, --delete " "chain rule-specification"
159 .ns
160 .TP
161 .BI "-D, --delete " "chain rulenum"
162 Delete one or more rules from the selected chain.  There are two
163 versions of this command: the rule can be specified as a number in the
164 chain (starting at 1 for the first rule) or a rule to match.
165 .TP
166 .BR "-I, --insert " "\fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP"
167 Insert one or more rules in the selected chain as the given rule
168 number.  So, if the rule number is 1, the rule or rules are inserted
169 at the head of the chain.  This is also the default if no rule number
170 is specified.
171 .TP
172 .BI "-R, --replace " "chain rulenum rule-specification"
173 Replace a rule in the selected chain.  If the source and/or
174 destination names resolve to multiple addresses, the command will
175 fail.  Rules are numbered starting at 1.
176 .TP
177 .BR "-L, --list " "[\fIchain\fP]"
178 List all rules in the selected chain.  If no chain is selected, all
179 chains are listed.  As every other iptables command, it applies to the
180 specified table (filter is the default), so NAT rules get listed by
181 .nf
182  iptables -t nat -n -L
183 .fi
184 Please note that it is often used with the
185 .B -n
186 option, in order to avoid long reverse DNS lookups.
187 It is legal to specify the
188 .B -Z
189 (zero) option as well, in which case the chain(s) will be atomically
190 listed and zeroed.  The exact output is affected by the other
191 arguments given. The exact rules are suppressed until you use
192 .nf
193  iptables -L -v
194 .fi
195 .TP
196 .BR "-F, --flush " "[\fIchain\fP]"
197 Flush the selected chain (all the chains in the table if none is given).
198 This is equivalent to deleting all the rules one by one.
199 .TP
200 .BR "-Z, --zero " "[\fIchain\fP]"
201 Zero the packet and byte counters in all chains.  It is legal to
202 specify the
203 .B "-L, --list"
204 (list) option as well, to see the counters immediately before they are
205 cleared. (See above.)
206 .TP
207 .BI "-N, --new-chain " "chain"
208 Create a new user-defined chain by the given name.  There must be no
209 target of that name already.
210 .TP
211 .BR "-X, --delete-chain " "[\fIchain\fP]"
212 Delete the optional user-defined chain specified.  There must be no references
213 to the chain.  If there are, you must delete or replace the referring
214 rules before the chain can be deleted.  If no argument is given, it
215 will attempt to delete every non-builtin chain in the table.
216 .TP
217 .BI "-P, --policy " "chain target"
218 Set the policy for the chain to the given target.  See the section
219 .B TARGETS
220 for the legal targets.  Only built-in (non-user-defined) chains can have
221 policies, and neither built-in nor user-defined chains can be policy
222 targets.
223 .TP
224 .BI "-E, --rename-chain " "old-chain new-chain"
225 Rename the user specified chain to the user supplied name.  This is
226 cosmetic, and has no effect on the structure of the table.
227 .TP
228 .B -h
229 Help.
230 Give a (currently very brief) description of the command syntax.
231 .SS PARAMETERS
232 The following parameters make up a rule specification (as used in the
233 add, delete, insert, replace and append commands).
234 .TP
235 .BR "-p, --protocol " "[!] \fIprotocol\fP"
236 The protocol of the rule or of the packet to check.
237 The specified protocol can be one of
238 .IR tcp ,
239 .IR udp ,
240 .IR icmp ,
241 or
242 .IR all ,
243 or it can be a numeric value, representing one of these protocols or a
244 different one.  A protocol name from /etc/protocols is also allowed.
245 A "!" argument before the protocol inverts the
246 test.  The number zero is equivalent to
247 .IR all .
248 Protocol
249 .I all
250 will match with all protocols and is taken as default when this
251 option is omitted.
252 .TP
253 .BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
254 Source specification.
255 .I Address
256 can be either a network name, a hostname (please note that specifying
257 any name to be resolved with a remote query such as DNS is a really bad idea),
258 a network IP address (with /mask), or a plain IP address.
259 The
260 .I mask
261 can be either a network mask or a plain number,
262 specifying the number of 1's at the left side of the network mask.
263 Thus, a mask of
264 .I 24
265 is equivalent to
266 .IR 255.255.255.0 .
267 A "!" argument before the address specification inverts the sense of
268 the address. The flag
269 .B --src
270 is an alias for this option.
271 .TP
272 .BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
273 Destination specification. 
274 See the description of the
275 .B -s
276 (source) flag for a detailed description of the syntax.  The flag
277 .B --dst
278 is an alias for this option.
279 .TP
280 .BI "-j, --jump " "target"
281 This specifies the target of the rule; i.e., what to do if the packet
282 matches it.  The target can be a user-defined chain (other than the
283 one this rule is in), one of the special builtin targets which decide
284 the fate of the packet immediately, or an extension (see
285 .B EXTENSIONS
286 below).  If this
287 option is omitted in a rule, then matching the rule will have no
288 effect on the packet's fate, but the counters on the rule will be
289 incremented.
290 .TP
291 .BR "-i, --in-interface " "[!] \fIname\fP"
292 Name of an interface via which a packet was received (only for
293 packets entering the 
294 .BR INPUT ,
295 .B FORWARD
296 and
297 .B PREROUTING
298 chains).  When the "!" argument is used before the interface name, the
299 sense is inverted.  If the interface name ends in a "+", then any
300 interface which begins with this name will match.  If this option is
301 omitted, any interface name will match.
302 .TP
303 .BR "-o, --out-interface " "[!] \fIname\fP"
304 Name of an interface via which a packet is going to be sent (for packets
305 entering the
306 .BR FORWARD ,
307 .B OUTPUT
308 and
309 .B POSTROUTING
310 chains).  When the "!" argument is used before the interface name, the
311 sense is inverted.  If the interface name ends in a "+", then any
312 interface which begins with this name will match.  If this option is
313 omitted, any interface name will match.
314 .TP
315 .B "[!] " "-f, --fragment"
316 This means that the rule only refers to second and further fragments
317 of fragmented packets.  Since there is no way to tell the source or
318 destination ports of such a packet (or ICMP type), such a packet will
319 not match any rules which specify them.  When the "!" argument
320 precedes the "-f" flag, the rule will only match head fragments, or
321 unfragmented packets.
322 .TP
323 .BI "-c, --set-counters " "PKTS BYTES"
324 This enables the administrator to initialize the packet and byte
325 counters of a rule (during
326 .B INSERT,
327 .B APPEND,
328 .B REPLACE
329 operations).
330 .SS "OTHER OPTIONS"
331 The following additional options can be specified:
332 .TP
333 .B "-v, --verbose"
334 Verbose output.  This option makes the list command show the interface
335 name, the rule options (if any), and the TOS masks.  The packet and
336 byte counters are also listed, with the suffix 'K', 'M' or 'G' for
337 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see
338 the
339 .B -x
340 flag to change this).
341 For appending, insertion, deletion and replacement, this causes
342 detailed information on the rule or rules to be printed.
343 .TP
344 .B "-n, --numeric"
345 Numeric output.
346 IP addresses and port numbers will be printed in numeric format.
347 By default, the program will try to display them as host names,
348 network names, or services (whenever applicable).
349 .TP
350 .B "-x, --exact"
351 Expand numbers.
352 Display the exact value of the packet and byte counters,
353 instead of only the rounded number in K's (multiples of 1000)
354 M's (multiples of 1000K) or G's (multiples of 1000M).  This option is
355 only relevant for the 
356 .B -L
357 command.
358 .TP
359 .B "--line-numbers"
360 When listing rules, add line numbers to the beginning of each rule,
361 corresponding to that rule's position in the chain.
362 .TP
363 .B "--modprobe=command"
364 When adding or inserting rules into a chain, use
365 .B command
366 to load any necessary modules (targets, match extensions, etc).
367 .SH MATCH EXTENSIONS
368 iptables can use extended packet matching modules.  These are loaded
369 in two ways: implicitly, when
370 .B -p
371 or
372 .B --protocol
373 is specified, or with the
374 .B -m
375 or
376 .B --match
377 options, followed by the matching module name; after these, various
378 extra command line options become available, depending on the specific
379 module.  You can specify multiple extended match modules in one line,
380 and you can use the
381 .B -h
382 or
383 .B --help
384 options after the module has been specified to receive help specific
385 to that module.
386
387 The following are included in the base package, and most of these can
388 be preceded by a
389 .B !
390 to invert the sense of the match.
391 .\" @MATCH@
392 .SS account
393 Account traffic for all hosts in defined network/netmask.
394
395 Features:
396
397 - long (one counter per protocol TCP/UDP/IMCP/Other) and short statistics
398
399 - one iptables rule for all hosts in network/netmask
400
401 - loading/saving counters (by reading/writting to procfs entries)
402
403 .TP
404 .BI "--aaddr " "network/netmask"
405 defines network/netmask for which make statistics.
406 .TP
407 .BI "--aname " "name"
408 defines name of list where statistics will be kept. If no is
409 specified DEFAULT will be used.
410 .TP
411 .B "--ashort"
412 table will colect only short statistics (only total counters
413 without splitting it into protocols.
414 .P
415 Example usage:
416
417 account traffic for/to 192.168.0.0/24 network into table mynetwork:
418
419 # iptables -A FORWARD -m account --aname mynetwork --aaddr 192.168.0.0/24
420
421 account traffic for/to WWW serwer for 192.168.0.0/24 network into table mywwwserver:
422
423 # iptables -A INPUT -p tcp --dport 80
424   -m account --aname mywwwserver --aaddr 192.168.0.0/24 --ashort
425
426 # iptables -A OUTPUT -p tcp --sport 80
427   -m account --aname mywwwserver --aaddr 192.168.0.0/24 --ashort
428
429 read counters:
430
431 # cat /proc/net/ipt_account/mynetwork
432 # cat /proc/net/ipt_account/mywwwserver
433
434 set counters:
435
436 # echo "ip = 192.168.0.1 packets_src = 0" > /proc/net/ipt_account/mywwserver
437
438 Webpage:
439   http://www.barbara.eu.org/~quaker/ipt_account/
440 .SS addrtype
441 This module matches packets based on their 
442 .B address type.
443 Address types are used within the kernel networking stack and categorize
444 addresses into various groups.  The exact definition of that group depends on the specific layer three protocol.
445 .TP
446 The following address types are possible:
447 .TP
448 .BI "UNSPEC"
449 an unspecified address (i.e. 0.0.0.0)
450 .BI "UNICAST"
451 an unicast address
452 .BI "LOCAL"
453 a local address
454 .BI "BROADCAST"
455 a broadcast address
456 .BI "ANYCAST"
457 an anycast packet
458 .BI "MULTICAST"
459 a multicast address
460 .BI "BLACKHOLE"
461 a blackhole address
462 .BI "UNREACHABLE"
463 an unreachable address
464 .BI "PROHIBIT"
465 a prohibited address
466 .BI "THROW"
467 FIXME
468 .BI "NAT"
469 FIXME
470 .BI "XRESOLVE"
471 FIXME
472 .TP
473 .BI "--src-type " "type"
474 Matches if the source address is of given type
475 .TP
476 .BI "--dst-type " "type"
477 Matches if the destination address is of given type
478 .SS ah
479 This module matches the SPIs in AH header of IPSec packets.
480 .TP
481 .BR "--ahspi " "[!] \fIspi\fP[:\fIspi\fP]"
482 .SS childlevel
483 This is an experimental module.  It matches on whether the 
484 packet is part of a master connection or one of its children (or grandchildren,
485 etc).  For instance, most packets are level 0.  FTP data transfer is level 1.
486 .TP
487 .BR "--childlevel " "[!] \fIlevel\fP"
488 .SS comment
489 Allows you to add comments (up to 256 characters) to any rule.
490 .TP
491 .BI "--comment " "comment"
492 .TP
493 Example:
494 iptables -A INPUT -s 192.168.0.0/16 -m comment --comment "A privatized IP block"
495 .SS condition
496 This matches if a specific /proc filename is '0' or '1'.
497 .TP
498 .BI "--condition " "[!] filename"
499 Match on boolean value stored in /proc/net/ipt_condition/filename file
500 .SS connbytes
501 Match by how many bytes or packets a connection (or one of the two
502 flows constituting the connection) have tranferred so far, or by
503 average bytes per packet.
504
505 The counters are 64bit and are thus not expected to overflow ;)
506
507 The primary use is to detect long-lived downloads and mark them to be
508 scheduled using a lower priority band in traffic control.
509
510 The transfered bytes per connection can also be viewed through
511 /proc/net/ip_conntrack and accessed via ctnetlink
512 .TP
513 [\fB!\fR]\fB --connbytes \fIfrom\fB:\fR[\fIto\fR]
514 match packets from a connection whose packets/bytes/average packet
515 size is more than FROM and less than TO bytes/packets. if TO is
516 omitted only FROM check is done. "!" is used to match packets not
517 falling in the range.
518 .TP
519 \fB--connbytes-dir\fR [\fBoriginal\fR|\fBreply\fR|\fBboth\fR]
520 which packets to consider
521 .TP
522 \fB--connbytes-mode\fR [\fBpackets\fR|\fBbytes\fR|\fBavgpkt\fR]
523 whether to check the amount of packets, number of bytes transferred or
524 the average size (in bytes) of all packets received so far. Note that
525 when "both" is used together with "avgpkt", and data is going (mainly)
526 only in one direction (for example HTTP), the average packet size will
527 be about half of the actual data packets.
528 .TP
529 Example:
530 iptables .. -m connbytes --connbytes 10000:100000 --connbytes-dir both --connbytes-mode bytes ...
531 .SS connlimit
532 Allows you to restrict the number of parallel TCP connections to a
533 server per client IP address (or address block).
534 .TP
535 [\fB!\fR] \fB--connlimit-above \fIn\fR
536 match if the number of existing tcp connections is (not) above n
537 .TP
538 .BI "--connlimit-mask " "bits"
539 group hosts using mask
540 .P
541 Examples:
542 .TP
543 # allow 2 telnet connections per client host
544 iptables -p tcp --syn --dport 23 -m connlimit --connlimit-above 2 -j REJECT
545 .TP
546 # you can also match the other way around:
547 iptables -p tcp --syn --dport 23 -m connlimit ! --connlimit-above 2 -j ACCEPT
548 .TP
549 # limit the nr of parallel http requests to 16 per class C sized \
550 network (24 bit netmask)
551 iptables -p tcp --syn --dport 80 -m connlimit --connlimit-above 16
552 --connlimit-mask 24 -j REJECT
553 .SS connmark
554 This module matches the netfilter mark field associated with a connection
555 (which can be set using the
556 .B CONNMARK
557 target below).
558 .TP
559 .BI "--mark " "value[/mask]"
560 Matches packets in connections with the given mark value (if a mask is
561 specified, this is logically ANDed with the mark before the
562 comparison).
563 .SS connrate
564 This module matches the current transfer rate in a connection.
565 .TP
566 .BI "--connrate " "[!] [\fIfrom\fP]:[\fIto\fP]"
567 Match against the current connection transfer rate being within 'from'
568 and 'to' bytes per second. When the "!" argument is used before the
569 range, the sense of the match is inverted.
570 .SS conntrack
571 This module, when combined with connection tracking, allows access to
572 more connection tracking information than the "state" match.
573 (this module is present only if iptables was compiled under a kernel
574 supporting this feature)
575 .TP
576 .BI "--ctstate " "state"
577 Where state is a comma separated list of the connection states to
578 match.  Possible states are
579 .B INVALID
580 meaning that the packet is associated with no known connection,
581 .B ESTABLISHED
582 meaning that the packet is associated with a connection which has seen
583 packets in both directions,
584 .B NEW
585 meaning that the packet has started a new connection, or otherwise
586 associated with a connection which has not seen packets in both
587 directions, and
588 .B RELATED
589 meaning that the packet is starting a new connection, but is
590 associated with an existing connection, such as an FTP data transfer,
591 or an ICMP error.
592 .B SNAT
593 A virtual state, matching if the original source address differs from
594 the reply destination.
595 .B DNAT
596 A virtual state, matching if the original destination differs from the
597 reply source.
598 .TP
599 .BI "--ctproto " "proto"
600 Protocol to match (by number or name)
601 .TP
602 .BI "--ctorigsrc " "[!] \fIaddress\fP[/\fImask\fP]"
603 Match against original source address
604 .TP
605 .BI "--ctorigdst " "[!] \fIaddress\fP[/\fImask\fP]"
606 Match against original destination address
607 .TP
608 .BI "--ctreplsrc " "[!] \fIaddress\fP[/\fImask\fP]"
609 Match against reply source address
610 .TP
611 .BI "--ctrepldst " "[!] \fIaddress\fB[/\fImask\fP]"
612 Match against reply destination address
613 .TP
614 .BI "--ctstatus " "[\fINONE|EXPECTED|SEEN_REPLY|ASSURED\fP][,...]"
615 Match against internal conntrack states
616 .TP
617 .BI "--ctexpire " "\fItime\fP[\fI:time\fP]"
618 Match remaining lifetime in seconds against given value
619 or range of values (inclusive)
620 .SS dscp
621 This module matches the 6 bit DSCP field within the TOS field in the
622 IP header.  DSCP has superseded TOS within the IETF.
623 .TP
624 .BI "--dscp " "value"
625 Match against a numeric (decimal or hex) value [0-32].
626 .TP
627 .BI "--dscp-class " "\fIDiffServ Class\fP"
628 Match the DiffServ class. This value may be any of the
629 BE, EF, AFxx or CSx classes.  It will then be converted
630 into it's according numeric value.
631 .SS dstlimit
632 This module allows you to limit the packet per second (pps) rate on a per
633 destination IP or per destination port base.  As opposed to the `limit' match,
634 every destination ip / destination port has it's own limit.
635 .TP
636 .BI "--dstlimit " "avg"
637 Maximum average match rate (packets per second unless followed by /sec /minute /hour /day postfixes).
638 .TP
639 .BI "--dstlimit-mode " "mode"
640 The limiting hashmode.  Is the specified limit per
641 .B dstip, dstip-dstport
642 tuple, 
643 .B srcip-dstip
644 tuple, or per
645 .B srcipdstip-dstport
646 tuple.
647 .TP
648 .BI "--dstlimit-name " "name"
649 Name for /proc/net/ipt_dstlimit/* file entry
650 .TP
651 .BI "[" "--dstlimit-burst " "burst" "]"
652 Number of packets to match in a burst.  Default: 5
653 .TP
654 .BI "[" "--dstlimit-htable-size " "size" "]"
655 Number of buckets in the hashtable
656 .TP
657 .BI "[" "--dstlimit-htable-max " "max" "]"
658 Maximum number of entries in the hashtable
659 .TP
660 .BI "[" "--dstlimit-htable-gcinterval " "interval" "]"
661 Interval between garbage collection runs of the hashtable (in miliseconds).
662 Default is 1000 (1 second).
663 .TP
664 .BI "[" "--dstlimit-htable-expire " "time"
665 After which time are idle entries expired from hashtable (in miliseconds)?
666 Default is 10000 (10 seconds).
667 .SS ecn
668 This allows you to match the ECN bits of the IPv4 and TCP header.  ECN is the Explicit Congestion Notification mechanism as specified in RFC3168
669 .TP
670 .BI "--ecn-tcp-cwr"
671 This matches if the TCP ECN CWR (Congestion Window Received) bit is set.
672 .TP
673 .BI "--ecn-tcp-ece"
674 This matches if the TCP ECN ECE (ECN Echo) bit is set.
675 .TP
676 .BI "--ecn-ip-ect " "num"
677 This matches a particular IPv4 ECT (ECN-Capable Transport). You have to specify
678 a number between `0' and `3'.
679 .SS esp
680 This module matches the SPIs in ESP header of IPSec packets.
681 .TP
682 .BR "--espspi " "[!] \fIspi\fP[:\fIspi\fP]"
683 .SS fuzzy
684 This module matches a rate limit based on a fuzzy logic controller [FLC]
685 .TP
686 .BI "--lower-limit  "number"
687 Specifies the lower limit (in packets per second).
688 .TP
689 .BI "--upper-limit " "number"
690 Specifies the upper limit (in packets per second).
691 .SS hashlimit
692 This patch adds a new match called 'hashlimit'.
693 The idea is to have something like 'limit', but either per
694 destination-ip or per (destip,destport) tuple.
695
696 It gives you the ability to express
697 .IP
698  '1000 packets per second for every host in 192.168.0.0/16'
699 .IP
700  '100 packets per second for every service of 192.168.1.1'
701 .P
702 with a single iptables rule.
703 .TP
704 .BI "--hashlimit " "rate"
705 A rate just like the limit match
706 .TP
707 .BI "--hashlimit-burst " "num"
708 Burst value, just like limit match
709 .TP
710 .BI "--hashlimit-mode " "destip | destip-destport"
711 Limit per IP or per port
712 .TP
713 .BI "--hashlimit-name " "foo"
714 The name for the /proc/net/ipt_hashlimit/foo entry
715 .TP
716 .BI "--hashlimit-htable-size " "num"
717 The number of buckets of the hash table
718 .TP
719 .BI "--hashlimit-htable-max " "num"
720 Maximum entries in the hash
721 .TP
722 .BI "--hashlimit-htable-expire " "num"
723 After how many miliseconds do hash entries expire
724 .TP
725 .BI "--hashlimit-htable-gcinterval " "num"
726 How many miliseconds between garbage collection intervals
727 .SS helper
728 This module matches packets related to a specific conntrack-helper.
729 .TP
730 .BI "--helper " "string"
731 Matches packets related to the specified conntrack-helper.
732 .RS
733 .PP
734 string can be "ftp" for packets related to a ftp-session on default port.
735 For other ports append -portnr to the value, ie. "ftp-2121".
736 .PP
737 Same rules apply for other conntrack-helpers.
738 .RE
739 .SS icmp
740 This extension is loaded if `--protocol icmp' is specified.  It
741 provides the following option:
742 .TP
743 .BR "--icmp-type " "[!] \fItypename\fP"
744 This allows specification of the ICMP type, which can be a numeric
745 ICMP type, or one of the ICMP type names shown by the command
746 .nf
747  iptables -p icmp -h
748 .fi
749 .SS iprange
750 This matches on a given arbitrary range of IPv4 addresses
751 .TP
752 .BI "[!]" "--src-range " "ip-ip"
753 Match source IP in the specified range.
754 .TP
755 .BI "[!]" "--dst-range " "ip-ip"
756 Match destination IP in the specified range.
757 .SS ipv4options
758 Match on IPv4 header options like source routing, record route,
759 timestamp and router-alert.
760 .TP
761 .B "--ssrr"
762 To match packets with the flag strict source routing.
763 .TP
764 .B "--lsrr"
765 To match packets with the flag loose source routing.
766 .TP
767 .B "--no-srr"
768 To match packets with no flag for source routing.
769 .TP
770 .B "\fR[\fB!\fR]\fB --rr"
771 To match packets with the RR flag.
772 .TP
773 .B "\fR[\fB!\fR]\fB --ts"
774 To match packets with the TS flag.
775 .TP
776 .B "\fR[\fB!\fR]\fB --ra"
777 To match packets with the router-alert option.
778 .TP
779 .B "\fR[\fB!\fR]\fB --any-opt"
780 To match a packet with at least one IP option, or no IP option
781 at all if ! is chosen.
782 .TP
783 Examples:
784 .TP
785 $ iptables -A input -m ipv4options --rr -j DROP
786 will drop packets with the record-route flag.
787 .TP
788 $ iptables -A input -m ipv4options --ts -j DROP
789 will drop packets with the timestamp flag.
790 .SS length
791 This module matches the length of a packet against a specific value
792 or range of values.
793 .TP
794 .BR "--length " "\fIlength\fP[:\fIlength\fP]"
795 .SS limit
796 This module matches at a limited rate using a token bucket filter.
797 A rule using this extension will match until this limit is reached
798 (unless the `!' flag is used).  It can be used in combination with the
799 .B LOG
800 target to give limited logging, for example.
801 .TP
802 .BI "--limit " "rate"
803 Maximum average matching rate: specified as a number, with an optional
804 `/second', `/minute', `/hour', or `/day' suffix; the default is
805 3/hour.
806 .TP
807 .BI "--limit-burst " "number"
808 Maximum initial number of packets to match: this number gets
809 recharged by one every time the limit specified above is not reached,
810 up to this number; the default is 5.
811 .SS mac
812 .TP
813 .BR "--mac-source " "[!] \fIaddress\fP"
814 Match source MAC address.  It must be of the form XX:XX:XX:XX:XX:XX.
815 Note that this only makes sense for packets coming from an Ethernet device
816 and entering the
817 .BR PREROUTING ,
818 .B FORWARD
819 or
820 .B INPUT
821 chains.
822 .SS mark
823 This module matches the netfilter mark field associated with a packet
824 (which can be set using the
825 .B MARK
826 target below).
827 .TP
828 .BR "--mark " "\fIvalue\fP[/\fImask\fP]"
829 Matches packets with the given unsigned mark value (if a mask is
830 specified, this is logically ANDed with the mask before the
831 comparison).
832 .SS mport
833 This module matches a set of source or destination ports.  Up to 15
834 ports can be specified.  It can only be used in conjunction with
835 .B "-p tcp"
836 or
837 .BR "-p udp" .
838 .TP
839 .BR "--source-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
840 Match if the source port is one of the given ports.  The flag
841 .B --sports
842 is a convenient alias for this option.
843 .TP
844 .BR "--destination-ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
845 Match if the destination port is one of the given ports.  The flag
846 .B --dports
847 is a convenient alias for this option.
848 .TP
849 .BR "--ports " "\fIport\fP[,\fIport\fP[,\fIport\fP...]]"
850 Match if the both the source and destination ports are equal to each
851 other and to one of the given ports.
852 .SS multiport
853 This module matches a set of source or destination ports.  Up to 15
854 ports can be specified.  A port range (port:port) counts as two
855 ports.  It can only be used in conjunction with
856 .B "-p tcp"
857 or
858 .BR "-p udp" .
859 .TP
860 .BR "--source-ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
861 Match if the source port is one of the given ports.  The flag
862 .B --sports
863 is a convenient alias for this option.
864 .TP
865 .BR "--destination-ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
866 Match if the destination port is one of the given ports.  The flag
867 .B --dports
868 is a convenient alias for this option.
869 .TP
870 .BR "--ports " "\fI[!] port\fP[,\fIport\fP[,\fIport:port\fP...]]"
871 Match if either the source or destination ports are equal to one of
872 the given ports.
873 .SS nth
874 This module matches every `n'th packet
875 .TP
876 .BI "--every " "value"
877 Match every `value' packet
878 .TP
879 .BI "[" "--counter " "num" "]"
880 Use internal counter number `num'.  Default is `0'.
881 .TP
882 .BI "[" "--start " "num" "]"
883 Initialize the counter at the number `num' insetad of `0'.  Most between `0'
884 and `value'-1.
885 .TP
886 .BI "[" "--packet " "num" "]"
887 Match on `num' packet.  Most be between `0' and `value'-1.
888 .SS osf
889 The idea of passive OS fingerprint matching exists for quite a long time,
890 but was created as extension fo OpenBSD pf only some weeks ago.
891 Original idea was lurked in some OpenBSD mailing list (thanks
892 grange@open...) and than adopted for Linux netfilter in form of this code.
893
894 Original fingerprint table was created by Michal Zalewski <lcamtuf@coredump.cx>.
895
896 This module compares some data(WS, MSS, options and it's order, ttl,
897 df and others) from first SYN packet (actually from packets with SYN
898 bit set) with dynamically loaded OS fingerprints.
899 .TP
900 .B "--log 1/0" 
901 If present, OSF will log determined genres even if they don't match
902 desired one.    
903 0 - log all determined entries, 
904 1 - only first one.
905
906 In syslog you find something like this:
907 .IP
908 ipt_osf: Windows [2000:SP3:Windows XP Pro SP1, 2000 SP3]: 11.22.33.55:4024 -> 11.22.33.44:139
909 .IP
910 ipt_osf: Unknown: 16384:106:1:48:020405B401010402 44.33.22.11:1239 -> 11.22.33.44:80
911 .TP
912 .B "--smart"
913 if present, OSF will use some smartness to determine remote OS.
914 OSF will use initial TTL only if source of connection is in our local network.
915 .TP
916 .B "--netlink"
917 If present, OSF will log all events also through netlink NETLINK_NFLOG groupt 1.
918 .TP
919 .BI "--genre " "[!] string"
920 Match a OS genre by passive fingerprinting
921 .P
922 Example:
923
924 #iptables -I INPUT -j ACCEPT -p tcp -m osf --genre Linux --log 1 --smart
925
926 NOTE: -p tcp is obviously required as it is a TCP match.
927
928 Fingerprints can be loaded and read through /proc/sys/net/ipv4/osf file.
929 One can flush all fingerprints with following command:
930 .IP
931 echo -en FLUSH > /proc/sys/net/ipv4/osf
932 .P
933 Only one fingerprint per open/write/close.
934
935 Fingerprints can be downloaded from http://www.openbsd.org/cgi-bin/cvsweb/src/etc/pf.os
936 .SS owner
937 This module attempts to match various characteristics of the packet
938 creator, for locally-generated packets.  It is only valid in the
939 .B OUTPUT
940 chain, and even this some packets (such as ICMP ping responses) may
941 have no owner, and hence never match.
942 .TP
943 .BI "--uid-owner " "userid"
944 Matches if the packet was created by a process with the given
945 effective user id.
946 .TP
947 .BI "--gid-owner " "groupid"
948 Matches if the packet was created by a process with the given
949 effective group id.
950 .TP
951 .BI "--pid-owner " "processid"
952 Matches if the packet was created by a process with the given
953 process id.
954 .TP
955 .BI "--sid-owner " "sessionid"
956 Matches if the packet was created by a process in the given session
957 group.
958 .TP
959 .BI "--cmd-owner " "name"
960 Matches if the packet was created by a process with the given command name.
961 (this option is present only if iptables was compiled under a kernel
962 supporting this feature)
963 .TP
964 .B NOTE: pid, sid and command matching are broken on SMP
965 .SS physdev
966 This module matches on the bridge port input and output devices enslaved
967 to a bridge device. This module is a part of the infrastructure that enables
968 a transparent bridging IP firewall and is only useful for kernel versions
969 above version 2.5.44.
970 .TP
971 .B --physdev-in name
972 Name of a bridge port via which a packet is received (only for
973 packets entering the
974 .BR INPUT ,
975 .B FORWARD
976 and
977 .B PREROUTING
978 chains). If the interface name ends in a "+", then any
979 interface which begins with this name will match. If the packet didn't arrive
980 through a bridge device, this packet won't match this option, unless '!' is used.
981 .TP
982 .B --physdev-out name
983 Name of a bridge port via which a packet is going to be sent (for packets
984 entering the
985 .BR FORWARD ,
986 .B OUTPUT
987 and
988 .B POSTROUTING
989 chains).  If the interface name ends in a "+", then any
990 interface which begins with this name will match. Note that in the
991 .BR nat " and " mangle
992 .B OUTPUT
993 chains one cannot match on the bridge output port, however one can in the
994 .B "filter OUTPUT"
995 chain. If the packet won't leave by a bridge device or it is yet unknown what
996 the output device will be, then the packet won't match this option, unless
997 '!' is used.
998 .TP
999 .B --physdev-is-in
1000 Matches if the packet has entered through a bridge interface.
1001 .TP
1002 .B --physdev-is-out
1003 Matches if the packet will leave through a bridge interface.
1004 .TP
1005 .B --physdev-is-bridged
1006 Matches if the packet is being bridged and therefore is not being routed.
1007 This is only useful in the FORWARD and POSTROUTING chains.
1008 .SS pkttype
1009 This module matches the link-layer packet type.
1010 .TP
1011 .BI "--pkt-type " "[\fIunicast\fP|\fIbroadcast\fP|\fImulticast\fP]"
1012 .SS psd
1013 Attempt to detect TCP and UDP port scans. This match was derived from
1014 Solar Designer's scanlogd.
1015 .TP
1016 .BI "--psd-weight-threshold " "threshold"
1017 Total weight of the latest TCP/UDP packets with different
1018 destination ports coming from the same host to be treated as port
1019 scan sequence.
1020 .TP
1021 .BI "--psd-delay-threshold " "delay"
1022 Delay (in hundredths of second) for the packets with different
1023 destination ports coming from the same host to be treated as
1024 possible port scan subsequence.
1025 .TP
1026 .BI "--psd-lo-ports-weight " "weight"
1027 Weight of the packet with privileged (<=1024) destination port.
1028 .TP
1029 .BI "--psd-hi-ports-weight " "weight"
1030 Weight of the packet with non-priviliged destination port.
1031 .SS quota
1032 Implements network quotas by decrementing a byte counter with each
1033 packet.
1034 .TP
1035 .BI "--quota " "bytes"
1036 The quota in bytes.
1037 .P
1038 KNOWN BUGS: this does not work on SMP systems.
1039 .SS random
1040 This module randomly matches a certain percentage of all packets.
1041 .TP
1042 .BI "--average " "percent"
1043 Matches the given percentage.  If omitted, a probability of 50% is set. 
1044 .SS realm
1045 This matches the routing realm.  Routing realms are used in complex routing
1046 setups involving dynamic routing protocols like BGP.
1047 .TP
1048 .BI "--realm " "[!]" "value[/mask]"
1049 Matches a given realm number (and optionally mask).
1050 .SS recent
1051 Allows you to dynamically create a list of IP addresses and then match
1052 against that list in a few different ways.
1053
1054 For example, you can create a `badguy' list out of people attempting
1055 to connect to port 139 on your firewall and then DROP all future
1056 packets from them without considering them.
1057 .TP
1058 .BI "--name " "name"
1059 Specify the list to use for the commands. If no name is given then 'DEFAULT'
1060 will be used.
1061 .TP
1062 [\fB!\fR] \fB--set\fR
1063 This will add the source address of the packet to the list. If the
1064 source address is already in the list, this will update the existing
1065 entry. This will always return success (or failure if `!' is passed
1066 in).
1067 .TP
1068 [\fB!\fR] \fB--rcheck\fR
1069 Check if the source address of the packet is currently in
1070 the list.
1071 .TP
1072 [\fB!\fR] \fB--update\fR
1073 Like \fB--rcheck\fR, except it will update the "last seen" timestamp if it
1074 matches.
1075 .TP
1076 [\fB!\fR] \fB--remove\fR
1077 Check if the source address of the packet is currently in the list and
1078 if so that address will be removed from the list and the rule will
1079 return true. If the address is not found, false is returned.
1080 .TP
1081 [\fB!\fR] \fB--seconds \fIseconds\fR
1082 This option must be used in conjunction with one of \fB--rcheck\fR or
1083 \fB--update\fR. When used, this will narrow the match to only happen
1084 when the address is in the list and was seen within the last given
1085 number of seconds.
1086 .TP
1087 [\fB!\fR] \fB--hitcount \fIhits\fR
1088 This option must be used in conjunction with one of \fB--rcheck\fR or
1089 \fB--update\fR. When used, this will narrow the match to only happen
1090 when the address is in the list and packets had been received greater
1091 than or equal to the given value. This option may be used along with
1092 \fB--seconds\fR to create an even narrower match requiring a certain
1093 number of hits within a specific time frame.
1094 .TP
1095 \fB--rttl\fR
1096 This option must be used in conjunction with one of \fB--rcheck\fR or
1097 \fB--update\fR. When used, this will narrow the match to only happen
1098 when the address is in the list and the TTL of the current packet
1099 matches that of the packet which hit the \fB--set\fR rule. This may be
1100 useful if you have problems with people faking their source address in
1101 order to DoS you via this module by disallowing others access to your
1102 site by sending bogus packets to you.
1103 .P
1104 Examples:
1105 .IP
1106 # iptables -A FORWARD -m recent --name badguy --rcheck --seconds 60 -j DROP
1107
1108 # iptables -A FORWARD -p tcp -i eth0 --dport 139 -m recent --name badguy --set -j DROP
1109 .P
1110 Official website (http://snowman.net/projects/ipt_recent/) also has
1111 some examples of usage.
1112
1113 /proc/net/ipt_recent/* are the current lists of addresses and information 
1114 about each entry of each list.
1115
1116 Each file in /proc/net/ipt_recent/ can be read from to see the current list
1117 or written two using the following commands to modify the list:
1118 .TP
1119 echo xx.xx.xx.xx > /proc/net/ipt_recent/DEFAULT
1120 to Add to the DEFAULT list
1121 .TP
1122 echo -xx.xx.xx.xx > /proc/net/ipt_recent/DEFAULT
1123 to Remove from the DEFAULT list
1124 .TP
1125 echo clear > /proc/net/ipt_recent/DEFAULT
1126 to empty the DEFAULT list.
1127 .P
1128 The module itself accepts parameters, defaults shown:
1129 .TP
1130 .BI "ip_list_tot=" "100"
1131 Number of addresses remembered per table
1132 .TP
1133 .BI "ip_pkt_list_tot=" "20"
1134 Number of packets per address remembered
1135 .TP
1136 .BI "ip_list_hash_size=" "0"
1137 Hash table size. 0 means to calculate it based on ip_list_tot, default: 512
1138 .TP
1139 .BI "ip_list_perms=" "0644"
1140 Permissions for /proc/net/ipt_recent/* files
1141 .TP
1142 .BI "debug=" "0"
1143 Set to 1 to get lots of debugging info
1144 .SS sctp
1145 .TP
1146 \fB--source-port\fR,\fB--sport \fR[\fB!\fR] \fIport\fR[\fB:\fIport\fR]
1147 .TP
1148 \fB--destination-port\fR,\fB--dport \fR[\fB!\fR] \fIport\fR[\fB:\fIport\fR]
1149 .TP
1150 \fB--chunk-types\fR [\fB!\fR] \fBall\fR|\fBany\fR|\fBonly \fIchunktype\fR[\fB:\fIflags\fR] [...]
1151 The flag letter in upper case indicates that the flag is to match if set,
1152 in the lower case indicates to match if unset.
1153
1154 Chunk types: DATA INIT INIT_ACK SACK HEARTBEAT HEARTBEAT_ACK ABORT SHUTDOWN SHUTDOWN_ACK ERROR COOKIE_ECHO COOKIE_ACK ECN_ECNE ECN_CWR SHUTDOWN_COMPLETE ASCONF ASCONF_ACK
1155
1156 chunk type            available flags      
1157 .br
1158 DATA                  U B E u b e         
1159 .br
1160 ABORT                 T t                 
1161 .br
1162 SHUTDOWN_COMPLETE     T t                 
1163
1164 (lowercase means flag should be "off", uppercase means "on")
1165 .P
1166 Examples:
1167
1168 iptables -A INPUT -p sctp --dport 80 -j DROP
1169
1170 iptables -A INPUT -p sctp --chunk-types any DATA,INIT -j DROP
1171
1172 iptables -A INPUT -p sctp --chunk-types any DATA:Be -j ACCEPT
1173 .SS set
1174 This modules macthes IP sets which can be defined by ipset(8).
1175 .TP
1176 .BR "--set " "setname flag[,flag...]"
1177 where flags are
1178 .BR "src"
1179 and/or
1180 .BR "dst" 
1181 and there can be no more than six of them. Hence the command
1182 .nf
1183  iptables -A FORWARD -m set --set test src,dst
1184 .fi
1185 will match packets, for which (depending on the type of the set) the source
1186 address or port number of the packet can be found in the specified set. If 
1187 there is a binding belonging to the mached set element or there is a default 
1188 binding for the given set, then the rule will match the packet only if 
1189 additionally (depending on the type of the set) the destination address or 
1190 port number of the packet can be found in the set according to the binding.
1191 .SS state
1192 This module, when combined with connection tracking, allows access to
1193 the connection tracking state for this packet.
1194 .TP
1195 .BI "--state " "state"
1196 Where state is a comma separated list of the connection states to
1197 match.  Possible states are
1198 .B INVALID
1199 meaning that the packet could not be identified for some reason which
1200 includes running out of memory and ICMP errors which don't correspond to any
1201 known connection,
1202 .B ESTABLISHED
1203 meaning that the packet is associated with a connection which has seen
1204 packets in both directions,
1205 .B NEW
1206 meaning that the packet has started a new connection, or otherwise
1207 associated with a connection which has not seen packets in both
1208 directions, and
1209 .B RELATED
1210 meaning that the packet is starting a new connection, but is
1211 associated with an existing connection, such as an FTP data transfer,
1212 or an ICMP error.
1213 .SS tcp
1214 These extensions are loaded if `--protocol tcp' is specified. It
1215 provides the following options:
1216 .TP
1217 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
1218 Source port or port range specification. This can either be a service
1219 name or a port number. An inclusive range can also be specified,
1220 using the format
1221 .IR port : port .
1222 If the first port is omitted, "0" is assumed; if the last is omitted,
1223 "65535" is assumed.
1224 If the second port greater then the first they will be swapped.
1225 The flag
1226 .B --sport
1227 is a convenient alias for this option.
1228 .TP
1229 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
1230 Destination port or port range specification.  The flag
1231 .B --dport
1232 is a convenient alias for this option.
1233 .TP
1234 .BR "--tcp-flags " "[!] \fImask\fP \fIcomp\fP"
1235 Match when the TCP flags are as specified.  The first argument is the
1236 flags which we should examine, written as a comma-separated list, and
1237 the second argument is a comma-separated list of flags which must be
1238 set.  Flags are:
1239 .BR "SYN ACK FIN RST URG PSH ALL NONE" .
1240 Hence the command
1241 .nf
1242  iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
1243 .fi
1244 will only match packets with the SYN flag set, and the ACK, FIN and
1245 RST flags unset.
1246 .TP
1247 .B "[!] --syn"
1248 Only match TCP packets with the SYN bit set and the ACK,RST and FIN bits
1249 cleared.  Such packets are used to request TCP connection initiation;
1250 for example, blocking such packets coming in an interface will prevent
1251 incoming TCP connections, but outgoing TCP connections will be
1252 unaffected.
1253 It is equivalent to \fB--tcp-flags SYN,RST,ACK,FIN SYN\fP.
1254 If the "!" flag precedes the "--syn", the sense of the
1255 option is inverted.
1256 .TP
1257 .BR "--tcp-option " "[!] \fInumber\fP"
1258 Match if TCP option set.
1259 .TP
1260 .BR "--mss " "\fIvalue\fP[:\fIvalue\fP]"
1261 Match TCP SYN or SYN/ACK packets with the specified MSS value (or range),
1262 which control the maximum packet size for that connection.
1263 .SS tcpmss
1264 This matches the TCP MSS (maximum segment size) field of the TCP header.  You can only use this on TCP SYN or SYN/ACK packets, since the MSS is only negotiated during the TCP handshake at connection startup time.
1265 .TP
1266 .BI "[!] "--mss " "value[:value]"
1267 Match a given TCP MSS value or range.
1268 .SS time
1269 This matches if the packet arrival time/date is within a given range. All options are facultative.
1270 .TP
1271 .BI " --timestart " "value"
1272 Match only if it is after `value' (Inclusive, format: HH:MM ; default 00:00).
1273 .TP
1274 .BI "--timestop  " "value"
1275 Match only if it is before `value' (Inclusive, format: HH:MM ; default 23:59).
1276 .TP
1277 .BI "--days " "listofdays"
1278 Match only if today is one of the given days. (format: Mon,Tue,Wed,Thu,Fri,Sat,Sun ; default everyday)
1279 .TP
1280 .BI "--datestart " "date"
1281 Match only if it is after `date' (Inclusive, format: YYYY[:MM[:DD[:hh[:mm[:ss]]]]] ; h,m,s start from 0 ; default to 1970)
1282 .TP
1283 .BI "--datestop " "date"
1284 Match only if it is before `date' (Inclusive, format: YYYY[:MM[:DD[:hh[:mm[:ss]]]]] ; h,m,s start from 0 ; default to 2037)
1285 .SS tos
1286 This module matches the 8 bits of Type of Service field in the IP
1287 header (ie. including the precedence bits).
1288 .TP
1289 .BI "--tos " "tos"
1290 The argument is either a standard name, (use
1291 .br
1292  iptables -m tos -h
1293 .br
1294 to see the list), or a numeric value to match.
1295 .SS ttl
1296 This module matches the time to live field in the IP header.
1297 .TP
1298 .BI "--ttl-eq " "ttl"
1299 Matches the given TTL value.
1300 .TP
1301 .BI "--ttl-gt " "ttl"
1302 Matches if TTL is greater than the given TTL value.
1303 .TP
1304 .BI "--ttl-lt " "ttl"
1305 Matches if TTL is less than the given TTL value.
1306 .SS u32
1307 U32 allows you to extract quantities of up to 4 bytes from a packet,
1308 AND them with specified masks, shift them by specified amounts and
1309 test whether the results are in any of a set of specified ranges.
1310 The specification of what to extract is general enough to skip over
1311 headers with lengths stored in the packet, as in IP or TCP header
1312 lengths.
1313
1314 Details and examples are in the kernel module source.
1315 .SS udp
1316 These extensions are loaded if `--protocol udp' is specified.  It
1317 provides the following options:
1318 .TP
1319 .BR "--source-port " "[!] \fIport\fP[:\fIport\fP]"
1320 Source port or port range specification.
1321 See the description of the
1322 .B --source-port
1323 option of the TCP extension for details.
1324 .TP
1325 .BR "--destination-port " "[!] \fIport\fP[:\fIport\fP]"
1326 Destination port or port range specification.
1327 See the description of the
1328 .B --destination-port
1329 option of the TCP extension for details.
1330 .SS unclean
1331 This module takes no options, but attempts to match packets which seem
1332 malformed or unusual.  This is regarded as experimental.
1333 .SH TARGET EXTENSIONS
1334 iptables can use extended target modules: the following are included
1335 in the standard distribution.
1336 .\" @TARGET@
1337 .SS BALANCE
1338 This allows you to DNAT connections in a round-robin way over a given range of destination addresses.
1339 .TP
1340 .BI "--to-destination " "ipaddr-ipaddr"
1341 Address range to round-robin over.
1342 .SS CLASSIFY
1343 This module allows you to set the skb->priority value (and thus classify the packet into a specific CBQ class).
1344 .TP
1345 .BI "--set-class " "MAJOR:MINOR"
1346 Set the major and minor class value.
1347 .SS CLUSTERIP
1348 This module allows you to configure a simple cluster of nodes that share
1349 a certain IP and MAC address without an explicit load balancer in front of
1350 them.  Connections are statically distributed between the nodes in this
1351 cluster.
1352 .TP
1353 .BI "--new "
1354 Create a new ClusterIP.  You always have to set this on the first rule
1355 for a given ClusterIP.
1356 .TP
1357 .BI "--hashmode " "mode"
1358 Specify the hashing mode.  Has to be one of
1359 .B sourceip, sourceip-sourceport, sourceip-sourceport-destport
1360 .TP
1361 .BI "--clustermac " "mac"
1362 Specify the ClusterIP MAC address.  Has to be a link-layer multicast address
1363 .TP
1364 .BI "--total-nodes " "num"
1365 Number of total nodes within this cluster.
1366 .TP
1367 .BI "--local-node " "num"
1368 Local node number within this cluster.
1369 .TP
1370 .BI "--hash-init " "rnd"
1371 Specify the random seed used for hash initialization.
1372 .SS CONNMARK
1373 This module sets the netfilter mark value associated with a connection
1374 .TP
1375 .B --set-mark mark[/mask]
1376 Set connection mark. If a mask is specified then only those bits set in the
1377 mask is modified.
1378 .TP
1379 .B --save-mark [--mask mask]
1380 Copy the netfilter packet mark value to the connection mark. If a mask
1381 is specified then only those bits are copied.
1382 .TP
1383 .B --restore-mark [--mask mask]
1384 Copy the connection mark value to the packet. If a mask is specified
1385 then only those bits are copied. This is only valid in the
1386 .B mangle
1387 table.
1388 .SS DNAT
1389 This target is only valid in the
1390 .B nat
1391 table, in the
1392 .B PREROUTING
1393 and
1394 .B OUTPUT
1395 chains, and user-defined chains which are only called from those
1396 chains.  It specifies that the destination address of the packet
1397 should be modified (and all future packets in this connection will
1398 also be mangled), and rules should cease being examined.  It takes one
1399 type of option:
1400 .TP
1401 .BR "--to-destination " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
1402 which can specify a single new destination IP address, an inclusive
1403 range of IP addresses, and optionally, a port range (which is only
1404 valid if the rule also specifies
1405 .B "-p tcp"
1406 or
1407 .BR "-p udp" ).
1408 If no port range is specified, then the destination port will never be
1409 modified.
1410 .RS
1411 .PP
1412 You can add several --to-destination options.  If you specify more
1413 than one destination address, either via an address range or multiple
1414 --to-destination options, a simple round-robin (one after another in
1415 cycle) load balancing takes place between these adresses.
1416 .SS DSCP
1417 This target allows to alter the value of the DSCP bits within the TOS
1418 header of the IPv4 packet.  As this manipulates a packet, it can only
1419 be used in the mangle table.
1420 .TP
1421 .BI "--set-dscp " "value"
1422 Set the DSCP field to a numerical value (can be decimal or hex)
1423 .TP
1424 .BI "--set-dscp-class " "class"
1425 Set the DSCP field to a DiffServ class.
1426 .SS ECN
1427 This target allows to selectively work around known ECN blackholes.
1428 It can only be used in the mangle table.
1429 .TP
1430 .BI "--ecn-tcp-remove"
1431 Remove all ECN bits from the TCP header.  Of course, it can only be used
1432 in conjunction with
1433 .BR "-p tcp" .
1434 .SS IPMARK
1435 Allows you to mark a received packet basing on its IP address. This
1436 can replace many mangle/mark entries with only one, if you use
1437 firewall based classifier.
1438
1439 This target is to be used inside the mangle table, in the PREROUTING,
1440 POSTROUTING or FORWARD hooks.
1441 .TP
1442 .BI "--addr " "src/dst"
1443 Use source or destination IP address.
1444 .TP
1445 .BI "--and-mask " "mask"
1446 Perform bitwise `and' on the IP address and this mask.
1447 .TP
1448 .BI "--or-mask " "mask"
1449 Perform bitwise `or' on the IP address and this mask.
1450 .P
1451 The order of IP address bytes is reversed to meet "human order of bytes":
1452 192.168.0.1 is 0xc0a80001. At first the `and' operation is performed, then
1453 `or'.
1454
1455 Examples:
1456
1457 We create a queue for each user, the queue number is adequate
1458 to the IP address of the user, e.g.: all packets going to/from 192.168.5.2
1459 are directed to 1:0502 queue, 192.168.5.12 -> 1:050c etc.
1460
1461 We have one classifier rule:
1462 .IP
1463 tc filter add dev eth3 parent 1:0 protocol ip fw
1464 .P
1465 Earlier we had many rules just like below:
1466 .IP
1467 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.2 -j MARK
1468 --set-mark 0x10502
1469 .IP
1470 iptables -t mangle -A POSTROUTING -o eth3 -d 192.168.5.3 -j MARK
1471 --set-mark 0x10503
1472 .P
1473 Using IPMARK target we can replace all the mangle/mark rules with only one:
1474 .IP
1475 iptables -t mangle -A POSTROUTING -o eth3 -j IPMARK --addr=dst
1476 --and-mask=0xffff --or-mask=0x10000
1477 .P
1478 On the routers with hundreds of users there should be significant load
1479 decrease (e.g. twice).
1480 .SS IPV4OPTSSTRIP
1481 Strip all the IP options from a packet.
1482
1483 The target doesn't take any option, and therefore is extremly easy to use :
1484
1485 # iptables -t mangle -A PREROUTING -j IPV4OPTSSTRIP
1486 .SS LOG
1487 Turn on kernel logging of matching packets.  When this option is set
1488 for a rule, the Linux kernel will print some information on all
1489 matching packets (like most IP header fields) via the kernel log
1490 (where it can be read with
1491 .I dmesg
1492 or 
1493 .IR syslogd (8)).
1494 This is a "non-terminating target", i.e. rule traversal continues at
1495 the next rule.  So if you want to LOG the packets you refuse, use two
1496 separate rules with the same matching criteria, first using target LOG
1497 then DROP (or REJECT).
1498 .TP
1499 .BI "--log-level " "level"
1500 Level of logging (numeric or see \fIsyslog.conf\fP(5)).
1501 .TP
1502 .BI "--log-prefix " "prefix"
1503 Prefix log messages with the specified prefix; up to 29 letters long,
1504 and useful for distinguishing messages in the logs.
1505 .TP
1506 .B --log-tcp-sequence
1507 Log TCP sequence numbers. This is a security risk if the log is
1508 readable by users.
1509 .TP
1510 .B --log-tcp-options
1511 Log options from the TCP packet header.
1512 .TP
1513 .B --log-ip-options
1514 Log options from the IP packet header.
1515 .TP
1516 .B --log-uid
1517 Log the userid of the process which generated the packet.
1518 .SS MARK
1519 This is used to set the netfilter mark value associated with the
1520 packet.  It is only valid in the
1521 .B mangle
1522 table.  It can for example be used in conjunction with iproute2.
1523 .TP
1524 .BI "--set-mark " "mark"
1525 .SS MASQUERADE
1526 This target is only valid in the
1527 .B nat
1528 table, in the
1529 .B POSTROUTING
1530 chain.  It should only be used with dynamically assigned IP (dialup)
1531 connections: if you have a static IP address, you should use the SNAT
1532 target.  Masquerading is equivalent to specifying a mapping to the IP
1533 address of the interface the packet is going out, but also has the
1534 effect that connections are
1535 .I forgotten
1536 when the interface goes down.  This is the correct behavior when the
1537 next dialup is unlikely to have the same interface address (and hence
1538 any established connections are lost anyway).  It takes one option:
1539 .TP
1540 .BR "--to-ports " "\fIport\fP[-\fIport\fP]"
1541 This specifies a range of source ports to use, overriding the default
1542 .B SNAT
1543 source port-selection heuristics (see above).  This is only valid
1544 if the rule also specifies
1545 .B "-p tcp"
1546 or
1547 .BR "-p udp" .
1548 .SS MIRROR
1549 This is an experimental demonstration target which inverts the source
1550 and destination fields in the IP header and retransmits the packet.
1551 It is only valid in the
1552 .BR INPUT ,
1553 .B FORWARD
1554 and
1555 .B PREROUTING
1556 chains, and user-defined chains which are only called from those
1557 chains.  Note that the outgoing packets are
1558 .B NOT
1559 seen by any packet filtering chains, connection tracking or NAT, to
1560 avoid loops and other problems.
1561 .SS NETMAP
1562 This target allows you to statically map a whole network of addresses onto
1563 another network of addresses.  It can only be used from rules in the
1564 .B nat
1565 table.
1566 .TP
1567 .BI "--to "  "address[/mask]"
1568 Network address to map to.  The resulting address will be constructed in the
1569 following way: All 'one' bits in the mask are filled in from the new `address'.
1570 All bits that are zero in the mask are filled in from the original address.
1571 .SS NOTRACK
1572 This target disables connection tracking for all packets matching that rule.
1573 .TP
1574 It can only be used in the
1575 .B raw
1576 table.
1577 .SS REDIRECT
1578 This target is only valid in the
1579 .B nat
1580 table, in the
1581 .B PREROUTING
1582 and
1583 .B OUTPUT
1584 chains, and user-defined chains which are only called from those
1585 chains.  It redirects the packet to the machine itself by changing the
1586 destination IP to the primary address of the incoming interface
1587 (locally-generated packets are mapped to the 127.0.0.1 address).  It
1588 takes one option:
1589 .TP
1590 .BR "--to-ports " "\fIport\fP[-\fIport\fP]"
1591 This specifies a destination port or range of ports to use: without
1592 this, the destination port is never altered.  This is only valid
1593 if the rule also specifies
1594 .B "-p tcp"
1595 or
1596 .BR "-p udp" .
1597 .SS REJECT
1598 This is used to send back an error packet in response to the matched
1599 packet: otherwise it is equivalent to
1600 .B DROP
1601 so it is a terminating TARGET, ending rule traversal.
1602 This target is only valid in the
1603 .BR INPUT ,
1604 .B FORWARD
1605 and
1606 .B OUTPUT
1607 chains, and user-defined chains which are only called from those
1608 chains.  The following option controls the nature of the error packet
1609 returned:
1610 .TP
1611 .BI "--reject-with " "type"
1612 The type given can be
1613 .nf
1614 .B " icmp-net-unreachable"
1615 .B " icmp-host-unreachable"
1616 .B " icmp-port-unreachable"
1617 .B " icmp-proto-unreachable"
1618 .B " icmp-net-prohibited"
1619 .B " icmp-host-prohibited or"
1620 .B " icmp-admin-prohibited (*)"
1621 .fi
1622 which return the appropriate ICMP error message (\fBport-unreachable\fP is
1623 the default).  The option
1624 .B tcp-reset
1625 can be used on rules which only match the TCP protocol: this causes a
1626 TCP RST packet to be sent back.  This is mainly useful for blocking 
1627 .I ident
1628 (113/tcp) probes which frequently occur when sending mail to broken mail
1629 hosts (which won't accept your mail otherwise).
1630 .TP
1631 (*) Using icmp-admin-prohibited with kernels that do not support it will result in a plain DROP instead of REJECT
1632 .SS ROUTE
1633 This is used to explicitly override the core network stack's routing decision.
1634 .B mangle
1635 table.
1636 .TP
1637 .BI "--oif " "ifname"
1638 Route the packet through `ifname' network interface
1639 .TP
1640 .BI "--iif " "ifname"
1641 Change the packet's incoming interface to `ifname'
1642 .TP
1643 .BI "--gw " "IP_address"
1644 Route the packet via this gateway
1645 .TP
1646 .BI "--continue "
1647 Behave like a non-terminating target and continue traversing the rules.  Not valid in combination with `--iif' or `--tee'
1648 .TP
1649 .BI "--tee "
1650 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 `--iif' or `--continue'
1651 .SS SAME
1652 Similar to SNAT/DNAT depending on chain: it takes a range of addresses
1653 (`--to 1.2.3.4-1.2.3.7') and gives a client the same
1654 source-/destination-address for each connection.
1655 .TP
1656 .BI "--to " "<ipaddr>-<ipaddr>"
1657 Addresses to map source to. May be specified more than once for
1658 multiple ranges.
1659 .TP
1660 .B "--nodst"
1661 Don't use the destination-ip in the calculations when selecting the
1662 new source-ip
1663 .SS SET
1664 This modules adds and/or deletes entries from IP sets which can be defined 
1665 by ipset(8).
1666 .TP
1667 .BR "--add-set " "setname flag[,flag...]"
1668 add the address(es)/port(s) of the packet to the sets
1669 .TP
1670 .BR "--del-set " "setname flag[,flag...]"
1671 delete the address(es)/port(s) of the packet from the sets,
1672 where flags are
1673 .BR "src"
1674 and/or
1675 .BR "dst"
1676 and there can be no more than six of them.
1677 .TP
1678 The bindings to follow must previously be defined in order to use 
1679 multilevel adding/deleting by the SET target.
1680 .SS SNAT
1681 This target is only valid in the
1682 .B nat
1683 table, in the
1684 .B POSTROUTING
1685 chain.  It specifies that the source address of the packet should be
1686 modified (and all future packets in this connection will also be
1687 mangled), and rules should cease being examined.  It takes one type
1688 of option:
1689 .TP
1690 .BR "--to-source  " "\fIipaddr\fP[-\fIipaddr\fP][:\fIport\fP-\fIport\fP]"
1691 which can specify a single new source IP address, an inclusive range
1692 of IP addresses, and optionally, a port range (which is only valid if
1693 the rule also specifies
1694 .B "-p tcp"
1695 or
1696 .BR "-p udp" ).
1697 If no port range is specified, then source ports below 512 will be
1698 mapped to other ports below 512: those between 512 and 1023 inclusive
1699 will be mapped to ports below 1024, and other ports will be mapped to
1700 1024 or above. Where possible, no port alteration will occur.
1701 .RS
1702 .PP
1703 You can add several --to-source options.  If you specify more
1704 than one source address, either via an address range or multiple
1705 --to-source options, a simple round-robin (one after another in
1706 cycle) takes place between these adresses.
1707 .SS TARPIT
1708 Captures and holds incoming TCP connections using no local
1709 per-connection resources. Connections are accepted, but immediately
1710 switched to the persist state (0 byte window), in which the remote
1711 side stops sending data and asks to continue every 60-240 seconds.
1712 Attempts to close the connection are ignored, forcing the remote side
1713 to time out the connection in 12-24 minutes.
1714
1715 This offers similar functionality to LaBrea
1716 <http://www.hackbusters.net/LaBrea/> but doesn't require dedicated
1717 hardware or IPs. Any TCP port that you would normally DROP or REJECT
1718 can instead become a tarpit.
1719
1720 To tarpit connections to TCP port 80 destined for the current machine:
1721 .IP
1722 iptables -A INPUT -p tcp -m tcp --dport 80 -j TARPIT
1723 .P
1724 To significantly slow down Code Red/Nimda-style scans of unused address
1725 space, forward unused ip addresses to a Linux box not acting as a router
1726 (e.g. "ip route 10.0.0.0 255.0.0.0 ip.of.linux.box" on a Cisco), enable IP
1727 forwarding on the Linux box, and add:
1728 .IP
1729 iptables -A FORWARD -p tcp -j TARPIT
1730 .IP
1731 iptables -A FORWARD -j DROP
1732 .TP
1733 NOTE:
1734 If you use the conntrack module while you are using TARPIT, you should
1735 also use the NOTRACK target, or the kernel will unnecessarily allocate
1736 resources for each TARPITted connection. To TARPIT incoming
1737 connections to the standard IRC port while using conntrack, you could:
1738 .IP
1739 iptables -t raw -A PREROUTING -p tcp --dport 6667 -j NOTRACK
1740 .IP
1741 iptables -A INPUT -p tcp --dport 6667 -j TARPIT
1742 .SS TCPMSS
1743 This target allows to alter the MSS value of TCP SYN packets, to control
1744 the maximum size for that connection (usually limiting it to your
1745 outgoing interface's MTU minus 40).  Of course, it can only be used
1746 in conjunction with
1747 .BR "-p tcp" .
1748 .br
1749 This target is used to overcome criminally braindead ISPs or servers
1750 which block ICMP Fragmentation Needed packets.  The symptoms of this
1751 problem are that everything works fine from your Linux
1752 firewall/router, but machines behind it can never exchange large
1753 packets:
1754 .PD 0
1755 .RS 0.1i
1756 .TP 0.3i
1757 1)
1758 Web browsers connect, then hang with no data received.
1759 .TP
1760 2)
1761 Small mail works fine, but large emails hang.
1762 .TP
1763 3)
1764 ssh works fine, but scp hangs after initial handshaking.
1765 .RE
1766 .PD
1767 Workaround: activate this option and add a rule to your firewall
1768 configuration like:
1769 .nf
1770  iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN \\
1771              -j TCPMSS --clamp-mss-to-pmtu
1772 .fi
1773 .TP
1774 .BI "--set-mss " "value"
1775 Explicitly set MSS option to specified value.
1776 .TP
1777 .B "--clamp-mss-to-pmtu"
1778 Automatically clamp MSS value to (path_MTU - 40).
1779 .TP
1780 These options are mutually exclusive.
1781 .SS TOS
1782 This is used to set the 8-bit Type of Service field in the IP header.
1783 It is only valid in the
1784 .B mangle
1785 table.
1786 .TP
1787 .BI "--set-tos " "tos"
1788 You can use a numeric TOS values, or use
1789 .nf
1790  iptables -j TOS -h
1791 .fi
1792 to see the list of valid TOS names.
1793 .SS TRACE
1794 This target has no options.  It just turns on 
1795 .B packet tracing
1796 for all packets that match this rule.
1797 .SS TTL
1798 This is used to modify the IPv4 TTL header field.  The TTL field determines
1799 how many hops (routers) a packet can traverse until it's time to live is
1800 exceeded.
1801 .TP
1802 Setting or incrementing the TTL field can potentially be very dangerous,
1803 so it should be avoided at any cost.  
1804 .TP
1805 .B Don't ever set or increment the value on packets that leave your local network!
1806 .B mangle
1807 table.
1808 .TP
1809 .BI "--ttl-set " "value"
1810 Set the TTL value to `value'.
1811 .TP
1812 .BI "--ttl-dec " "value"
1813 Decrement the TTL value `value' times.
1814 .TP
1815 .BI "--ttl-inc " "value"
1816 Increment the TTL value `value' times.
1817 .SS ULOG
1818 This target provides userspace logging of matching packets.  When this
1819 target is set for a rule, the Linux kernel will multicast this packet
1820 through a
1821 .IR netlink 
1822 socket. One or more userspace processes may then subscribe to various 
1823 multicast groups and receive the packets.
1824 Like LOG, this is a "non-terminating target", i.e. rule traversal
1825 continues at the next rule.
1826 .TP
1827 .BI "--ulog-nlgroup " "nlgroup"
1828 This specifies the netlink group (1-32) to which the packet is sent.
1829 Default value is 1.
1830 .TP
1831 .BI "--ulog-prefix " "prefix"
1832 Prefix log messages with the specified prefix; up to 32 characters
1833 long, and useful for distinguishing messages in the logs.
1834 .TP
1835 .BI "--ulog-cprange " "size"
1836 Number of bytes to be copied to userspace.  A value of 0 always copies
1837 the entire packet, regardless of its size.  Default is 0.
1838 .TP
1839 .BI "--ulog-qthreshold " "size"
1840 Number of packet to queue inside kernel.  Setting this value to, e.g. 10
1841 accumulates ten packets inside the kernel and transmits them as one
1842 netlink multipart message to userspace.  Default is 1 (for backwards
1843 compatibility).
1844 .br
1845 .SS XOR
1846 Encrypt TCP and UDP traffic using a simple XOR encryption
1847 .TP
1848 .BI "--key " "string"
1849 Set key to "string"
1850 .TP
1851 .BI "--block-size"
1852 Set block size
1853 .SH DIAGNOSTICS
1854 Various error messages are printed to standard error.  The exit code
1855 is 0 for correct functioning.  Errors which appear to be caused by
1856 invalid or abused command line parameters cause an exit code of 2, and
1857 other errors cause an exit code of 1.
1858 .SH BUGS
1859 Bugs?  What's this? ;-)
1860 Well, you might want to have a look at http://bugzilla.netfilter.org/
1861 .SH COMPATIBILITY WITH IPCHAINS
1862 This
1863 .B iptables
1864 is very similar to ipchains by Rusty Russell.  The main difference is
1865 that the chains
1866 .B INPUT
1867 and
1868 .B OUTPUT
1869 are only traversed for packets coming into the local host and
1870 originating from the local host respectively.  Hence every packet only
1871 passes through one of the three chains (except loopback traffic, which
1872 involves both INPUT and OUTPUT chains); previously a forwarded packet
1873 would pass through all three.
1874 .PP
1875 The other main difference is that
1876 .B -i
1877 refers to the input interface;
1878 .B -o
1879 refers to the output interface, and both are available for packets
1880 entering the
1881 .B FORWARD
1882 chain.
1883 .PP The various forms of NAT have been separated out; 
1884 .B iptables 
1885 is a pure packet filter when using the default `filter' table, with
1886 optional extension modules.  This should simplify much of the previous
1887 confusion over the combination of IP masquerading and packet filtering
1888 seen previously.  So the following options are handled differently:
1889 .nf
1890  -j MASQ
1891  -M -S
1892  -M -L
1893 .fi
1894 There are several other changes in iptables.
1895 .SH SEE ALSO
1896 .BR iptables-save (8),
1897 .BR iptables-restore (8),
1898 .BR ip6tables (8),
1899 .BR ip6tables-save (8),
1900 .BR ip6tables-restore (8).
1901 .P
1902 The packet-filtering-HOWTO details iptables usage for
1903 packet filtering, the NAT-HOWTO details NAT,
1904 the netfilter-extensions-HOWTO details the extensions that are
1905 not in the standard distribution,
1906 and the netfilter-hacking-HOWTO details the netfilter internals.
1907 .br
1908 See
1909 .BR "http://www.netfilter.org/" .
1910 .SH AUTHORS
1911 Rusty Russell wrote iptables, in early consultation with Michael
1912 Neuling.
1913 .PP
1914 Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet
1915 selection framework in iptables, then wrote the mangle table, the owner match,
1916 the mark stuff, and ran around doing cool stuff everywhere.
1917 .PP
1918 James Morris wrote the TOS target, and tos match.
1919 .PP
1920 Jozsef Kadlecsik wrote the REJECT target.
1921 .PP
1922 Harald Welte wrote the ULOG target, TTL, DSCP, ECN matches and targets.
1923 .PP
1924 The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Jozsef Kadlecsik, 
1925 Patrick McHardy, James Morris, Harald Welte and Rusty Russell.
1926 .PP
1927 Man page written by Herve Eychenne <rv@wallfire.org>.
1928 .\" .. and did I mention that we are incredibly cool people?
1929 .\" .. sexy, too ..
1930 .\" .. witty, charming, powerful ..
1931 .\" .. and most of all, modest ..