1iptables-extensions(8)          iptables 1.4.21         iptables-extensions(8)
2
3
4

NAME

6       iptables-extensions  — list of extensions in the standard iptables dis‐
7       tribution
8

SYNOPSIS

10       ip6tables  [-m  name  [module-options...]]   [-j  target-name  [target-
11       options...]
12
13       iptables   [-m  name  [module-options...]]   [-j  target-name  [target-
14       options...]
15

MATCH EXTENSIONS

17       iptables can use extended  packet  matching  modules  with  the  -m  or
18       --match  options,  followed  by  the matching module name; after these,
19       various extra command line options become available, depending  on  the
20       specific  module.   You  can specify multiple extended match modules in
21       one line, and you can use the -h or --help options after the module has
22       been  specified  to receive help specific to that module.  The extended
23       match modules are evaluated in the order  they  are  specified  in  the
24       rule.
25
26       If  the  -p  or  --protocol was specified and if and only if an unknown
27       option is encountered, iptables will try load a  match  module  of  the
28       same name as the protocol, to try making the option available.
29
30   addrtype
31       This module matches packets based on their address type.  Address types
32       are used within the kernel networking stack  and  categorize  addresses
33       into various groups.  The exact definition of that group depends on the
34       specific layer three protocol.
35
36       The following address types are possible:
37
38       UNSPEC an unspecified address (i.e. 0.0.0.0)
39
40       UNICAST
41              an unicast address
42
43       LOCAL  a local address
44
45       BROADCAST
46              a broadcast address
47
48       ANYCAST
49              an anycast packet
50
51       MULTICAST
52              a multicast address
53
54       BLACKHOLE
55              a blackhole address
56
57       UNREACHABLE
58              an unreachable address
59
60       PROHIBIT
61              a prohibited address
62
63       THROW  FIXME
64
65       NAT    FIXME
66
67       XRESOLVE
68
69       [!] --src-type type
70              Matches if the source address is of given type
71
72       [!] --dst-type type
73              Matches if the destination address is of given type
74
75       --limit-iface-in
76              The address type checking can be limited to  the  interface  the
77              packet  is  coming in. This option is only valid in the PREROUT‐
78              ING, INPUT and FORWARD chains. It cannot be specified  with  the
79              --limit-iface-out option.
80
81       --limit-iface-out
82              The  address  type  checking can be limited to the interface the
83              packet is going out. This option is only valid in the  POSTROUT‐
84              ING,  OUTPUT and FORWARD chains. It cannot be specified with the
85              --limit-iface-in option.
86
87   ah (IPv6-specific)
88       This module matches the parameters in Authentication  header  of  IPsec
89       packets.
90
91       [!] --ahspi spi[:spi]
92              Matches SPI.
93
94       [!] --ahlen length
95              Total length of this header in octets.
96
97       --ahres
98              Matches if the reserved field is filled with zero.
99
100   ah (IPv4-specific)
101       This module matches the SPIs in Authentication header of IPsec packets.
102
103       [!] --ahspi spi[:spi]
104
105   bpf
106       Match  using Linux Socket Filter. Expects a BPF program in decimal for‐
107       mat. This is the format generated by the nfbpf_compile utility.
108
109       --bytecode code
110              Pass the BPF byte code format (described in the example below).
111
112       The code format is similar to the output of the tcpdump  -ddd  command:
113       one  line  that stores the number of instructions, followed by one line
114       for each instruction. Instruction lines follow the pattern 'u16  u8  u8
115       u32'  in  decimal notation. Fields encode the operation, jump offset if
116       true, jump offset if false and generic multiuse field 'K'. Comments are
117       not supported.
118
119       For  example,  to  read  only packets matching 'ip proto 6', insert the
120       following, without the comments or trailing whitespace:
121
122              4               # number of instructions
123              48 0 0 9        # load byte  ip->proto
124              21 0 1 6        # jump equal IPPROTO_TCP
125              6 0 0 1         # return     pass (non-zero)
126              6 0 0 0         # return     fail (zero)
127
128       You can pass this filter to the bpf match with the following command:
129
130              iptables -A OUTPUT -m bpf --bytecode '4,48 0 0 9,21 0 1 6,6 0  0
131              1,6 0 0 0' -j ACCEPT
132
133       Or instead, you can invoke the nfbpf_compile utility.
134
135              iptables  -A  OUTPUT  -m  bpf --bytecode "`nfbpf_compile RAW 'ip
136              proto 6'`" -j ACCEPT
137
138       You may want to learn more about BPF from FreeBSD's bpf(4) manpage.
139
140   cgroup
141       [!] --cgroup fwid
142              Match corresponding cgroup for this packet.
143
144              Can be used to assign particular firewall  policies  for  aggre‐
145              gated task/jobs on the system. This allows for more fine-grained
146              firewall policies that only match for a subset of  the  system's
147              processes.   fwid  is the maker set through the net_cls cgroup's
148              id.
149
150       Example:
151
152       iptables -A OUTPUT -p tcp --sport 80 -m cgroup ! --cgroup 1 -j DROP
153
154       Available since Linux 3.14.
155
156   cluster
157       Allows you to deploy gateway and back-end load-sharing clusters without
158       the need of load-balancers.
159
160       This  match requires that all the nodes see the same packets. Thus, the
161       cluster match decides if this node has to handle  a  packet  given  the
162       following options:
163
164       --cluster-total-nodes num
165              Set number of total nodes in cluster.
166
167       [!] --cluster-local-node num
168              Set the local node number ID.
169
170       [!] --cluster-local-nodemask mask
171              Set  the  local  node  number  ID  mask. You can use this option
172              instead of --cluster-local-node.
173
174       --cluster-hash-seed value
175              Set seed value of the Jenkins hash.
176
177       Example:
178
179              iptables -A PREROUTING -t mangle  -i  eth1  -m  cluster  --clus‐
180              ter-total-nodes  2  --cluster-local-node  1  --cluster-hash-seed
181              0xdeadbeef -j MARK --set-mark 0xffff
182
183              iptables -A PREROUTING -t mangle  -i  eth2  -m  cluster  --clus‐
184              ter-total-nodes  2  --cluster-local-node  1  --cluster-hash-seed
185              0xdeadbeef -j MARK --set-mark 0xffff
186
187              iptables -A PREROUTING -t mangle -i eth1 -m mark ! --mark 0xffff
188              -j DROP
189
190              iptables -A PREROUTING -t mangle -i eth2 -m mark ! --mark 0xffff
191              -j DROP
192
193       And the following commands to make all nodes see the same packets:
194
195              ip maddr add 01:00:5e:00:01:01 dev eth1
196
197              ip maddr add 01:00:5e:00:01:02 dev eth2
198
199              arptables -A OUTPUT -o eth1 --h-length 6 -j mangle --mangle-mac-
200              s 01:00:5e:00:01:01
201
202              arptables  -A  INPUT  -i  eth1  --h-length  6  --destination-mac
203              01:00:5e:00:01:01 -j mangle --mangle-mac-d 00:zz:yy:xx:5a:27
204
205              arptables -A OUTPUT  -o  eth2  --h-length  6  -j  mangle  --man‐
206              gle-mac-s 01:00:5e:00:01:02
207
208              arptables  -A  INPUT  -i  eth2  --h-length  6  --destination-mac
209              01:00:5e:00:01:02 -j mangle --mangle-mac-d 00:zz:yy:xx:5a:27
210
211       NOTE: the arptables commands above use mainstream syntax.  If  you  are
212       using arptables-jf included in some RedHat, CentOS and Fedora versions,
213       you will hit syntax errors. Therefore, you'll have to  adapt  these  to
214       the arptables-jf syntax to get them working.
215
216       In  the  case of TCP connections, pickup facility has to be disabled to
217       avoid marking TCP ACK packets coming in the reply direction as valid.
218
219              echo 0 > /proc/sys/net/netfilter/nf_conntrack_tcp_loose
220
221   comment
222       Allows you to add comments (up to 256 characters) to any rule.
223
224       --comment comment
225
226       Example:
227              iptables -A INPUT -i eth1 -m comment --comment "my local LAN"
228
229   connbytes
230       Match by how many bytes or packets a connection  (or  one  of  the  two
231       flows  constituting the connection) has transferred so far, or by aver‐
232       age bytes per packet.
233
234       The counters are 64-bit and are thus not expected to overflow ;)
235
236       The primary use is to detect long-lived downloads and mark them  to  be
237       scheduled using a lower priority band in traffic control.
238
239       The  transferred  bytes per connection can also be viewed through `con‐
240       ntrack -L` and accessed via ctnetlink.
241
242       NOTE that for connections which have  no  accounting  information,  the
243       match  will  always return false. The "net.netfilter.nf_conntrack_acct"
244       sysctl flag  controls  whether  new  connections  will  be  byte/packet
245       counted.  Existing  connection  flows  will not be gaining/losing a/the
246       accounting structure when be sysctl flag is flipped.
247
248       [!] --connbytes from[:to]
249              match packets  from  a  connection  whose  packets/bytes/average
250              packet size is more than FROM and less than TO bytes/packets. if
251              TO is omitted only FROM check is done.  "!"  is  used  to  match
252              packets not falling in the range.
253
254       --connbytes-dir {original|reply|both}
255              which packets to consider
256
257       --connbytes-mode {packets|bytes|avgpkt}
258              whether  to  check the amount of packets, number of bytes trans‐
259              ferred or the average size (in bytes) of all packets received so
260              far.  Note  that when "both" is used together with "avgpkt", and
261              data is going (mainly) only in one direction (for example HTTP),
262              the  average  packet  size will be about half of the actual data
263              packets.
264
265       Example:
266              iptables    ..    -m    connbytes    --connbytes    10000:100000
267              --connbytes-dir both --connbytes-mode bytes ...
268
269   connlabel
270       Module matches or adds connlabels to a connection.  connlabels are sim‐
271       ilar to connmarks, except labels are bit-based; i.e.  all labels may be
272       attached  to a flow at the same time.  Up to 128 unique labels are cur‐
273       rently supported.
274
275       [!] --label name
276              matches if label name has been set on a connection.  Instead  of
277              a  name  (which  will  be  translated  to  a number, see EXAMPLE
278              below), a number may be used instead.   Using  a  number  always
279              overrides connlabel.conf.
280
281       --set  if  the  label has not been set on the connection, set it.  Note
282              that setting a label can fail.  This is because the kernel allo‐
283              cates  the  conntrack  label storage area when the connection is
284              created, and it only reserves the amount of memory  required  by
285              the  ruleset  that exists at the time the connection is created.
286              In this case, the match will fail (or succeed, in  case  --label
287              option was negated).
288
289       This  match  depends  on  libnetfilter_conntrack 1.0.4 or later.  Label
290       translation is done via the  /etc/xtables/connlabel.conf  configuration
291       file.
292
293       Example:
294
295              0    eth0-in
296              1    eth0-out
297              2    ppp-in
298              3    ppp-out
299              4    bulk-traffic
300              5    interactive
301
302   connlimit
303       Allows  you  to restrict the number of parallel connections to a server
304       per client IP address (or client address block).
305
306       --connlimit-upto n
307              Match if the number of existing connections is below or equal n.
308
309       --connlimit-above n
310              Match if the number of existing connections is above n.
311
312       --connlimit-mask prefix_length
313              Group hosts using the prefix length. For IPv4, this  must  be  a
314              number  between  (including)  0  and 32. For IPv6, between 0 and
315              128. If not specified, the maximum prefix length for the  appli‐
316              cable protocol is used.
317
318       --connlimit-saddr
319              Apply  the  limit  onto the source group. This is the default if
320              --connlimit-daddr is not specified.
321
322       --connlimit-daddr
323              Apply the limit onto the destination group.
324
325       Examples:
326
327       # allow 2 telnet connections per client host
328              iptables  -A  INPUT  -p  tcp  --syn  --dport  23  -m   connlimit
329              --connlimit-above 2 -j REJECT
330
331       # you can also match the other way around:
332              iptables   -A  INPUT  -p  tcp  --syn  --dport  23  -m  connlimit
333              --connlimit-upto 2 -j ACCEPT
334
335       # limit the number of parallel HTTP requests to 16 per  class  C  sized
336       source network (24 bit netmask)
337              iptables  -p tcp --syn --dport 80 -m connlimit --connlimit-above
338              16 --connlimit-mask 24 -j REJECT
339
340       # limit the number of parallel HTTP requests to 16 for the  link  local
341       network
342              (ipv6)  ip6tables  -p  tcp  --syn  --dport  80  -s  fe80::/64 -m
343              connlimit --connlimit-above 16 --connlimit-mask 64 -j REJECT
344
345       # Limit the number of connections to a particular host:
346              ip6tables -p tcp --syn --dport  49152:65535  -d  2001:db8::1  -m
347              connlimit --connlimit-above 100 -j REJECT
348
349   connmark
350       This  module matches the netfilter mark field associated with a connec‐
351       tion (which can be set using the CONNMARK target below).
352
353       [!] --mark value[/mask]
354              Matches packets in connections with the given mark value  (if  a
355              mask  is specified, this is logically ANDed with the mark before
356              the comparison).
357
358   conntrack
359       This module, when combined with connection tracking, allows  access  to
360       the connection tracking state for this packet/connection.
361
362       [!] --ctstate statelist
363              statelist  is a comma separated list of the connection states to
364              match.  Possible states are listed below.
365
366       [!] --ctproto l4proto
367              Layer-4 protocol to match (by number or name)
368
369       [!] --ctorigsrc address[/mask]
370
371       [!] --ctorigdst address[/mask]
372
373       [!] --ctreplsrc address[/mask]
374
375       [!] --ctrepldst address[/mask]
376              Match against original/reply source/destination address
377
378       [!] --ctorigsrcport port[:port]
379
380       [!] --ctorigdstport port[:port]
381
382       [!] --ctreplsrcport port[:port]
383
384       [!] --ctrepldstport port[:port]
385              Match    against    original/reply    source/destination    port
386              (TCP/UDP/etc.) or GRE key.  Matching against port ranges is only
387              supported in kernel versions above 2.6.38.
388
389       [!] --ctstatus statelist
390              statuslist is a comma separated list of the connection  statuses
391              to match.  Possible statuses are listed below.
392
393       [!] --ctexpire time[:time]
394              Match remaining lifetime in seconds against given value or range
395              of values (inclusive)
396
397       --ctdir {ORIGINAL|REPLY}
398              Match packets that are flowing in the  specified  direction.  If
399              this  flag  is  not  specified  at  all, matches packets in both
400              directions.
401
402       States for --ctstate:
403
404       INVALID
405              The packet is associated with no known connection.
406
407       NEW    The packet has started a new connection or otherwise  associated
408              with a connection which has not seen packets in both directions.
409
410       ESTABLISHED
411              The  packet is associated with a connection which has seen pack‐
412              ets in both directions.
413
414       RELATED
415              The packet is starting a new connection, but is associated  with
416              an  existing connection, such as an FTP data transfer or an ICMP
417              error.
418
419       UNTRACKED
420              The packet is not tracked at all, which happens if  you  explic‐
421              itly untrack it by using -j CT --notrack in the raw table.
422
423       SNAT   A virtual state, matching if the original source address differs
424              from the reply destination.
425
426       DNAT   A virtual state, matching if the  original  destination  differs
427              from the reply source.
428
429       Statuses for --ctstatus:
430
431       NONE   None of the below.
432
433       EXPECTED
434              This  is  an expected connection (i.e. a conntrack helper set it
435              up).
436
437       SEEN_REPLY
438              Conntrack has seen packets in both directions.
439
440       ASSURED
441              Conntrack entry should never be early-expired.
442
443       CONFIRMED
444              Connection is confirmed: originating packet has left box.
445
446   cpu
447       [!] --cpu number
448              Match cpu handling this packet. cpus  are  numbered  from  0  to
449              NR_CPUS-1  Can  be  used  in combination with RPS (Remote Packet
450              Steering) or multiqueue NICs to spread network traffic  on  dif‐
451              ferent queues.
452
453       Example:
454
455       iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 0 -j REDI‐
456       RECT --to-port 8080
457
458       iptables -t nat -A PREROUTING -p tcp --dport 80 -m cpu --cpu 1 -j REDI‐
459       RECT --to-port 8081
460
461       Available since Linux 2.6.36.
462
463   dccp
464       [!] --source-port,--sport port[:port]
465
466       [!] --destination-port,--dport port[:port]
467
468       [!] --dccp-types mask
469              Match  when  the  DCCP packet type is one of 'mask'. 'mask' is a
470              comma-separated list of packet types.  Packet types are: REQUEST
471              RESPONSE  DATA  ACK  DATAACK  CLOSEREQ  CLOSE RESET SYNC SYNCACK
472              INVALID.
473
474       [!] --dccp-option number
475              Match if DCCP option set.
476
477   devgroup
478       Match device group of a packets incoming/outgoing interface.
479
480       [!] --src-group name
481              Match device group of incoming device
482
483       [!] --dst-group name
484              Match device group of outgoing device
485
486   dscp
487       This module matches the 6 bit DSCP field within the TOS field in the IP
488       header.  DSCP has superseded TOS within the IETF.
489
490       [!] --dscp value
491              Match against a numeric (decimal or hex) value [0-63].
492
493       [!] --dscp-class class
494              Match  the  DiffServ class. This value may be any of the BE, EF,
495              AFxx or CSx classes.  It will then be converted into its accord‐
496              ing numeric value.
497
498   dst (IPv6-specific)
499       This module matches the parameters in Destination Options header
500
501       [!] --dst-len length
502              Total length of this header in octets.
503
504       --dst-opts type[:length][,type[:length]...]
505              numeric  type  of  option  and  the length of the option data in
506              octets.
507
508   ecn
509       This allows you to match the ECN bits of the IPv4/IPv6 and TCP  header.
510       ECN  is  the Explicit Congestion Notification mechanism as specified in
511       RFC3168
512
513       [!] --ecn-tcp-cwr
514              This matches if the TCP ECN CWR (Congestion Window Received) bit
515              is set.
516
517       [!] --ecn-tcp-ece
518              This matches if the TCP ECN ECE (ECN Echo) bit is set.
519
520       [!] --ecn-ip-ect num
521              This matches a particular IPv4/IPv6 ECT (ECN-Capable Transport).
522              You have to specify a number between `0' and `3'.
523
524   esp
525       This module matches the SPIs in ESP header of IPsec packets.
526
527       [!] --espspi spi[:spi]
528
529   eui64 (IPv6-specific)
530       This module matches the EUI-64 part of a stateless autoconfigured  IPv6
531       address.  It compares the EUI-64 derived from the source MAC address in
532       Ethernet frame with the lower 64 bits of the IPv6 source  address.  But
533       "Universal/Local"  bit is not compared. This module doesn't match other
534       link layer frame, and is only valid in the PREROUTING, INPUT  and  FOR‐
535       WARD chains.
536
537   frag (IPv6-specific)
538       This module matches the parameters in Fragment header.
539
540       [!] --fragid id[:id]
541              Matches the given Identification or range of it.
542
543       [!] --fraglen length
544              This  option cannot be used with kernel version 2.6.10 or later.
545              The length of Fragment header is static and this option  doesn't
546              make sense.
547
548       --fragres
549              Matches if the reserved fields are filled with zero.
550
551       --fragfirst
552              Matches on the first fragment.
553
554       --fragmore
555              Matches if there are more fragments.
556
557       --fraglast
558              Matches if this is the last fragment.
559
560   hashlimit
561       hashlimit  uses hash buckets to express a rate limiting match (like the
562       limit match) for a group of connections using a single  iptables  rule.
563       Grouping  can be done per-hostgroup (source and/or destination address)
564       and/or per-port. It gives you the ability to  express  "N  packets  per
565       time  quantum  per  group" or "N bytes per seconds" (see below for some
566       examples).
567
568       A hash limit option (--hashlimit-upto, --hashlimit-above)  and  --hash‐
569       limit-name are required.
570
571       --hashlimit-upto amount[/second|/minute|/hour|/day]
572              Match  if  the  rate  is below or equal to amount/quantum. It is
573              specified either as a number, with an optional time quantum suf‐
574              fix  (the  default  is  3/hour), or as amountb/second (number of
575              bytes per second).
576
577       --hashlimit-above amount[/second|/minute|/hour|/day]
578              Match if the rate is above amount/quantum.
579
580       --hashlimit-burst amount
581              Maximum initial number of packets to  match:  this  number  gets
582              recharged  by  one  every  time the limit specified above is not
583              reached, up to this number; the default is 5.   When  byte-based
584              rate  matching is requested, this option specifies the amount of
585              bytes that can exceed the given rate.   This  option  should  be
586              used  with  caution  -- if the entry expires, the burst value is
587              reset too.
588
589       --hashlimit-mode {srcip|srcport|dstip|dstport},...
590              A comma-separated list of objects to take into consideration. If
591              no  --hashlimit-mode option is given, hashlimit acts like limit,
592              but at the expensive of doing the hash housekeeping.
593
594       --hashlimit-srcmask prefix
595              When  --hashlimit-mode  srcip  is  used,  all  source  addresses
596              encountered will be grouped according to the given prefix length
597              and the so-created subnet will be subject to  hashlimit.  prefix
598              must be between (inclusive) 0 and 32. Note that --hashlimit-src‐
599              mask 0 is basically doing the same thing as not specifying srcip
600              for --hashlimit-mode, but is technically more expensive.
601
602       --hashlimit-dstmask prefix
603              Like --hashlimit-srcmask, but for destination addresses.
604
605       --hashlimit-name foo
606              The name for the /proc/net/ipt_hashlimit/foo entry.
607
608       --hashlimit-htable-size buckets
609              The number of buckets of the hash table
610
611       --hashlimit-htable-max entries
612              Maximum entries in the hash.
613
614       --hashlimit-htable-expire msec
615              After how many milliseconds do hash entries expire.
616
617       --hashlimit-htable-gcinterval msec
618              How many milliseconds between garbage collection intervals.
619
620       Examples:
621
622       matching on source host
623              "1000 packets per second for every host in 192.168.0.0/16" => -s
624              192.168.0.0/16 --hashlimit-mode srcip --hashlimit-upto 1000/sec
625
626       matching on source port
627              "100 packets per second for every service of 192.168.1.1" =>  -s
628              192.168.1.1 --hashlimit-mode srcport --hashlimit-upto 100/sec
629
630       matching on subnet
631              "10000  packets  per  minute  for  every /28 subnet (groups of 8
632              addresses) in 10.0.0.0/8" => -s 10.0.0.0/8  --hashlimit-mask  28
633              --hashlimit-upto 10000/min
634
635       matching bytes per second
636              "flows     exceeding     512kbyte/s"     =>     --hashlimit-mode
637              srcip,dstip,srcport,dstport --hashlimit-above 512kb/s
638
639       matching bytes per second
640              "hosts that exceed 512kbyte/s, but permit up to 1Megabytes with‐
641              out  matching"  --hashlimit-mode dstip --hashlimit-above 512kb/s
642              --hashlimit-burst 1mb
643
644   hbh (IPv6-specific)
645       This module matches the parameters in Hop-by-Hop Options header
646
647       [!] --hbh-len length
648              Total length of this header in octets.
649
650       --hbh-opts type[:length][,type[:length]...]
651              numeric type of option and the length  of  the  option  data  in
652              octets.
653
654   helper
655       This module matches packets related to a specific conntrack-helper.
656
657       [!] --helper string
658              Matches packets related to the specified conntrack-helper.
659
660              string  can  be  "ftp"  for  packets related to a ftp-session on
661              default port.  For other ports append -portnr to the value,  ie.
662              "ftp-2121".
663
664              Same rules apply for other conntrack-helpers.
665
666   hl (IPv6-specific)
667       This module matches the Hop Limit field in the IPv6 header.
668
669       [!] --hl-eq value
670              Matches if Hop Limit equals value.
671
672       --hl-lt value
673              Matches if Hop Limit is less than value.
674
675       --hl-gt value
676              Matches if Hop Limit is greater than value.
677
678   icmp (IPv4-specific)
679       This  extension  can be used if `--protocol icmp' is specified. It pro‐
680       vides the following option:
681
682       [!] --icmp-type {type[/code]|typename}
683              This allows specification of the  ICMP  type,  which  can  be  a
684              numeric ICMP type, type/code pair, or one of the ICMP type names
685              shown by the command
686               iptables -p icmp -h
687
688   icmp6 (IPv6-specific)
689       This extension can be used if  `--protocol  ipv6-icmp'  or  `--protocol
690       icmpv6' is specified. It provides the following option:
691
692       [!] --icmpv6-type type[/code]|typename
693              This  allows  specification  of  the ICMPv6 type, which can be a
694              numeric ICMPv6 type, type and code, or one of  the  ICMPv6  type
695              names shown by the command
696               ip6tables -p ipv6-icmp -h
697
698   iprange
699       This matches on a given arbitrary range of IP addresses.
700
701       [!] --src-range from[-to]
702              Match source IP in the specified range.
703
704       [!] --dst-range from[-to]
705              Match destination IP in the specified range.
706
707   ipv6header (IPv6-specific)
708       This module matches IPv6 extension headers and/or upper layer header.
709
710       --soft Matches if the packet includes any of the headers specified with
711              --header.
712
713       [!] --header header[,header...]
714              Matches the packet which EXACTLY includes all specified headers.
715              The headers encapsulated with ESP header are out of scope.  Pos‐
716              sible header types can be:
717
718       hop|hop-by-hop
719              Hop-by-Hop Options header
720
721       dst    Destination Options header
722
723       route  Routing header
724
725       frag   Fragment header
726
727       auth   Authentication header
728
729       esp    Encapsulating Security Payload header
730
731       none   No Next header which matches 59 in the 'Next  Header  field'  of
732              IPv6 header or any IPv6 extension headers
733
734       proto  which  matches  any upper layer protocol header. A protocol name
735              from /etc/protocols and numeric value also allowed.  The  number
736              255 is equivalent to proto.
737
738   ipvs
739       Match IPVS connection properties.
740
741       [!] --ipvs
742              packet belongs to an IPVS connection
743
744       Any of the following options implies --ipvs (even negated)
745
746       [!] --vproto protocol
747              VIP protocol to match; by number or name, e.g. "tcp"
748
749       [!] --vaddr address[/mask]
750              VIP address to match
751
752       [!] --vport port
753              VIP port to match; by number or name, e.g. "http"
754
755       --vdir {ORIGINAL|REPLY}
756              flow direction of packet
757
758       [!] --vmethod {GATE|IPIP|MASQ}
759              IPVS forwarding method used
760
761       [!] --vportctl port
762              VIP port of the controlling connection to match, e.g. 21 for FTP
763
764   length
765       This  module  matches  the  length of the layer-3 payload (e.g. layer-4
766       packet) of a packet against a specific value or range of values.
767
768       [!] --length length[:length]
769
770   limit
771       This module matches at a limited rate using a token bucket  filter.   A
772       rule  using  this extension will match until this limit is reached.  It
773       can be used in combination with the LOG target to give limited logging,
774       for example.
775
776       xt_limit  has no negation support - you will have to use -m hashlimit !
777       --hashlimit rate in this case whilst omitting --hashlimit-mode.
778
779       --limit rate[/second|/minute|/hour|/day]
780              Maximum average matching rate: specified as a  number,  with  an
781              optional  `/second',  `/minute',  `/hour', or `/day' suffix; the
782              default is 3/hour.
783
784       --limit-burst number
785              Maximum initial number of packets to  match:  this  number  gets
786              recharged  by  one  every  time the limit specified above is not
787              reached, up to this number; the default is 5.
788
789   mac
790       [!] --mac-source address
791              Match  source  MAC  address.    It   must   be   of   the   form
792              XX:XX:XX:XX:XX:XX.   Note that this only makes sense for packets
793              coming from an Ethernet device and entering the PREROUTING, FOR‐
794              WARD or INPUT chains.
795
796   mark
797       This  module  matches the netfilter mark field associated with a packet
798       (which can be set using the MARK target below).
799
800       [!] --mark value[/mask]
801              Matches packets with the given unsigned mark value (if a mask is
802              specified, this is logically ANDed with the mask before the com‐
803              parison).
804
805   mh (IPv6-specific)
806       This extension is loaded if `--protocol ipv6-mh' or `--protocol mh'  is
807       specified. It provides the following option:
808
809       [!] --mh-type type[:type]
810              This allows specification of the Mobility Header(MH) type, which
811              can be a numeric MH type, type or one of the MH type names shown
812              by the command
813               ip6tables -p mh -h
814
815   multiport
816       This  module  matches  a  set of source or destination ports.  Up to 15
817       ports can be specified.  A port range (port:port) counts as two  ports.
818       It can only be used in conjunction with one of the following protocols:
819       tcp, udp, udplite, dccp and sctp.
820
821       [!] --source-ports,--sports port[,port|,port:port]...
822              Match if the source port is one of the given  ports.   The  flag
823              --sports  is  a convenient alias for this option. Multiple ports
824              or port ranges are separated using a comma, and a port range  is
825              specified  using  a  colon.  53,1024:65535 would therefore match
826              ports 53 and all from 1024 through 65535.
827
828       [!] --destination-ports,--dports port[,port|,port:port]...
829              Match if the destination port is one of the  given  ports.   The
830              flag --dports is a convenient alias for this option.
831
832       [!] --ports port[,port|,port:port]...
833              Match if either the source or destination ports are equal to one
834              of the given ports.
835
836   nfacct
837       The nfacct match provides the extended  accounting  infrastructure  for
838       iptables.   You  have  to  use  this match together with the standalone
839       user-space utility nfacct(8)
840
841       The only option available for this match is the following:
842
843       --nfacct-name name
844              This allows you to specify the existing object name that will be
845              use for accounting the traffic that this rule-set is matching.
846
847       To use this extension, you have to create an accounting object:
848
849              nfacct add http-traffic
850
851       Then, you have to attach it to the accounting object via iptables:
852
853              iptables  -I  INPUT  -p  tcp  --sport 80 -m nfacct --nfacct-name
854              http-traffic
855
856              iptables -I OUTPUT -p tcp --dport  80  -m  nfacct  --nfacct-name
857              http-traffic
858
859       Then, you can check for the amount of traffic that the rules match:
860
861              nfacct get http-traffic
862
863              {  pkts = 00000000000000000156, bytes = 00000000000000151786 } =
864              http-traffic;
865
866       You can obtain nfacct(8)  from  http://www.netfilter.org  or,  alterna‐
867       tively, from the git.netfilter.org repository.
868
869   osf
870       The  osf module does passive operating system fingerprinting. This mod‐
871       ules compares some data (Window Size, MSS,  options  and  their  order,
872       TTL, DF, and others) from packets with the SYN bit set.
873
874       [!] --genre string
875              Match  an operating system genre by using a passive fingerprint‐
876              ing.
877
878       --ttl level
879              Do additional TTL checks on the packet to determine the  operat‐
880              ing system.  level can be one of the following values:
881
882       ·   0  - True IP address and fingerprint TTL comparison. This generally
883           works for LANs.
884
885       ·   1 - Check if the IP header's TTL is less than the fingerprint  one.
886           Works for globally-routable addresses.
887
888       ·   2 - Do not compare the TTL at all.
889
890       --log level
891           Log  determined  genres  into  dmesg  even if they do not match the
892           desired one.  level can be one of the following values:
893
894       ·   0 - Log all matched or unknown signatures
895
896       ·   1 - Log only the first one
897
898       ·   2 - Log all known matched signatures
899
900       You may find something like this in syslog:
901
902       Windows [2000:SP3:Windows XP Pro SP1, 2000  SP3]:  11.22.33.55:4024  ->
903       11.22.33.44:139  hops=3  Linux [2.5-2.6:] : 1.2.3.4:42624 -> 1.2.3.5:22
904       hops=4
905
906       OS fingerprints are loadable using the nfnl_osf program. To  load  fin‐
907       gerprints from a file, use:
908
909       nfnl_osf -f /usr/share/xtables/pf.os
910
911       To remove them again,
912
913       nfnl_osf -f /usr/share/xtables/pf.os -d
914
915       The  fingerprint  database  can  be  downlaoded  from  http://www.open
916       bsd.org/cgi-bin/cvsweb/src/etc/pf.os .
917
918   owner
919       This module attempts to match various  characteristics  of  the  packet
920       creator, for locally generated packets. This match is only valid in the
921       OUTPUT and POSTROUTING chains. Forwarded packets do not have any socket
922       associated with them. Packets from kernel threads do have a socket, but
923       usually no owner.
924
925       [!] --uid-owner username
926
927       [!] --uid-owner userid[-userid]
928              Matches if the packet socket's file structure (if it has one) is
929              owned  by  the given user. You may also specify a numerical UID,
930              or an UID range.
931
932       [!] --gid-owner groupname
933
934       [!] --gid-owner groupid[-groupid]
935              Matches if the packet socket's file structure is  owned  by  the
936              given  group.   You  may  also specify a numerical GID, or a GID
937              range.
938
939       [!] --socket-exists
940              Matches if the packet is associated with a socket.
941
942   physdev
943       This module matches  on  the  bridge  port  input  and  output  devices
944       enslaved  to  a bridge device. This module is a part of the infrastruc‐
945       ture that enables a transparent bridging IP firewall and is only useful
946       for kernel versions above version 2.5.44.
947
948       [!] --physdev-in name
949              Name  of  a bridge port via which a packet is received (only for
950              packets entering the INPUT, FORWARD and PREROUTING  chains).  If
951              the  interface  name  ends  in  a  "+", then any interface which
952              begins with this name will match. If the  packet  didn't  arrive
953              through  a  bridge  device, this packet won't match this option,
954              unless '!' is used.
955
956       [!] --physdev-out name
957              Name of a bridge port via which a packet is  going  to  be  sent
958              (for  packets  entering  the  FORWARD,  OUTPUT  and  POSTROUTING
959              chains).  If the interface name ends in a "+", then  any  inter‐
960              face  which  begins  with this name will match. Note that in the
961              nat and mangle OUTPUT chains one cannot match on the bridge out‐
962              put  port,  however  one  can in the filter OUTPUT chain. If the
963              packet won't leave by a bridge device or if it  is  yet  unknown
964              what the output device will be, then the packet won't match this
965              option, unless '!' is used.
966
967       [!] --physdev-is-in
968              Matches if the packet has entered through a bridge interface.
969
970       [!] --physdev-is-out
971              Matches if the packet will leave through a bridge interface.
972
973       [!] --physdev-is-bridged
974              Matches if the packet is being  bridged  and  therefore  is  not
975              being  routed.  This is only useful in the FORWARD and POSTROUT‐
976              ING chains.
977
978   pkttype
979       This module matches the link-layer packet type.
980
981       [!] --pkt-type {unicast|broadcast|multicast}
982
983   policy
984       This modules matches the policy used by IPsec for handling a packet.
985
986       --dir {in|out}
987              Used to select whether to match the policy used  for  decapsula‐
988              tion  or  the policy that will be used for encapsulation.  in is
989              valid in the PREROUTING, INPUT and FORWARD chains, out is  valid
990              in the POSTROUTING, OUTPUT and FORWARD chains.
991
992       --pol {none|ipsec}
993              Matches if the packet is subject to IPsec processing. --pol none
994              cannot be combined with --strict.
995
996       --strict
997              Selects whether to match the exact policy or match if  any  rule
998              of the policy matches the given policy.
999
1000       For  each  policy  element  that is to be described, one can use one or
1001       more of the following options. When --strict is in effect, at least one
1002       must be used per element.
1003
1004       [!] --reqid id
1005              Matches the reqid of the policy rule. The reqid can be specified
1006              with setkey(8) using unique:id as level.
1007
1008       [!] --spi spi
1009              Matches the SPI of the SA.
1010
1011       [!] --proto {ah|esp|ipcomp}
1012              Matches the encapsulation protocol.
1013
1014       [!] --mode {tunnel|transport}
1015              Matches the encapsulation mode.
1016
1017       [!] --tunnel-src addr[/mask]
1018              Matches the source end-point address of a tunnel mode SA.   Only
1019              valid with --mode tunnel.
1020
1021       [!] --tunnel-dst addr[/mask]
1022              Matches  the  destination end-point address of a tunnel mode SA.
1023              Only valid with --mode tunnel.
1024
1025       --next Start the next element in the policy specification. Can only  be
1026              used with --strict.
1027
1028   quota
1029       Implements  network  quotas  by  decrementing  a byte counter with each
1030       packet. The condition matches until  the  byte  counter  reaches  zero.
1031       Behavior  is  reversed with negation (i.e. the condition does not match
1032       until the byte counter reaches zero).
1033
1034       [!] --quota bytes
1035              The quota in bytes.
1036
1037   rateest
1038       The rate estimator can match on estimated rates  as  collected  by  the
1039       RATEEST  target.  It supports matching on absolute bps/pps values, com‐
1040       paring two rate estimators and matching on the difference  between  two
1041       rate estimators.
1042
1043       For a better understanding of the available options, these are all pos‐
1044       sible combinations:
1045
1046       ·   rateest operator rateest-bps
1047
1048       ·   rateest operator rateest-pps
1049
1050       ·   (rateest minus rateest-bps1) operator rateest-bps2
1051
1052       ·   (rateest minus rateest-pps1) operator rateest-pps2
1053
1054       ·   rateest1 operator rateest2 rateest-bps(without rate!)
1055
1056       ·   rateest1 operator rateest2 rateest-pps(without rate!)
1057
1058       ·   (rateest1 minus rateest-bps1)  operator  (rateest2  minus  rateest-
1059           bps2)
1060
1061       ·   (rateest1  minus  rateest-pps1)  operator  (rateest2 minus rateest-
1062           pps2)
1063
1064       --rateest-delta
1065           For each estimator (either absolute or  relative  mode),  calculate
1066           the  difference  between the estimator-determined flow rate and the
1067           static value chosen with the BPS/PPS options. If the flow  rate  is
1068           higher than the specified BPS/PPS, 0 will be used instead of a neg‐
1069           ative value. In other words, "max(0, rateest#_rate - rateest#_bps)"
1070           is used.
1071
1072       [!] --rateest-lt
1073           Match if rate is less than given rate/estimator.
1074
1075       [!] --rateest-gt
1076           Match if rate is greater than given rate/estimator.
1077
1078       [!] --rateest-eq
1079           Match if rate is equal to given rate/estimator.
1080
1081       In  the  so-called "absolute mode", only one rate estimator is used and
1082       compared against a static value, while in  "relative  mode",  two  rate
1083       estimators are compared against another.
1084
1085       --rateest name
1086              Name of the one rate estimator for absolute mode.
1087
1088       --rateest1 name
1089
1090       --rateest2 name
1091              The names of the two rate estimators for relative mode.
1092
1093       --rateest-bps [value]
1094
1095       --rateest-pps [value]
1096
1097       --rateest-bps1 [value]
1098
1099       --rateest-bps2 [value]
1100
1101       --rateest-pps1 [value]
1102
1103       --rateest-pps2 [value]
1104              Compare  the  estimator(s)  by  bytes or packets per second, and
1105              compare against the chosen value. See the above bullet list  for
1106              which  option  is to be used in which case. A unit suffix may be
1107              used - available ones  are:  bit,  [kmgt]bit,  [KMGT]ibit,  Bps,
1108              [KMGT]Bps, [KMGT]iBps.
1109
1110       Example:  This  is  what can be used to route outgoing data connections
1111       from an FTP server over two lines based on the available  bandwidth  at
1112       the time the data connection was started:
1113
1114       # Estimate outgoing rates
1115
1116       iptables  -t  mangle  -A  POSTROUTING -o eth0 -j RATEEST --rateest-name
1117       eth0 --rateest-interval 250ms --rateest-ewma 0.5s
1118
1119       iptables -t mangle -A POSTROUTING -o  ppp0  -j  RATEEST  --rateest-name
1120       ppp0 --rateest-interval 250ms --rateest-ewma 0.5s
1121
1122       # Mark based on available bandwidth
1123
1124       iptables  -t  mangle  -A  balance  -m conntrack --ctstate NEW -m helper
1125       --helper ftp -m rateest --rateest-delta --rateest1 eth0  --rateest-bps1
1126       2.5mbit  --rateest-gt  --rateest2 ppp0 --rateest-bps2 2mbit -j CONNMARK
1127       --set-mark 1
1128
1129       iptables -t mangle -A balance -m  conntrack  --ctstate  NEW  -m  helper
1130       --helper  ftp -m rateest --rateest-delta --rateest1 ppp0 --rateest-bps1
1131       2mbit --rateest-gt --rateest2 eth0 --rateest-bps2 2.5mbit  -j  CONNMARK
1132       --set-mark 2
1133
1134       iptables -t mangle -A balance -j CONNMARK --restore-mark
1135
1136   realm (IPv4-specific)
1137       This  matches  the  routing  realm.  Routing realms are used in complex
1138       routing setups involving dynamic routing protocols like BGP.
1139
1140       [!] --realm value[/mask]
1141              Matches a given realm number (and optionally  mask).  If  not  a
1142              number,  value can be a named realm from /etc/iproute2/rt_realms
1143              (mask can not be used in that case).
1144
1145   recent
1146       Allows you to dynamically create a list of IP addresses and then  match
1147       against that list in a few different ways.
1148
1149       For example, you can create a "badguy" list out of people attempting to
1150       connect to port 139 on your firewall and then DROP all  future  packets
1151       from them without considering them.
1152
1153       --set, --rcheck, --update and --remove are mutually exclusive.
1154
1155       --name name
1156              Specify  the  list  to use for the commands. If no name is given
1157              then DEFAULT will be used.
1158
1159       [!] --set
1160              This will add the source address of the packet to the  list.  If
1161              the  source address is already in the list, this will update the
1162              existing entry. This will always return success (or failure if !
1163              is passed in).
1164
1165       --rsource
1166              Match/save  the source address of each packet in the recent list
1167              table. This is the default.
1168
1169       --rdest
1170              Match/save the destination address of each packet in the  recent
1171              list table.
1172
1173       --mask netmask
1174              Netmask that will be applied to this recent list.
1175
1176       [!] --rcheck
1177              Check  if  the  source address of the packet is currently in the
1178              list.
1179
1180       [!] --update
1181              Like --rcheck, except it will update the "last  seen"  timestamp
1182              if it matches.
1183
1184       [!] --remove
1185              Check  if  the  source address of the packet is currently in the
1186              list and if so that address will be removed from  the  list  and
1187              the rule will return true. If the address is not found, false is
1188              returned.
1189
1190       --seconds seconds
1191              This option must be used in conjunction with one of --rcheck  or
1192              --update.  When  used, this will narrow the match to only happen
1193              when the address is in the list and was  seen  within  the  last
1194              given number of seconds.
1195
1196       --reap This  option  can  only  be  used in conjunction with --seconds.
1197              When used, this will cause entries older  than  the  last  given
1198              number of seconds to be purged.
1199
1200       --hitcount hits
1201              This  option must be used in conjunction with one of --rcheck or
1202              --update. When used, this will narrow the match to  only  happen
1203              when  the  address  is in the list and packets had been received
1204              greater than or equal to the given value.  This  option  may  be
1205              used  along  with  --seconds  to  create  an even narrower match
1206              requiring a certain number of hits within a specific time frame.
1207              The  maximum  value  for  the hitcount parameter is given by the
1208              "ip_pkt_list_tot" parameter  of  the  xt_recent  kernel  module.
1209              Exceeding  this value on the command line will cause the rule to
1210              be rejected.
1211
1212       --rttl This option may only be used in conjunction with one of --rcheck
1213              or  --update. When used, this will narrow the match to only hap‐
1214              pen when the address is in the list and the TTL of  the  current
1215              packet matches that of the packet which hit the --set rule. This
1216              may be useful if you have  problems  with  people  faking  their
1217              source  address in order to DoS you via this module by disallow‐
1218              ing others access to your site by sending bogus packets to you.
1219
1220       Examples:
1221
1222              iptables -A FORWARD -m recent --name badguy  --rcheck  --seconds
1223              60 -j DROP
1224
1225              iptables  -A FORWARD -p tcp -i eth0 --dport 139 -m recent --name
1226              badguy --set -j DROP
1227
1228       /proc/net/xt_recent/* are the current lists of addresses  and  informa‐
1229       tion about each entry of each list.
1230
1231       Each  file  in /proc/net/xt_recent/ can be read from to see the current
1232       list or written two using the following commands to modify the list:
1233
1234       echo +addr >/proc/net/xt_recent/DEFAULT
1235              to add addr to the DEFAULT list
1236
1237       echo -addr >/proc/net/xt_recent/DEFAULT
1238              to remove addr from the DEFAULT list
1239
1240       echo / >/proc/net/xt_recent/DEFAULT
1241              to flush the DEFAULT list (remove all entries).
1242
1243       The module itself accepts parameters, defaults shown:
1244
1245       ip_list_tot=100
1246              Number of addresses remembered per table.
1247
1248       ip_pkt_list_tot=20
1249              Number of packets per address remembered.
1250
1251       ip_list_hash_size=0
1252              Hash table size. 0 means to calculate it based  on  ip_list_tot,
1253              default: 512.
1254
1255       ip_list_perms=0644
1256              Permissions for /proc/net/xt_recent/* files.
1257
1258       ip_list_uid=0
1259              Numerical UID for ownership of /proc/net/xt_recent/* files.
1260
1261       ip_list_gid=0
1262              Numerical GID for ownership of /proc/net/xt_recent/* files.
1263
1264   rpfilter
1265       Performs  a  reverse  path  filter test on a packet.  If a reply to the
1266       packet would be sent via the same interface that the packet arrived on,
1267       the  packet  will  match.   Note  that, unlike the in-kernel rp_filter,
1268       packets protected by IPSec are not  treated  specially.   Combine  this
1269       match  with  the policy match if you want this.  Also, packets arriving
1270       via the loopback interface are always permitted.  This match  can  only
1271       be used in the PREROUTING chain of the raw or mangle table.
1272
1273       --loose
1274              Used  to specifiy that the reverse path filter test should match
1275              even if the selected output device is not the expected one.
1276
1277       --validmark
1278              Also use the packets' nfmark value when performing  the  reverse
1279              path route lookup.
1280
1281       --accept-local
1282              This will permit packets arriving from the network with a source
1283              address that is also assigned to the local machine.
1284
1285       --invert
1286              This will invert the sense of the match.   Instead  of  matching
1287              packets  that  passed  the reverse path filter test, match those
1288              that have failed it.
1289
1290       Example to log and drop packets failing the reverse path filter test:
1291
1292       iptables -t raw -N RPFILTER
1293
1294       iptables -t raw -A RPFILTER -m rpfilter -j RETURN
1295
1296       iptables -t raw  -A  RPFILTER  -m  limit  --limit  10/minute  -j  NFLOG
1297       --nflog-prefix "rpfilter drop"
1298
1299       iptables -t raw -A RPFILTER -j DROP
1300
1301       iptables -t raw -A PREROUTING -j RPFILTER
1302
1303       Example to drop failed packets, without logging:
1304
1305       iptables -t raw -A RPFILTER -m rpfilter --invert -j DROP
1306
1307   rt (IPv6-specific)
1308       Match on IPv6 routing header
1309
1310       [!] --rt-type type
1311              Match the type (numeric).
1312
1313       [!] --rt-segsleft num[:num]
1314              Match the `segments left' field (range).
1315
1316       [!] --rt-len length
1317              Match the length of this header.
1318
1319       --rt-0-res
1320              Match the reserved field, too (type=0)
1321
1322       --rt-0-addrs addr[,addr...]
1323              Match type=0 addresses (list).
1324
1325       --rt-0-not-strict
1326              List of type=0 addresses is not a strict list.
1327
1328   sctp
1329       [!] --source-port,--sport port[:port]
1330
1331       [!] --destination-port,--dport port[:port]
1332
1333       [!] --chunk-types {all|any|only} chunktype[:flags] [...]
1334              The  flag  letter  in  upper  case indicates that the flag is to
1335              match if set, in the lower case indicates to match if unset.
1336
1337              Chunk types: DATA INIT  INIT_ACK  SACK  HEARTBEAT  HEARTBEAT_ACK
1338              ABORT   SHUTDOWN   SHUTDOWN_ACK   ERROR  COOKIE_ECHO  COOKIE_ACK
1339              ECN_ECNE ECN_CWR SHUTDOWN_COMPLETE ASCONF ASCONF_ACK FORWARD_TSN
1340
1341              chunk type            available flags
1342              DATA                  I U B E i u b e
1343              ABORT                 T t
1344              SHUTDOWN_COMPLETE     T t
1345
1346              (lowercase means flag should be "off", uppercase means "on")
1347
1348       Examples:
1349
1350       iptables -A INPUT -p sctp --dport 80 -j DROP
1351
1352       iptables -A INPUT -p sctp --chunk-types any DATA,INIT -j DROP
1353
1354       iptables -A INPUT -p sctp --chunk-types any DATA:Be -j ACCEPT
1355
1356   set
1357       This module matches IP sets which can be defined by ipset(8).
1358
1359       [!] --match-set setname flag[,flag]...
1360              where flags are the comma separated list of src and/or dst spec‐
1361              ifications  and there can be no more than six of them. Hence the
1362              command
1363
1364               iptables -A FORWARD -m set --match-set test src,dst
1365
1366              will match packets, for which (if the set type is ipportmap) the
1367              source  address  and  destination  port pair can be found in the
1368              specified set. If the set type of the specified  set  is  single
1369              dimension (for example ipmap), then the command will match pack‐
1370              ets for which the source address can be found in  the  specified
1371              set.
1372
1373       --return-nomatch
1374              If  the  --return-nomatch  option  is specified and the set type
1375              supports the nomatch flag, then  the  matching  is  reversed:  a
1376              match with an element flagged with nomatch returns true, while a
1377              match with a plain element returns false.
1378
1379       ! --update-counters
1380              If the --update-counters flag is negated, then  the  packet  and
1381              byte  counters  of  the  matching  element  in  the set won't be
1382              updated. Default the packet and byte counters are updated.
1383
1384       ! --update-subcounters
1385              If the --update-subcounters flag is negated, then the packet and
1386              byte  counters  of  the  matching element in the member set of a
1387              list type of set won't be updated. Default the packet  and  byte
1388              counters are updated.
1389
1390       [!] --packets-eq value
1391              If  the  packet  is matched an element in the set, match only if
1392              the packet counter of the element matches the given value too.
1393
1394       --packets-lt value
1395              If the packet is matched an element in the set,  match  only  if
1396              the  packet  counter of the element is less than the given value
1397              as well.
1398
1399       --packets-gt value
1400              If the packet is matched an element in the set,  match  only  if
1401              the  packet  counter  of  the  element is greater than the given
1402              value as well.
1403
1404       [!] -bytes-eq value
1405              If the packet is matched an element in the set,  match  only  if
1406              the byte counter of the element matches the given value too.
1407
1408       --bytes-lt value
1409              If  the  packet  is matched an element in the set, match only if
1410              the byte counter of the element is less than the given value  as
1411              well.
1412
1413       --bytes-gt value
1414              If  the  packet  is matched an element in the set, match only if
1415              the byte counter of the element is greater than the given  value
1416              as well.
1417
1418       The packet and byte counters related options and flags are ignored when
1419       the set was defined without counter support.
1420
1421       The option --match-set can be replaced by --set if that does not  clash
1422       with an option of other extensions.
1423
1424       Use  of  -m  set requires that ipset kernel support is provided, which,
1425       for standard kernels, is the case since Linux 2.6.39.
1426
1427   socket
1428       This matches if an open TCP/UDP socket can be found by doing  a  socket
1429       lookup on the packet. It matches if there is an established or non-zero
1430       bound listening socket (possibly with a non-local address). The  lookup
1431       is performed using the packet tuple of TCP/UDP packets, or the original
1432       TCP/UDP header embedded in an ICMP/ICPMv6 error packet.
1433
1434       --transparent
1435              Ignore non-transparent sockets.
1436
1437       --nowildcard
1438              Do not ignore sockets bound to 'any' address.  The socket  match
1439              won't  accept  zero-bound listeners by default, since then local
1440              services could intercept traffic that would  otherwise  be  for‐
1441              warded.   This  option  therefore has security implications when
1442              used to match traffic being forwarded to redirect  such  packets
1443              to  local  machine  with  policy routing.  When using the socket
1444              match to implement fully transparent proxies bound to  non-local
1445              addresses  it  is  recommended  to  use the --transparent option
1446              instead.
1447
1448       Example (assuming packets with mark 1 are delivered locally):
1449
1450              -t  mangle  -A  PREROUTING  -m  socket  --transparent  -j   MARK
1451              --set-mark 1
1452
1453   state
1454       The  "state"  extension is a subset of the "conntrack" module.  "state"
1455       allows access to the connection tracking state for this packet.
1456
1457       [!] --state state
1458              Where state is a comma separated list of the  connection  states
1459              to  match. Only a subset of the states unterstood by "conntrack"
1460              are recognized: INVALID, ESTABLISHED, NEW, RELATED or UNTRACKED.
1461              For  their description, see the "conntrack" heading in this man‐
1462              page.
1463
1464   statistic
1465       This module matches packets based on some statistic condition.  It sup‐
1466       ports two distinct modes settable with the --mode option.
1467
1468       Supported options:
1469
1470       --mode mode
1471              Set  the matching mode of the matching rule, supported modes are
1472              random and nth.
1473
1474       [!] --probability p
1475              Set the probability for a packet to be randomly matched. It only
1476              works  with  the  random mode. p must be within 0.0 and 1.0. The
1477              supported granularity is in 1/2147483648th increments.
1478
1479       [!] --every n
1480              Match one packet every nth packet. It works only  with  the  nth
1481              mode (see also the --packet option).
1482
1483       --packet p
1484              Set the initial counter value (0 <= p <= n-1, default 0) for the
1485              nth mode.
1486
1487   string
1488       This modules matches a given string  by  using  some  pattern  matching
1489       strategy. It requires a linux kernel >= 2.6.14.
1490
1491       --algo {bm|kmp}
1492              Select  the  pattern matching strategy. (bm = Boyer-Moore, kmp =
1493              Knuth-Pratt-Morris)
1494
1495       --from offset
1496              Set the offset from which it starts looking for any matching. If
1497              not passed, default is 0.
1498
1499       --to offset
1500              Set the offset up to which should be scanned. That is, byte off‐
1501              set-1 (counting from 0) is the last one that is scanned.  If not
1502              passed, default is the packet size.
1503
1504       [!] --string pattern
1505              Matches the given pattern.
1506
1507       [!] --hex-string pattern
1508              Matches the given pattern in hex notation.
1509
1510       Examples:
1511
1512              # The string pattern can be used for simple text characters.
1513              iptables -A INPUT -p tcp --dport 80 -m string --algo bm --string
1514              'GET /index.html' -j LOG
1515
1516              # The hex string pattern can be used for  non-printable  charac‐
1517              ters, like |0D 0A| or |0D0A|.
1518              iptables -p udp --dport 53 -m string --algo bm --from 40 --to 57
1519              --hex-string '|03|www|09|netfilter|03|org|00|'
1520
1521   tcp
1522       These extensions can be used if `--protocol tcp' is specified. It  pro‐
1523       vides the following options:
1524
1525       [!] --source-port,--sport port[:port]
1526              Source  port  or  port range specification. This can either be a
1527              service name or a port number. An inclusive range  can  also  be
1528              specified,  using  the  format first:last.  If the first port is
1529              omitted, "0" is assumed; if the  last  is  omitted,  "65535"  is
1530              assumed.   If the first port is greater than the second one they
1531              will be swapped.  The flag --sport is  a  convenient  alias  for
1532              this option.
1533
1534       [!] --destination-port,--dport port[:port]
1535              Destination  port or port range specification.  The flag --dport
1536              is a convenient alias for this option.
1537
1538       [!] --tcp-flags mask comp
1539              Match when the TCP flags are as specified.  The  first  argument
1540              mask  is  the flags which we should examine, written as a comma-
1541              separated list, and the second argument comp  is  a  comma-sepa‐
1542              rated  list  of flags which must be set.  Flags are: SYN ACK FIN
1543              RST URG PSH ALL NONE.  Hence the command
1544               iptables -A FORWARD -p tcp --tcp-flags SYN,ACK,FIN,RST SYN
1545              will only match packets with the SYN flag set, and the ACK,  FIN
1546              and RST flags unset.
1547
1548       [!] --syn
1549              Only  match TCP packets with the SYN bit set and the ACK,RST and
1550              FIN bits cleared.  Such packets are used to request TCP  connec‐
1551              tion initiation; for example, blocking such packets coming in an
1552              interface will prevent incoming TCP  connections,  but  outgoing
1553              TCP  connections  will  be  unaffected.   It  is  equivalent  to
1554              --tcp-flags SYN,RST,ACK,FIN SYN.  If the "!" flag  precedes  the
1555              "--syn", the sense of the option is inverted.
1556
1557       [!] --tcp-option number
1558              Match if TCP option set.
1559
1560   tcpmss
1561       This  matches  the  TCP  MSS  (maximum  segment  size) field of the TCP
1562       header.  You can only use this on TCP SYN or SYN/ACK packets, since the
1563       MSS  is  only negotiated during the TCP handshake at connection startup
1564       time.
1565
1566       [!] --mss value[:value]
1567              Match a given TCP MSS value or range. If a range is  given,  the
1568              second value must be greater than or equal to the first value.
1569
1570   time
1571       This  matches  if the packet arrival time/date is within a given range.
1572       All options are optional, but are ANDed when specified. All  times  are
1573       interpreted as UTC by default.
1574
1575       --datestart YYYY[-MM[-DD[Thh[:mm[:ss]]]]]
1576
1577       --datestop YYYY[-MM[-DD[Thh[:mm[:ss]]]]]
1578              Only  match during the given time, which must be in ISO 8601 "T"
1579              notation.  The possible time  range  is  1970-01-01T00:00:00  to
1580              2038-01-19T04:17:07.
1581
1582              If  --datestart or --datestop are not specified, it will default
1583              to 1970-01-01 and 2038-01-19, respectively.
1584
1585       --timestart hh:mm[:ss]
1586
1587       --timestop hh:mm[:ss]
1588              Only match during the given daytime. The possible time range  is
1589              00:00:00  to 23:59:59. Leading zeroes are allowed (e.g. "06:03")
1590              and correctly interpreted as base-10.
1591
1592       [!] --monthdays day[,day...]
1593              Only match on the given days of the month. Possible values are 1
1594              to  31.  Note  that  specifying  31  will of course not match on
1595              months which do not have a 31st day; the same goes  for  28-  or
1596              29-day February.
1597
1598       [!] --weekdays day[,day...]
1599              Only  match on the given weekdays. Possible values are Mon, Tue,
1600              Wed, Thu, Fri, Sat, Sun, or values from 1  to  7,  respectively.
1601              You may also use two-character variants (Mo, Tu, etc.).
1602
1603       --contiguous
1604              When --timestop is smaller than --timestart value, match this as
1605              a single time period instead distinct intervals.  See EXAMPLES.
1606
1607       --kerneltz
1608              Use the kernel timezone instead of UTC to  determine  whether  a
1609              packet meets the time regulations.
1610
1611       About  kernel timezones: Linux keeps the system time in UTC, and always
1612       does so.  On boot, system time is initialized from a  referential  time
1613       source. Where this time source has no timezone information, such as the
1614       x86 CMOS RTC, UTC will be assumed. If the time source is however not in
1615       UTC,  userspace  should provide the correct system time and timezone to
1616       the kernel once it has the information.
1617
1618       Local time is a feature on top of  the  (timezone  independent)  system
1619       time. Each process has its own idea of local time, specified via the TZ
1620       environment variable. The kernel also has its own timezone offset vari‐
1621       able. The TZ userspace environment variable specifies how the UTC-based
1622       system time is displayed, e.g. when you run date(1), or what you see on
1623       your  desktop clock.  The TZ string may resolve to different offsets at
1624       different dates, which is what enables the  automatic  time-jumping  in
1625       userspace.  when  DST changes. The kernel's timezone offset variable is
1626       used when it has to  convert  between  non-UTC  sources,  such  as  FAT
1627       filesystems,  to  UTC  (since the latter is what the rest of the system
1628       uses).
1629
1630       The caveat with the kernel timezone is  that  Linux  distributions  may
1631       ignore  to  set  the  kernel  timezone, and instead only set the system
1632       time. Even if a particular distribution does set the timezone at  boot,
1633       it  is usually does not keep the kernel timezone offset - which is what
1634       changes on DST - up to date.  ntpd will not touch the kernel  timezone,
1635       so  running it will not resolve the issue. As such, one may encounter a
1636       timezone that is always +0000, or one that is wrong half of the time of
1637       the year. As such, using --kerneltz is highly discouraged.
1638
1639       EXAMPLES. To match on weekends, use:
1640
1641              -m time --weekdays Sa,Su
1642
1643       Or, to match (once) on a national holiday block:
1644
1645              -m time --datestart 2007-12-24 --datestop 2007-12-27
1646
1647       Since the stop time is actually inclusive, you would need the following
1648       stop time to not match the first second of the new day:
1649
1650              -m     time     --datestart     2007-01-01T17:00      --datestop
1651              2007-01-01T23:59:59
1652
1653       During lunch hour:
1654
1655              -m time --timestart 12:30 --timestop 13:30
1656
1657       The fourth Friday in the month:
1658
1659              -m time --weekdays Fr --monthdays 22,23,24,25,26,27,28
1660
1661       (Note  that  this  exploits  a certain mathematical property. It is not
1662       possible to say "fourth Thursday OR fourth Friday" in one rule.  It  is
1663       possible with multiple rules, though.)
1664
1665       Matching across days might not do what is expected.  For instance,
1666
1667              -m  time  --weekdays Mo --timestart 23:00  --timestop 01:00 Will
1668              match Monday, for one hour from midnight to  1  a.m.,  and  then
1669              again for another hour from 23:00 onwards.  If this is unwanted,
1670              e.g. if you would like 'match for two hours  from  Montay  23:00
1671              onwards' you need to also specify the --contiguous option in the
1672              example above.
1673
1674   tos
1675       This module matches the 8-bit Type of Service field in the IPv4  header
1676       (i.e.   including  the  "Precedence" bits) or the (also 8-bit) Priority
1677       field in the IPv6 header.
1678
1679       [!] --tos value[/mask]
1680              Matches packets with the given TOS mark  value.  If  a  mask  is
1681              specified,  it  is  logically ANDed with the TOS mark before the
1682              comparison.
1683
1684       [!] --tos symbol
1685              You can specify a symbolic name when using  the  tos  match  for
1686              IPv4.  The list of recognized TOS names can be obtained by call‐
1687              ing iptables with -m tos -h.  Note that this implies a  mask  of
1688              0x3F, i.e. all but the ECN bits.
1689
1690   ttl (IPv4-specific)
1691       This module matches the time to live field in the IP header.
1692
1693       [!] --ttl-eq ttl
1694              Matches the given TTL value.
1695
1696       --ttl-gt ttl
1697              Matches if TTL is greater than the given TTL value.
1698
1699       --ttl-lt ttl
1700              Matches if TTL is less than the given TTL value.
1701
1702   u32
1703       U32  tests  whether quantities of up to 4 bytes extracted from a packet
1704       have specified values. The specification of what to extract is  general
1705       enough to find data at given offsets from tcp headers or payloads.
1706
1707       [!] --u32 tests
1708              The  argument amounts to a program in a small language described
1709              below.
1710
1711              tests := location "=" value | tests "&&" location "=" value
1712
1713              value := range | value "," range
1714
1715              range := number | number ":" number
1716
1717       a single number, n, is interpreted the same as n:n. n:m is  interpreted
1718       as the range of numbers >=n and <=m.
1719
1720           location := number | location operator number
1721
1722           operator := "&" | "<<" | ">>" | "@"
1723
1724       The  operators &, <<, >> and && mean the same as in C.  The = is really
1725       a set membership operator and the value syntax describes a set.  The  @
1726       operator is what allows moving to the next header and is described fur‐
1727       ther below.
1728
1729       There are currently some artificial implementation limits on  the  size
1730       of the tests:
1731
1732           *  no more than 10 of "=" (and 9 "&&"s) in the u32 argument
1733
1734           *  no more than 10 ranges (and 9 commas) per value
1735
1736           *  no more than 10 numbers (and 9 operators) per location
1737
1738       To describe the meaning of location, imagine the following machine that
1739       interprets it. There are three registers:
1740
1741              A is of type char *, initially the address of the IP header
1742
1743              B and C are unsigned 32 bit integers, initially zero
1744
1745       The instructions are:
1746
1747              number B = number;
1748
1749              C = (*(A+B)<<24) + (*(A+B+1)<<16) + (*(A+B+2)<<8) + *(A+B+3)
1750
1751              &number C = C & number
1752
1753              << number C = C << number
1754
1755              >> number C = C >> number
1756
1757              @number A = A + C; then do the instruction number
1758
1759       Any access of memory outside [skb->data,skb->end] causes the  match  to
1760       fail.  Otherwise the result of the computation is the final value of C.
1761
1762       Whitespace is allowed but not required in the tests. However, the char‐
1763       acters that do occur there are likely to require shell quoting,  so  it
1764       is a good idea to enclose the arguments in quotes.
1765
1766       Example:
1767
1768              match IP packets with total length >= 256
1769
1770              The IP header contains a total length field in bytes 2-3.
1771
1772              --u32 "0 & 0xFFFF = 0x100:0xFFFF"
1773
1774              read bytes 0-3
1775
1776              AND  that  with 0xFFFF (giving bytes 2-3), and test whether that
1777              is in the range [0x100:0xFFFF]
1778
1779       Example: (more realistic, hence more complicated)
1780
1781              match ICMP packets with icmp type 0
1782
1783              First test that it is an ICMP packet, true iff byte 9 (protocol)
1784              = 1
1785
1786              --u32 "6 & 0xFF = 1 && ...
1787
1788              read  bytes  6-9,  use & to throw away bytes 6-8 and compare the
1789              result to 1. Next test that it is not a  fragment.  (If  so,  it
1790              might be part of such a packet but we cannot always tell.) N.B.:
1791              This test is generally needed if  you  want  to  match  anything
1792              beyond  the IP header. The last 6 bits of byte 6 and all of byte
1793              7 are 0 iff this is a complete packet (not a fragment). Alterna‐
1794              tively, you can allow first fragments by only testing the last 5
1795              bits of byte 6.
1796
1797               ... 4 & 0x3FFF = 0 && ...
1798
1799              Last test: the first byte past the IP header (the  type)  is  0.
1800              This  is  where we have to use the @syntax. The length of the IP
1801              header (IHL) in 32 bit words is stored in the right half of byte
1802              0 of the IP header itself.
1803
1804               ... 0 >> 22 & 0x3C @ 0 >> 24 = 0"
1805
1806              The  first 0 means read bytes 0-3, >>22 means shift that 22 bits
1807              to the right. Shifting 24 bits would give  the  first  byte,  so
1808              only  22  bits is four times that plus a few more bits. &3C then
1809              eliminates the two extra bits on the right and  the  first  four
1810              bits  of  the  first  byte.  For instance, if IHL=5, then the IP
1811              header is 20 (4 x 5) bytes long. In this case, bytes 0-1 are (in
1812              binary)   xxxx0101   yyzzzzzz,  >>22  gives  the  10  bit  value
1813              xxxx0101yy and &3C gives 010100. @ means to use this number as a
1814              new  offset  into  the packet, and read four bytes starting from
1815              there. This is the first 4 bytes of the ICMP payload,  of  which
1816              byte 0 is the ICMP type. Therefore, we simply shift the value 24
1817              to the right to throw out all but the first byte and compare the
1818              result with 0.
1819
1820       Example:
1821
1822              TCP payload bytes 8-12 is any of 1, 2, 5 or 8
1823
1824              First we test that the packet is a tcp packet (similar to ICMP).
1825
1826              --u32 "6 & 0xFF = 6 && ...
1827
1828              Next, test that it is not a fragment (same as above).
1829
1830               ... 0 >> 22 & 0x3C @ 12 >> 26 & 0x3C @ 8 = 1,2,5,8"
1831
1832              0>>22&3C as above computes the number of bytes in the IP header.
1833              @ makes this the new offset into the packet, which is the  start
1834              of the TCP header. The length of the TCP header (again in 32 bit
1835              words) is the left half of  byte  12  of  the  TCP  header.  The
1836              12>>26&3C  computes  this  length  in  bytes  (similar to the IP
1837              header before). "@" makes this the  new  offset,  which  is  the
1838              start  of  the  TCP  payload. Finally, 8 reads bytes 8-12 of the
1839              payload and = checks whether the result is any of 1, 2, 5 or 8.
1840
1841   udp
1842       These extensions can be used if `--protocol udp' is specified. It  pro‐
1843       vides the following options:
1844
1845       [!] --source-port,--sport port[:port]
1846              Source port or port range specification.  See the description of
1847              the --source-port option of the TCP extension for details.
1848
1849       [!] --destination-port,--dport port[:port]
1850              Destination port or port range specification.  See the  descrip‐
1851              tion  of  the --destination-port option of the TCP extension for
1852              details.
1853
1854   unclean (IPv4-specific)
1855       This module takes no options, but attempts to match packets which  seem
1856       malformed or unusual.  This is regarded as experimental.
1857

TARGET EXTENSIONS

1859       iptables can use extended target modules: the following are included in
1860       the standard distribution.
1861
1862   AUDIT
1863       This target allows to create audit records for packets hitting the tar‐
1864       get.  It can be used to record accepted, dropped, and rejected packets.
1865       See auditd(8) for additional details.
1866
1867       --type {accept|drop|reject}
1868              Set type of audit record.
1869
1870       Example:
1871
1872              iptables -N AUDIT_DROP
1873
1874              iptables -A AUDIT_DROP -j AUDIT --type drop
1875
1876              iptables -A AUDIT_DROP -j DROP
1877
1878   CHECKSUM
1879       This target allows to selectively work around broken/old  applications.
1880       It can only be used in the mangle table.
1881
1882       --checksum-fill
1883              Compute and fill in the checksum in a packet that lacks a check‐
1884              sum.  This is particularly useful, if you need  to  work  around
1885              old  applications  such  as  dhcp clients, that do not work well
1886              with checksum offloads, but don't want to disable checksum  off‐
1887              load in your device.
1888
1889   CLASSIFY
1890       This  module  allows you to set the skb->priority value (and thus clas‐
1891       sify the packet into a specific CBQ class).
1892
1893       --set-class major:minor
1894              Set the major and minor  class  value.  The  values  are  always
1895              interpreted as hexadecimal even if no 0x prefix is given.
1896
1897   CLUSTERIP (IPv4-specific)
1898       This  module  allows  you  to  configure a simple cluster of nodes that
1899       share a certain IP and MAC address without an explicit load balancer in
1900       front  of  them.   Connections  are  statically distributed between the
1901       nodes in this cluster.
1902
1903       --new  Create a new ClusterIP.  You always have  to  set  this  on  the
1904              first rule for a given ClusterIP.
1905
1906       --hashmode mode
1907              Specify  the  hashing  mode.   Has  to be one of sourceip, sour‐
1908              ceip-sourceport, sourceip-sourceport-destport.
1909
1910       --clustermac mac
1911              Specify the ClusterIP MAC address. Has to be a link-layer multi‐
1912              cast address
1913
1914       --total-nodes num
1915              Number of total nodes within this cluster.
1916
1917       --local-node num
1918              Local node number within this cluster.
1919
1920       --hash-init rnd
1921              Specify the random seed used for hash initialization.
1922
1923   CONNMARK
1924       This module sets the netfilter mark value associated with a connection.
1925       The mark is 32 bits wide.
1926
1927       --set-xmark value[/mask]
1928              Zero out the bits given by mask and XOR value into the ctmark.
1929
1930       --save-mark [--nfmask nfmask] [--ctmask ctmask]
1931              Copy the packet mark (nfmark) to the  connection  mark  (ctmark)
1932              using  the  given  masks.  The new nfmark value is determined as
1933              follows:
1934
1935              ctmark = (ctmark & ~ctmask) ^ (nfmark & nfmask)
1936
1937              i.e. ctmask defines what bits to clear and nfmask what  bits  of
1938              the  nfmark to XOR into the ctmark. ctmask and nfmask default to
1939              0xFFFFFFFF.
1940
1941       --restore-mark [--nfmask nfmask] [--ctmask ctmask]
1942              Copy the connection mark (ctmark) to the  packet  mark  (nfmark)
1943              using  the  given  masks.  The new ctmark value is determined as
1944              follows:
1945
1946              nfmark = (nfmark & ~nfmask) ^ (ctmark & ctmask);
1947
1948              i.e. nfmask defines what bits to clear and ctmask what  bits  of
1949              the  ctmark to XOR into the nfmark. ctmask and nfmask default to
1950              0xFFFFFFFF.
1951
1952              --restore-mark is only valid in the mangle table.
1953
1954       The following mnemonics are available for --set-xmark:
1955
1956       --and-mark bits
1957              Binary AND the  ctmark  with  bits.  (Mnemonic  for  --set-xmark
1958              0/invbits, where invbits is the binary negation of bits.)
1959
1960       --or-mark bits
1961              Binary  OR  the  ctmark  with  bits.  (Mnemonic  for --set-xmark
1962              bits/bits.)
1963
1964       --xor-mark bits
1965              Binary XOR the  ctmark  with  bits.  (Mnemonic  for  --set-xmark
1966              bits/0.)
1967
1968       --set-mark value[/mask]
1969              Set  the connection mark. If a mask is specified then only those
1970              bits set in the mask are modified.
1971
1972       --save-mark [--mask mask]
1973              Copy the nfmark to the ctmark. If  a  mask  is  specified,  only
1974              those bits are copied.
1975
1976       --restore-mark [--mask mask]
1977              Copy  the  ctmark  to  the  nfmark. If a mask is specified, only
1978              those bits are copied. This is only valid in the mangle table.
1979
1980   CONNSECMARK
1981       This module copies security markings from packets  to  connections  (if
1982       unlabeled),  and  from  connections back to packets (also only if unla‐
1983       beled).  Typically used in conjunction with SECMARK, it is valid in the
1984       security  table  (for backwards compatibility with older kernels, it is
1985       also valid in the mangle table).
1986
1987       --save If the packet has a security marking, copy it to the  connection
1988              if the connection is not marked.
1989
1990       --restore
1991              If  the packet does not have a security marking, and the connec‐
1992              tion does, copy the security marking from the connection to  the
1993              packet.
1994
1995
1996   CT
1997       The  CT  target allows to set parameters for a packet or its associated
1998       connection. The target attaches a "template" connection tracking  entry
1999       to the packet, which is then used by the conntrack core when initializ‐
2000       ing a new ct entry. This target is thus only valid in the "raw" table.
2001
2002       --notrack
2003              Disables connection tracking for this packet.
2004
2005       --helper name
2006              Use the helper identified by name for the  connection.  This  is
2007              more  flexible  than  loading  the conntrack helper modules with
2008              preset ports.
2009
2010       --ctevents event[,...]
2011              Only generate the specified conntrack events  for  this  connec‐
2012              tion.  Possible  event  types are: new, related, destroy, reply,
2013              assured, protoinfo, helper, mark (this refers to the ctmark, not
2014              nfmark), natseqinfo, secmark (ctsecmark).
2015
2016       --expevents event[,...]
2017              Only  generate the specified expectation events for this connec‐
2018              tion.  Possible event types are: new.
2019
2020       --zone id
2021              Assign this packet to zone id and only have lookups done in that
2022              zone.  By default, packets have zone 0.
2023
2024       --timeout name
2025              Use  the  timeout  policy identified by name for the connection.
2026              This is provides more flexible timeout  policy  definition  than
2027              global   timeout   values   available  at  /proc/sys/net/netfil‐
2028              ter/nf_conntrack_*_timeout_*.
2029
2030   DNAT
2031       This target is only valid in the nat table, in the PREROUTING and  OUT‐
2032       PUT  chains,  and  user-defined chains which are only called from those
2033       chains.  It specifies that the destination address of the packet should
2034       be  modified  (and  all  future packets in this connection will also be
2035       mangled), and rules should cease being examined.  It takes the  follow‐
2036       ing options:
2037
2038       --to-destination [ipaddr[-ipaddr]][:port[-port]]
2039              which can specify a single new destination IP address, an inclu‐
2040              sive range of IP addresses. Optionally a port range, if the rule
2041              also specifies one of the following protocols: tcp, udp, dccp or
2042              sctp.  If no port range is specified, then the destination  port
2043              will  never be modified. If no IP address is specified then only
2044              the destination port will be modified.  In Kernels up to  2.6.10
2045              you can add several --to-destination options. For those kernels,
2046              if you specify more than one destination address, either via  an
2047              address  range  or  multiple  --to-destination options, a simple
2048              round-robin (one after another in cycle)  load  balancing  takes
2049              place  between  these  addresses.  Later Kernels (>= 2.6.11-rc1)
2050              don't have the ability to NAT to multiple ranges anymore.
2051
2052       --random
2053              If option --random is used then port mapping will be  randomized
2054              (kernel >= 2.6.22).
2055
2056       --persistent
2057              Gives  a  client  the  same source-/destination-address for each
2058              connection.  This supersedes the SAME target. Support  for  per‐
2059              sistent mappings is available from 2.6.29-rc2.
2060
2061       IPv6 support available since Linux kernels >= 3.7.
2062
2063   DNPT (IPv6-specific)
2064       Provides  stateless destination IPv6-to-IPv6 Network Prefix Translation
2065       (as described by RFC 6296).
2066
2067       You have to use this target in the mangle table, not in the nat  table.
2068       It takes the following options:
2069
2070       --src-pfx [prefix/length]
2071              Set source prefix that you want to translate and length
2072
2073       --dst-pfx [prefix/length]
2074              Set  destination  prefix that you want to use in the translation
2075              and length
2076
2077       You have to use the SNPT target to undo the translation. Example:
2078
2079              ip6tables -t mangle -I POSTROUTING -s fd00::/64  -o vboxnet0  -j
2080              SNPT --src-pfx fd00::/64 --dst-pfx 2001:e20:2000:40f::/64
2081
2082              ip6tables    -t    mangle    -I    PREROUTING    -i   wlan0   -d
2083              2001:e20:2000:40f::/64 -j DNPT --src-pfx  2001:e20:2000:40f::/64
2084              --dst-pfx fd00::/64
2085
2086       You may need to enable IPv6 neighbor proxy:
2087
2088              sysctl -w net.ipv6.conf.all.proxy_ndp=1
2089
2090       You  also have to use the NOTRACK target to disable connection tracking
2091       for translated flows.
2092
2093   DSCP
2094       This target allows to alter the value of the DSCP bits within  the  TOS
2095       header  of  the IPv4 packet.  As this manipulates a packet, it can only
2096       be used in the mangle table.
2097
2098       --set-dscp value
2099              Set the DSCP field to a numerical value (can be decimal or hex)
2100
2101       --set-dscp-class class
2102              Set the DSCP field to a DiffServ class.
2103
2104   ECN (IPv4-specific)
2105       This target allows to selectively work around known ECN blackholes.  It
2106       can only be used in the mangle table.
2107
2108       --ecn-tcp-remove
2109              Remove all ECN bits from the TCP header.  Of course, it can only
2110              be used in conjunction with -p tcp.
2111
2112   HL (IPv6-specific)
2113       This is used to modify the Hop Limit field  in  IPv6  header.  The  Hop
2114       Limit  field is similar to what is known as TTL value in IPv4.  Setting
2115       or incrementing the Hop Limit field can potentially be very  dangerous,
2116       so  it should be avoided at any cost. This target is only valid in man‐
2117       gle table.
2118
2119       Don't ever set or increment the value on packets that leave your  local
2120       network!
2121
2122       --hl-set value
2123              Set the Hop Limit to `value'.
2124
2125       --hl-dec value
2126              Decrement the Hop Limit `value' times.
2127
2128       --hl-inc value
2129              Increment the Hop Limit `value' times.
2130
2131   HMARK
2132       Like MARK, i.e. set the fwmark, but the mark is calculated from hashing
2133       packet selector at choice. You have also to specify the mark range and,
2134       optionally, the offset to start from. ICMP error messages are inspected
2135       and used to calculate the hashing.
2136
2137       Existing options are:
2138
2139       --hmark-tuple tuple
2140              Possible tuple members are: src meaning  source  address  (IPv4,
2141              IPv6  address),  dst  meaning  destination  address  (IPv4, IPv6
2142              address), sport meaning source port (TCP,  UDP,  UDPlite,  SCTP,
2143              DCCP),  dport meaning destination port (TCP, UDP, UDPlite, SCTP,
2144              DCCP), spi meaning Security Parameter Index (AH,  ESP),  and  ct
2145              meaning  the  usage of the conntrack tuple instead of the packet
2146              selectors.
2147
2148       --hmark-mod value (must be > 0)
2149              Modulus for hash calculation (to limit  the  range  of  possible
2150              marks)
2151
2152       --hmark-offset value
2153              Offset to start marks from.
2154
2155       For  advanced  usage,  instead  of using --hmark-tuple, you can specify
2156       custom
2157              prefixes and masks:
2158
2159       --hmark-src-prefix cidr
2160              The source address mask in CIDR notation.
2161
2162       --hmark-dst-prefix cidr
2163              The destination address mask in CIDR notation.
2164
2165       --hmark-sport-mask value
2166              A 16 bit source port mask in hexadecimal.
2167
2168       --hmark-dport-mask value
2169              A 16 bit destination port mask in hexadecimal.
2170
2171       --hmark-spi-mask value
2172              A 32 bit field with spi mask.
2173
2174       --hmark-proto-mask value
2175              An 8 bit field with layer 4 protocol number.
2176
2177       --hmark-rnd value
2178              A 32 bit random custom value to feed hash calculation.
2179
2180       Examples:
2181
2182       iptables -t mangle -A PREROUTING -m conntrack --ctstate NEW
2183        -j   HMARK   --hmark-tuple   ct,src,dst,proto   --hmark-offset   10000
2184       --hmark-mod 10 --hmark-rnd 0xfeedcafe
2185
2186       iptables -t mangle -A PREROUTING -j HMARK --hmark-offset 10000 --hmark-
2187       tuple src,dst,proto --hmark-mod 10 --hmark-rnd 0xdeafbeef
2188
2189   IDLETIMER
2190       This target can be used to identify when interfaces have been idle  for
2191       a certain period of time.  Timers are identified by labels and are cre‐
2192       ated when a rule is set with a new label.  The rules also take a  time‐
2193       out  value  (in  seconds) as an option.  If more than one rule uses the
2194       same timer label, the timer will be restarted whenever any of the rules
2195       get  a  hit.   One  entry  for  each  timer  is created in sysfs.  This
2196       attribute contains the timer remaining for the timer  to  expire.   The
2197       attributes are located under the xt_idletimer class:
2198
2199       /sys/class/xt_idletimer/timers/<label>
2200
2201       When the timer expires, the target module sends a sysfs notification to
2202       the userspace, which can then decide what to do (eg. disconnect to save
2203       power).
2204
2205       --timeout amount
2206              This is the time in seconds that will trigger the notification.
2207
2208       --label string
2209              This  is  a unique identifier for the timer.  The maximum length
2210              for the label string is 27 characters.
2211
2212   LED
2213       This creates an LED-trigger that can then be attached to system indica‐
2214       tor  lights,  to  blink  or  illuminate  them when certain packets pass
2215       through the system. One example might be to light up an LED for  a  few
2216       minutes  every time an SSH connection is made to the local machine. The
2217       following options control the trigger behavior:
2218
2219       --led-trigger-id name
2220              This is the name given to the LED trigger. The  actual  name  of
2221              the trigger will be prefixed with "netfilter-".
2222
2223       --led-delay ms
2224              This indicates how long (in milliseconds) the LED should be left
2225              illuminated when a packet  arrives  before  being  switched  off
2226              again. The default is 0 (blink as fast as possible.) The special
2227              value inf can be given to leave  the  LED  on  permanently  once
2228              activated.  (In  this  case the trigger will need to be manually
2229              detached and reattached to the  LED  device  to  switch  it  off
2230              again.)
2231
2232       --led-always-blink
2233              Always  make the LED blink on packet arrival, even if the LED is
2234              already on.  This allows notification of new packets  even  with
2235              long delay values (which otherwise would result in a silent pro‐
2236              longing of the delay time.)
2237
2238       Example:
2239
2240       Create an LED trigger for incoming SSH traffic:
2241              iptables -A INPUT -p tcp --dport 22 -j LED --led-trigger-id ssh
2242
2243       Then attach the new trigger to an LED:
2244              echo netfilter-ssh >/sys/class/leds/ledname/trigger
2245
2246   LOG
2247       Turn on kernel logging of matching packets.  When this  option  is  set
2248       for  a rule, the Linux kernel will print some information on all match‐
2249       ing packets (like most IP/IPv6 header fields) via the kernel log (where
2250       it can be read with dmesg(1) or read in the syslog).
2251
2252       This  is  a  "non-terminating target", i.e. rule traversal continues at
2253       the next rule.  So if you want to LOG the packets you refuse,  use  two
2254       separate  rules with the same matching criteria, first using target LOG
2255       then DROP (or REJECT).
2256
2257       --log-level level
2258              Level of logging, which can be (system-specific)  numeric  or  a
2259              mnemonic.   Possible  values  are (in decreasing order of prior‐
2260              ity): emerg, alert, crit, error, warning, notice, info or debug.
2261
2262       --log-prefix prefix
2263              Prefix log messages with the specified prefix; up to 29  letters
2264              long, and useful for distinguishing messages in the logs.
2265
2266       --log-tcp-sequence
2267              Log  TCP sequence numbers. This is a security risk if the log is
2268              readable by users.
2269
2270       --log-tcp-options
2271              Log options from the TCP packet header.
2272
2273       --log-ip-options
2274              Log options from the IP/IPv6 packet header.
2275
2276       --log-uid
2277              Log the userid of the process which generated the packet.
2278
2279   MARK
2280       This target is used to set the Netfilter mark value associated with the
2281       packet.  It can, for example, be used in conjunction with routing based
2282       on fwmark (needs iproute2). If you plan on doing so, note that the mark
2283       needs  to  be set in the PREROUTING chain of the mangle table to affect
2284       routing.  The mark field is 32 bits wide.
2285
2286       --set-xmark value[/mask]
2287              Zeroes out the bits given by mask and XORs value into the packet
2288              mark ("nfmark"). If mask is omitted, 0xFFFFFFFF is assumed.
2289
2290       --set-mark value[/mask]
2291              Zeroes  out the bits given by mask and ORs value into the packet
2292              mark. If mask is omitted, 0xFFFFFFFF is assumed.
2293
2294       The following mnemonics are available:
2295
2296       --and-mark bits
2297              Binary AND the  nfmark  with  bits.  (Mnemonic  for  --set-xmark
2298              0/invbits, where invbits is the binary negation of bits.)
2299
2300       --or-mark bits
2301              Binary  OR  the  nfmark  with  bits.  (Mnemonic  for --set-xmark
2302              bits/bits.)
2303
2304       --xor-mark bits
2305              Binary XOR the  nfmark  with  bits.  (Mnemonic  for  --set-xmark
2306              bits/0.)
2307
2308   MASQUERADE
2309       This  target  is only valid in the nat table, in the POSTROUTING chain.
2310       It should only be used with dynamically assigned  IP  (dialup)  connec‐
2311       tions: if you have a static IP address, you should use the SNAT target.
2312       Masquerading is equivalent to specifying a mapping to the IP address of
2313       the  interface  the  packet  is going out, but also has the effect that
2314       connections are forgotten when the interface goes down.   This  is  the
2315       correct  behavior  when  the  next  dialup is unlikely to have the same
2316       interface address (and hence any established connections are lost  any‐
2317       way).
2318
2319       --to-ports port[-port]
2320              This  specifies  a  range of source ports to use, overriding the
2321              default SNAT source port-selection heuristics (see above).  This
2322              is  only  valid  if the rule also specifies one of the following
2323              protocols: tcp, udp, dccp or sctp.
2324
2325       --random
2326              Randomize source port mapping If option --random  is  used  then
2327              port mapping will be randomized (kernel >= 2.6.21).
2328
2329       IPv6 support available since Linux kernels >= 3.7.
2330
2331   MIRROR (IPv4-specific)
2332       This  is  an experimental demonstration target which inverts the source
2333       and destination fields in the IP header and retransmits the packet.  It
2334       is  only  valid  in the INPUT, FORWARD and PREROUTING chains, and user-
2335       defined chains which are only called from those chains.  Note that  the
2336       outgoing  packets  are NOT seen by any packet filtering chains, connec‐
2337       tion tracking or NAT, to avoid loops and other problems.
2338
2339   NETMAP
2340       This target allows you to statically map a whole network  of  addresses
2341       onto  another  network of addresses.  It can only be used from rules in
2342       the nat table.
2343
2344       --to address[/mask]
2345              Network address to map to.  The resulting address will  be  con‐
2346              structed  in  the  following way: All 'one' bits in the mask are
2347              filled in from the new `address'.  All bits that are zero in the
2348              mask are filled in from the original address.
2349
2350       IPv6 support available since Linux kernels >= 3.7.
2351
2352   NFLOG
2353       This  target  provides logging of matching packets. When this target is
2354       set for a rule, the Linux kernel will pass the  packet  to  the  loaded
2355       logging  backend to log the packet. This is usually used in combination
2356       with nfnetlink_log as logging backend, which will multicast the  packet
2357       through  a netlink socket to the specified multicast group. One or more
2358       userspace processes may subscribe to the group to receive the  packets.
2359       Like LOG, this is a non-terminating target, i.e. rule traversal contin‐
2360       ues at the next rule.
2361
2362       --nflog-group nlgroup
2363              The netlink group (0 - 2^16-1) to which packets are (only appli‐
2364              cable for nfnetlink_log). The default value is 0.
2365
2366       --nflog-prefix prefix
2367              A  prefix string to include in the log message, up to 64 charac‐
2368              ters long, useful for distinguishing messages in the logs.
2369
2370       --nflog-range size
2371              The number of bytes to be copied to userspace  (only  applicable
2372              for  nfnetlink_log).  nfnetlink_log  instances may specify their
2373              own range, this option overrides it.
2374
2375       --nflog-threshold size
2376              Number of packets to queue inside the kernel before sending them
2377              to  userspace (only applicable for nfnetlink_log). Higher values
2378              result in less overhead per packet, but increase delay until the
2379              packets reach userspace. The default value is 1.
2380
2381   NFQUEUE
2382       This  target  passes  the packet to userspace using the nfnetlink_queue
2383       handler.  The packet is put into the queue  identified  by  its  16-bit
2384       queue  number.  Userspace can inspect and modify the packet if desired.
2385       Userspace must then drop  or  reinject  the  packet  into  the  kernel.
2386       Please  see  libnetfilter_queue for details.  nfnetlink_queue was added
2387       in Linux 2.6.14. The queue-balance option was added  in  Linux  2.6.31,
2388       queue-bypass in 2.6.39.
2389
2390       --queue-num value
2391              This  specifies the QUEUE number to use. Valid queue numbers are
2392              0 to 65535. The default value is 0.
2393
2394       --queue-balance value:value
2395              This specifies a range of queues to use. Packets are  then  bal‐
2396              anced  across  the  given  queues.  This is useful for multicore
2397              systems: start multiple instances of the  userspace  program  on
2398              queues  x, x+1, .. x+n and use "--queue-balance x:x+n".  Packets
2399              belonging to the same connection are put into the same nfqueue.
2400
2401       --queue-bypass
2402              By default, if no userspace program is listening on an  NFQUEUE,
2403              then  all  packets that are to be queued are dropped.  When this
2404              option is used, the NFQUEUE rule behaves  like  ACCEPT  instead,
2405              and the packet will move on to the next table.
2406
2407       --queue-cpu-fanout
2408              Available  starting  Linux  kernel 3.10. When used together with
2409              --queue-balance this will use the CPU ID  as  an  index  to  map
2410              packets  to the queues. The idea is that you can improve perfor‐
2411              mance if there's a queue per CPU. This requires  --queue-balance
2412              to be specified.
2413
2414   NOTRACK
2415       This  extension  disables  connection tracking for all packets matching
2416       that rule.  It is equivalent with -j CT --notrack. Like CT, NOTRACK can
2417       only be used in the raw table.
2418
2419   RATEEST
2420       The RATEEST target collects statistics, performs rate estimation calcu‐
2421       lation and saves the results for later  evaluation  using  the  rateest
2422       match.
2423
2424       --rateest-name name
2425              Count  matched  packets into the pool referred to by name, which
2426              is freely choosable.
2427
2428       --rateest-interval amount{s|ms|us}
2429              Rate measurement interval, in seconds, milliseconds or microsec‐
2430              onds.
2431
2432       --rateest-ewmalog value
2433              Rate measurement averaging time constant.
2434
2435   REDIRECT
2436       This  target is only valid in the nat table, in the PREROUTING and OUT‐
2437       PUT chains, and user-defined chains which are only  called  from  those
2438       chains.   It redirects the packet to the machine itself by changing the
2439       destination IP  to  the  primary  address  of  the  incoming  interface
2440       (locally-generated   packets  are  mapped  to  the  localhost  address,
2441       127.0.0.1 for IPv4 and ::1 for IPv6).
2442
2443       --to-ports port[-port]
2444              This specifies a destination port or  range  of  ports  to  use:
2445              without  this,  the  destination port is never altered.  This is
2446              only valid if the rule also specifies one of the following  pro‐
2447              tocols: tcp, udp, dccp or sctp.
2448
2449       --random
2450              If  option --random is used then port mapping will be randomized
2451              (kernel >= 2.6.22).
2452
2453       IPv6 support available starting Linux kernels >= 3.7.
2454
2455   REJECT (IPv6-specific)
2456       This is used to send back an error packet in response  to  the  matched
2457       packet:  otherwise it is equivalent to DROP so it is a terminating TAR‐
2458       GET, ending rule traversal.  This target is only valid  in  the  INPUT,
2459       FORWARD  and  OUTPUT  chains,  and  user-defined  chains which are only
2460       called from those chains.  The following option controls the nature  of
2461       the error packet returned:
2462
2463       --reject-with type
2464              The  type  given can be icmp6-no-route, no-route, icmp6-adm-pro‐
2465              hibited, adm-prohibited,  icmp6-addr-unreachable,  addr-unreach,
2466              or  icmp6-port-unreachable,  which return the appropriate ICMPv6
2467              error message (icmp6-port-unreachable is the default).  Finally,
2468              the  option  tcp-reset can be used on rules which only match the
2469              TCP protocol: this causes a TCP RST  packet  to  be  sent  back.
2470              This  is mainly useful for blocking ident (113/tcp) probes which
2471              frequently occur when sending mail to broken mail  hosts  (which
2472              won't  accept  your mail otherwise).  tcp-reset can only be used
2473              with kernel versions 2.6.14 or later.
2474
2475   REJECT (IPv4-specific)
2476       This is used to send back an error packet in response  to  the  matched
2477       packet:  otherwise it is equivalent to DROP so it is a terminating TAR‐
2478       GET, ending rule traversal.  This target is only valid  in  the  INPUT,
2479       FORWARD  and  OUTPUT  chains,  and  user-defined  chains which are only
2480       called from those chains.  The following option controls the nature  of
2481       the error packet returned:
2482
2483       --reject-with type
2484              The  type  given can be icmp-net-unreachable, icmp-host-unreach‐
2485              able,       icmp-port-unreachable,       icmp-proto-unreachable,
2486              icmp-net-prohibited, icmp-host-prohibited, or icmp-admin-prohib‐
2487              ited (*),  which  return  the  appropriate  ICMP  error  message
2488              (icmp-port-unreachable  is  the  default).  The option tcp-reset
2489              can be used on rules which only match  the  TCP  protocol:  this
2490              causes  a TCP RST packet to be sent back.  This is mainly useful
2491              for blocking ident (113/tcp) probes which frequently occur  when
2492              sending  mail to broken mail hosts (which won't accept your mail
2493              otherwise).
2494
2495       (*) Using icmp-admin-prohibited with kernels that  do  not  support  it
2496       will result in a plain DROP instead of REJECT
2497
2498   SAME (IPv4-specific)
2499       Similar  to SNAT/DNAT depending on chain: it takes a range of addresses
2500       (`--to 1.2.3.4-1.2.3.7') and gives a client the  same  source-/destina‐
2501       tion-address for each connection.
2502
2503       N.B.: The DNAT target's --persistent option replaced the SAME target.
2504
2505       --to ipaddr[-ipaddr]
2506              Addresses  to map source to. May be specified more than once for
2507              multiple ranges.
2508
2509       --nodst
2510              Don't use the destination-ip in the calculations when  selecting
2511              the new source-ip
2512
2513       --random
2514              Port  mapping will be forcibly randomized to avoid attacks based
2515              on port prediction (kernel >= 2.6.21).
2516
2517   SECMARK
2518       This is used to set the security mark value associated with the  packet
2519       for  use  by  security  subsystems such as SELinux.  It is valid in the
2520       security table (for backwards compatibility with older kernels,  it  is
2521       also valid in the mangle table). The mark is 32 bits wide.
2522
2523       --selctx security_context
2524
2525   SET
2526       This  module  adds  and/or  deletes  entries  from IP sets which can be
2527       defined by ipset(8).
2528
2529       --add-set setname flag[,flag...]
2530              add the address(es)/port(s) of the packet to the set
2531
2532       --del-set setname flag[,flag...]
2533              delete the address(es)/port(s) of the packet from the set
2534
2535              where flag(s) are src and/or dst specifications and there can be
2536              no more than six of them.
2537
2538       --timeout value
2539              when  adding  an  entry, the timeout value to use instead of the
2540              default one from the set definition
2541
2542       --exist
2543              when adding an entry if it already  exists,  reset  the  timeout
2544              value  to the specified one or to the default from the set defi‐
2545              nition
2546
2547       Use of -j SET requires that ipset kernel support  is  provided,  which,
2548       for standard kernels, is the case since Linux 2.6.39.
2549
2550   SNAT
2551       This  target  is  only  valid  in the nat table, in the POSTROUTING and
2552       INPUT chains, and user-defined chains which are only called from  those
2553       chains.   It  specifies that the source address of the packet should be
2554       modified (and all future packets in this connection will also  be  man‐
2555       gled),  and  rules should cease being examined.  It takes the following
2556       options:
2557
2558       --to-source [ipaddr[-ipaddr]][:port[-port]]
2559              which can specify a single new source IP address,  an  inclusive
2560              range of IP addresses. Optionally a port range, if the rule also
2561              specifies one of the following  protocols:  tcp,  udp,  dccp  or
2562              sctp.   If  no  port range is specified, then source ports below
2563              512 will be mapped to other ports below 512: those  between  512
2564              and 1023 inclusive will be mapped to ports below 1024, and other
2565              ports will be mapped to 1024 or above. Where possible,  no  port
2566              alteration  will  occur.   In  Kernels up to 2.6.10, you can add
2567              several --to-source options. For those kernels, if  you  specify
2568              more  than  one  source  address, either via an address range or
2569              multiple --to-source options, a simple  round-robin  (one  after
2570              another  in  cycle)  takes place between these addresses.  Later
2571              Kernels (>= 2.6.11-rc1) don't have the ability to NAT to  multi‐
2572              ple ranges anymore.
2573
2574       --random
2575              If  option --random is used then port mapping will be randomized
2576              (kernel >= 2.6.21).
2577
2578       --persistent
2579              Gives a client the  same  source-/destination-address  for  each
2580              connection.   This  supersedes the SAME target. Support for per‐
2581              sistent mappings is available from 2.6.29-rc2.
2582
2583       Kernels prior to 2.6.36-rc1 don't have the ability to SNAT in the INPUT
2584       chain.
2585
2586       IPv6 support available since Linux kernels >= 3.7.
2587
2588   SNPT (IPv6-specific)
2589       Provides  stateless  source IPv6-to-IPv6 Network Prefix Translation (as
2590       described by RFC 6296).
2591
2592       You have to use this target in the mangle table, not in the nat  table.
2593       It takes the following options:
2594
2595       --src-pfx [prefix/length]
2596              Set source prefix that you want to translate and length
2597
2598       --dst-pfx [prefix/length]
2599              Set  destination  prefix that you want to use in the translation
2600              and length
2601
2602       You have to use the DNPT target to undo the translation. Example:
2603
2604              ip6tables -t mangle -I POSTROUTING -s fd00::/64  -o vboxnet0  -j
2605              SNPT --src-pfx fd00::/64 --dst-pfx 2001:e20:2000:40f::/64
2606
2607              ip6tables    -t    mangle    -I    PREROUTING    -i   wlan0   -d
2608              2001:e20:2000:40f::/64 -j DNPT --src-pfx  2001:e20:2000:40f::/64
2609              --dst-pfx fd00::/64
2610
2611       You may need to enable IPv6 neighbor proxy:
2612
2613              sysctl -w net.ipv6.conf.all.proxy_ndp=1
2614
2615       You  also have to use the NOTRACK target to disable connection tracking
2616       for translated flows.
2617
2618   TCPMSS
2619       This target allows to alter the MSS value of TCP SYN packets,  to  con‐
2620       trol  the maximum size for that connection (usually limiting it to your
2621       outgoing interface's MTU minus 40 for IPv4  or  60  for  IPv6,  respec‐
2622       tively).  Of course, it can only be used in conjunction with -p tcp.
2623
2624       This  target  is  used to overcome criminally braindead ISPs or servers
2625       which block "ICMP Fragmentation Needed"  or  "ICMPv6  Packet  Too  Big"
2626       packets.   The  symptoms of this problem are that everything works fine
2627       from your Linux firewall/router,  but  machines  behind  it  can  never
2628       exchange large packets:
2629
2630       1.  Web browsers connect, then hang with no data received.
2631
2632       2.  Small mail works fine, but large emails hang.
2633
2634       3.  ssh works fine, but scp hangs after initial handshaking.
2635
2636       Workaround:  activate  this option and add a rule to your firewall con‐
2637       figuration like:
2638
2639               iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN
2640                           -j TCPMSS --clamp-mss-to-pmtu
2641
2642       --set-mss value
2643              Explicitly sets MSS option to specified value. If the MSS of the
2644              packet  is  already  lower  than value, it will not be increased
2645              (from Linux 2.6.25 onwards) to avoid more  problems  with  hosts
2646              relying on a proper MSS.
2647
2648       --clamp-mss-to-pmtu
2649              Automatically  clamp  MSS  value to (path_MTU - 40 for IPv4; -60
2650              for IPv6).  This may not function as  desired  where  asymmetric
2651              routes  with differing path MTU exist — the kernel uses the path
2652              MTU which it would use to send packets from itself to the source
2653              and  destination  IP  addresses. Prior to Linux 2.6.25, only the
2654              path MTU to the destination IP address was  considered  by  this
2655              option;  subsequent  kernels  also  consider the path MTU to the
2656              source IP address.
2657
2658       These options are mutually exclusive.
2659
2660   TCPOPTSTRIP
2661       This target will strip TCP options off a TCP packet. (It will  actually
2662       replace  them  by  NO-OPs.)  As  such,  you will need to add the -p tcp
2663       parameters.
2664
2665       --strip-options option[,option...]
2666              Strip the given option(s). The options may be specified  by  TCP
2667              option  number  or  by  symbolic  name.  The  list of recognized
2668              options can be obtained by calling iptables with -j  TCPOPTSTRIP
2669              -h.
2670
2671   TEE
2672       The  TEE  target will clone a packet and redirect this clone to another
2673       machine on the local network segment. In other words, the nexthop  must
2674       be  the target, or you will have to configure the nexthop to forward it
2675       further if so desired.
2676
2677       --gateway ipaddr
2678              Send the cloned packet to the host reachable  at  the  given  IP
2679              address.   Use  of  0.0.0.0  (for  IPv4 packets) or :: (IPv6) is
2680              invalid.
2681
2682       To forward all incoming traffic on eth0 to  an  Network  Layer  logging
2683       box:
2684
2685       -t mangle -A PREROUTING -i eth0 -j TEE --gateway 2001:db8::1
2686
2687   TOS
2688       This  module sets the Type of Service field in the IPv4 header (includ‐
2689       ing the "precedence" bits) or the Priority field in  the  IPv6  header.
2690       Note  that  TOS shares the same bits as DSCP and ECN. The TOS target is
2691       only valid in the mangle table.
2692
2693       --set-tos value[/mask]
2694              Zeroes out the bits given by mask  (see  NOTE  below)  and  XORs
2695              value  into  the TOS/Priority field. If mask is omitted, 0xFF is
2696              assumed.
2697
2698       --set-tos symbol
2699              You can specify a symbolic name when using the  TOS  target  for
2700              IPv4.  It  implies  a mask of 0xFF (see NOTE below). The list of
2701              recognized TOS names can be obtained by calling iptables with -j
2702              TOS -h.
2703
2704       The following mnemonics are available:
2705
2706       --and-tos bits
2707              Binary  AND  the  TOS  value  with bits. (Mnemonic for --set-tos
2708              0/invbits, where invbits is the binary negation  of  bits.   See
2709              NOTE below.)
2710
2711       --or-tos bits
2712              Binary  OR  the  TOS  value  with  bits. (Mnemonic for --set-tos
2713              bits/bits. See NOTE below.)
2714
2715       --xor-tos bits
2716              Binary XOR the TOS value  with  bits.  (Mnemonic  for  --set-tos
2717              bits/0. See NOTE below.)
2718
2719       NOTE:  In  Linux kernels up to and including 2.6.38, with the exception
2720       of  longterm  releases  2.6.32  (>=.42),  2.6.33  (>=.15),  and  2.6.35
2721       (>=.14),  there  is  a bug whereby IPv6 TOS mangling does not behave as
2722       documented and differs from the IPv4 version. The  TOS  mask  indicates
2723       the  bits  one  wants  to  zero  out, so it needs to be inverted before
2724       applying it to the original TOS field. However, the aformentioned  ker‐
2725       nels forgo the inversion which breaks --set-tos and its mnemonics.
2726
2727   TPROXY
2728       This  target is only valid in the mangle table, in the PREROUTING chain
2729       and user-defined chains which are only called from this chain. It redi‐
2730       rects  the  packet to a local socket without changing the packet header
2731       in any way. It can also change the mark value which can then be used in
2732       advanced routing rules.  It takes three options:
2733
2734       --on-port port
2735              This  specifies  a  destination  port  to  use. It is a required
2736              option, 0 means the new destination port  is  the  same  as  the
2737              original.  This  is only valid if the rule also specifies -p tcp
2738              or -p udp.
2739
2740       --on-ip address
2741              This specifies a destination address  to  use.  By  default  the
2742              address  is  the  IP  address of the incoming interface. This is
2743              only valid if the rule also specifies -p tcp or -p udp.
2744
2745       --tproxy-mark value[/mask]
2746              Marks packets with the given value/mask. The  fwmark  value  set
2747              here  can be used by advanced routing. (Required for transparent
2748              proxying to work: otherwise these packets  will  get  forwarded,
2749              which is probably not what you want.)
2750
2751   TRACE
2752       This  target marks packets so that the kernel will log every rule which
2753       match the packets as those traverse the tables, chains, rules.
2754
2755       A logging backend, such as nf_log_ipv4(6)  or  nfnetlink_log,  must  be
2756       loaded  for this to be visible.  The packets are logged with the string
2757       prefix: "TRACE: tablename:chainname:type:rulenum " where  type  can  be
2758       "rule"  for plain rule, "return" for implicit rule at the end of a user
2759       defined chain and "policy" for the policy of the built in chains.
2760       It can only be used in the raw table.
2761
2762   TTL (IPv4-specific)
2763       This is used to modify the IPv4 TTL header field.  The TTL field deter‐
2764       mines  how many hops (routers) a packet can traverse until it's time to
2765       live is exceeded.
2766
2767       Setting or incrementing the TTL field can potentially be  very  danger‐
2768       ous,  so it should be avoided at any cost. This target is only valid in
2769       mangle table.
2770
2771       Don't ever set or increment the value on packets that leave your  local
2772       network!
2773
2774       --ttl-set value
2775              Set the TTL value to `value'.
2776
2777       --ttl-dec value
2778              Decrement the TTL value `value' times.
2779
2780       --ttl-inc value
2781              Increment the TTL value `value' times.
2782
2783   ULOG (IPv4-specific)
2784       This  is  the deprecated ipv4-only predecessor of the NFLOG target.  It
2785       provides userspace logging of matching packets.  When  this  target  is
2786       set  for  a rule, the Linux kernel will multicast this packet through a
2787       netlink socket. One or more userspace processes may then  subscribe  to
2788       various  multicast groups and receive the packets.  Like LOG, this is a
2789       "non-terminating target", i.e. rule traversal  continues  at  the  next
2790       rule.
2791
2792       --ulog-nlgroup nlgroup
2793              This  specifies  the netlink group (1-32) to which the packet is
2794              sent.  Default value is 1.
2795
2796       --ulog-prefix prefix
2797              Prefix log messages with the specified prefix; up to 32  charac‐
2798              ters long, and useful for distinguishing messages in the logs.
2799
2800       --ulog-cprange size
2801              Number  of bytes to be copied to userspace.  A value of 0 always
2802              copies the entire packet, regardless of its size.  Default is 0.
2803
2804       --ulog-qthreshold size
2805              Number of packet to queue inside kernel.  Setting this value to,
2806              e.g.  10 accumulates ten packets inside the kernel and transmits
2807              them as one netlink multipart message to userspace.  Default  is
2808              1 (for backwards compatibility).
2809
2810
2811
2812iptables 1.4.21                                         iptables-extensions(8)
Impressum