Jan Engelhardt | 352ccfb | 2009-08-20 17:15:22 +0200 | [diff] [blame] | 1 | .TH IP6TABLES 8 "" "iptables 1.4.4" "iptables 1.4.4" |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 2 | .\" |
| 3 | .\" Man page written by Andras Kis-Szabo <kisza@sch.bme.hu> |
| 4 | .\" It is based on iptables man page. |
| 5 | .\" |
| 6 | .\" iptables page by Herve Eychenne <rv@wallfire.org> |
| 7 | .\" It is based on ipchains man page. |
| 8 | .\" |
| 9 | .\" ipchains page by Paul ``Rusty'' Russell March 1997 |
| 10 | .\" Based on the original ipfwadm man page by Jos Vos <jos@xos.nl> |
| 11 | .\" |
| 12 | .\" This program is free software; you can redistribute it and/or modify |
| 13 | .\" it under the terms of the GNU General Public License as published by |
| 14 | .\" the Free Software Foundation; either version 2 of the License, or |
| 15 | .\" (at your option) any later version. |
| 16 | .\" |
| 17 | .\" This program is distributed in the hope that it will be useful, |
| 18 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | .\" GNU General Public License for more details. |
| 21 | .\" |
| 22 | .\" You should have received a copy of the GNU General Public License |
| 23 | .\" along with this program; if not, write to the Free Software |
| 24 | .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 25 | .\" |
| 26 | .\" |
| 27 | .SH NAME |
Jan Engelhardt | 352ccfb | 2009-08-20 17:15:22 +0200 | [diff] [blame] | 28 | ip6tables \(em IPv6 packet filter administration |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 29 | .SH SYNOPSIS |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 30 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] {\fB\-A\fP|\fB\-D\fP} \fIchain |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 31 | rule-specification\fP [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 32 | .PP |
Jan Engelhardt | 1791a45 | 2009-02-20 16:39:54 +0100 | [diff] [blame] | 33 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-I\fP \fIchain\fP [\fIrulenum\fP] |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 34 | \fIrule-specification\fP [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 35 | .PP |
Jan Engelhardt | 1791a45 | 2009-02-20 16:39:54 +0100 | [diff] [blame] | 36 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-R\fP \fIchain rulenum |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 37 | rule-specification\fP [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 38 | .PP |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 39 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-D\fP \fIchain rulenum\fP |
| 40 | [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 41 | .PP |
Jan Engelhardt | 1791a45 | 2009-02-20 16:39:54 +0100 | [diff] [blame] | 42 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-S\fP [\fIchain\fP [\fIrulenum\fP]] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 43 | .PP |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 44 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] {\fB\-F\fP|\fB\-L\fP|\fB\-Z\fP} |
Jan Engelhardt | fe086ba | 2009-08-19 22:36:03 +0200 | [diff] [blame] | 45 | [\fIchain\fP [\fIrulenum\fP]] [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 46 | .PP |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 47 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-N\fP \fIchain\fP |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 48 | .PP |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 49 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-X\fP [\fIchain\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 50 | .PP |
Jan Engelhardt | fea74bf | 2009-01-12 04:53:18 +0100 | [diff] [blame] | 51 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-P\fP \fIchain target\fP |
| 52 | [\fIoptions...\fP] |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 53 | .PP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 54 | \fBip6tables\fP [\fB\-t\fP \fItable\fP] \fB\-E\fP \fIold-chain-name new-chain-name\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 55 | .SH DESCRIPTION |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 56 | \fBIp6tables\fP is used to set up, maintain, and inspect the |
| 57 | tables of IPv6 packet |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 58 | filter rules in the Linux kernel. Several different tables |
| 59 | may be defined. Each table contains a number of built-in |
| 60 | chains and may also contain user-defined chains. |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 61 | .PP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 62 | Each chain is a list of rules which can match a set of packets. Each |
| 63 | rule specifies what to do with a packet that matches. This is called |
| 64 | a `target', which may be a jump to a user-defined chain in the same |
| 65 | table. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 66 | .SH TARGETS |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 67 | A firewall rule specifies criteria for a packet and a target. If the |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 68 | packet does not match, the next rule in the chain is the examined; if |
| 69 | it does match, then the next rule is specified by the value of the |
| 70 | target, which can be the name of a user-defined chain or one of the |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 71 | special values \fBACCEPT\fP, \fBDROP\fP, \fBQUEUE\fP or \fBRETURN\fP. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 72 | .PP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 73 | \fBACCEPT\fP means to let the packet through. |
| 74 | \fBDROP\fP means to drop the packet on the floor. |
| 75 | \fBQUEUE\fP means to pass the packet to userspace. |
| 76 | (How the packet can be received |
Harald Welte | 7bdfca4 | 2005-07-28 15:24:02 +0000 | [diff] [blame] | 77 | by a userspace process differs by the particular queue handler. 2.4.x |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 78 | and 2.6.x kernels up to 2.6.13 include the \fBip_queue\fP |
| 79 | queue handler. Kernels 2.6.14 and later additionally include the |
| 80 | \fBnfnetlink_queue\fP queue handler. Packets with a target of QUEUE will be |
| 81 | sent to queue number '0' in this case. Please also see the \fBNFQUEUE\fP |
Harald Welte | 7bdfca4 | 2005-07-28 15:24:02 +0000 | [diff] [blame] | 82 | target as described later in this man page.) |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 83 | \fBRETURN\fP means stop traversing this chain and resume at the next |
| 84 | rule in the |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 85 | previous (calling) chain. If the end of a built-in chain is reached |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 86 | or a rule in a built-in chain with target \fBRETURN\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 87 | is matched, the target specified by the chain policy determines the |
| 88 | fate of the packet. |
| 89 | .SH TABLES |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 90 | There are currently three independent tables (which tables are present |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 91 | at any time depends on the kernel configuration options and which |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 92 | modules are present). |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 93 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 94 | \fB\-t\fP, \fB\-\-table\fP \fItable\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 95 | This option specifies the packet matching table which the command |
| 96 | should operate on. If the kernel is configured with automatic module |
| 97 | loading, an attempt will be made to load the appropriate module for |
| 98 | that table if it is not already there. |
| 99 | |
| 100 | The tables are as follows: |
| 101 | .RS |
| 102 | .TP .4i |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 103 | \fBfilter\fP: |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 104 | This is the default table (if no \-t option is passed). It contains |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 105 | the built-in chains \fBINPUT\fP (for packets destined to local sockets), |
| 106 | \fBFORWARD\fP (for packets being routed through the box), and |
| 107 | \fBOUTPUT\fP (for locally-generated packets). |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 108 | .TP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 109 | \fBmangle\fP: |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 110 | This table is used for specialized packet alteration. Until kernel |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 111 | 2.4.17 it had two built-in chains: \fBPREROUTING\fP |
| 112 | (for altering incoming packets before routing) and \fBOUTPUT\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 113 | (for altering locally-generated packets before routing). |
| 114 | Since kernel 2.4.18, three other built-in chains are also supported: |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 115 | \fBINPUT\fP (for packets coming into the box itself), \fBFORWARD\fP |
| 116 | (for altering packets being routed through the box), and \fBPOSTROUTING\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 117 | (for altering packets as they are about to go out). |
Yasuyuki KOZAKAI | 28e5b79 | 2006-01-30 08:50:09 +0000 | [diff] [blame] | 118 | .TP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 119 | \fBraw\fP: |
Yasuyuki KOZAKAI | 28e5b79 | 2006-01-30 08:50:09 +0000 | [diff] [blame] | 120 | This table is used mainly for configuring exemptions from connection |
| 121 | tracking in combination with the NOTRACK target. It registers at the netfilter |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 122 | hooks with higher priority and is thus called before ip_conntrack, or any other |
| 123 | IP tables. It provides the following built-in chains: \fBPREROUTING\fP |
| 124 | (for packets arriving via any network interface) \fBOUTPUT\fP |
Yasuyuki KOZAKAI | 28e5b79 | 2006-01-30 08:50:09 +0000 | [diff] [blame] | 125 | (for packets generated by local processes) |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 126 | .RE |
| 127 | .SH OPTIONS |
| 128 | The options that are recognized by |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 129 | \fBip6tables\fP can be divided into several different groups. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 130 | .SS COMMANDS |
| 131 | These options specify the specific action to perform. Only one of them |
| 132 | can be specified on the command line unless otherwise specified |
| 133 | below. For all the long versions of the command and option names, you |
| 134 | need to use only enough letters to ensure that |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 135 | \fBip6tables\fP can differentiate it from all other options. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 136 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 137 | \fB\-A\fP, \fB\-\-append\fP \fIchain rule-specification\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 138 | Append one or more rules to the end of the selected chain. |
| 139 | When the source and/or destination names resolve to more than one |
| 140 | address, a rule will be added for each possible address combination. |
| 141 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 142 | \fB\-D\fP, \fB\-\-delete\fP \fIchain rule-specification\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 143 | .ns |
| 144 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 145 | \fB\-D\fP, \fB\-\-delete\fP \fIchain rulenum\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 146 | Delete one or more rules from the selected chain. There are two |
| 147 | versions of this command: the rule can be specified as a number in the |
| 148 | chain (starting at 1 for the first rule) or a rule to match. |
| 149 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 150 | \fB\-I\fP, \fB\-\-insert\fP \fIchain\fP [\fIrulenum\fP] \fIrule-specification\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 151 | Insert one or more rules in the selected chain as the given rule |
| 152 | number. So, if the rule number is 1, the rule or rules are inserted |
| 153 | at the head of the chain. This is also the default if no rule number |
| 154 | is specified. |
| 155 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 156 | \fB\-R\fP, \fB\-\-replace\fP \fIchain rulenum rule-specification\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 157 | Replace a rule in the selected chain. If the source and/or |
| 158 | destination names resolve to multiple addresses, the command will |
| 159 | fail. Rules are numbered starting at 1. |
| 160 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 161 | \fB\-L\fP, \fB\-\-list\fP [\fIchain\fP] |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 162 | List all rules in the selected chain. If no chain is selected, all |
Jan Engelhardt | d9842a6 | 2008-07-30 12:49:47 +0200 | [diff] [blame] | 163 | chains are listed. Like every other ip6tables command, it applies to the |
Jan Engelhardt | 9c6ff6b | 2008-09-08 15:42:41 +0200 | [diff] [blame] | 164 | specified table (filter is the default). |
| 165 | .IP "" |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 166 | Please note that it is often used with the \fB\-n\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 167 | option, in order to avoid long reverse DNS lookups. |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 168 | It is legal to specify the \fB\-Z\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 169 | (zero) option as well, in which case the chain(s) will be atomically |
| 170 | listed and zeroed. The exact output is affected by the other |
| 171 | arguments given. The exact rules are suppressed until you use |
| 172 | .nf |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 173 | ip6tables \-L \-v |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 174 | .fi |
| 175 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 176 | \fB\-S\fP, \fB\-\-list\-rules\fP [\fIchain\fP] |
Henrik Nordstrom | 96296cf | 2008-05-13 13:08:26 +0200 | [diff] [blame] | 177 | Print all rules in the selected chain. If no chain is selected, all |
Jan Engelhardt | 352ccfb | 2009-08-20 17:15:22 +0200 | [diff] [blame] | 178 | chains are printed like ip6tables-save. Like every other ip6tables command, |
Henrik Nordstrom | 96296cf | 2008-05-13 13:08:26 +0200 | [diff] [blame] | 179 | it applies to the specified table (filter is the default). |
| 180 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 181 | \fB\-F\fP, \fB\-\-flush\fP [\fIchain\fP] |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 182 | Flush the selected chain (all the chains in the table if none is given). |
| 183 | This is equivalent to deleting all the rules one by one. |
| 184 | .TP |
Jan Engelhardt | fe086ba | 2009-08-19 22:36:03 +0200 | [diff] [blame] | 185 | \fB\-Z\fP, \fB\-\-zero\fP [\fIchain\fP [\fIrulenum\fP]] |
| 186 | Zero the packet and byte counters in all chains, or only the given chain, |
| 187 | or only the given rule in a chain. It is legal to |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 188 | specify the |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 189 | \fB\-L\fP, \fB\-\-list\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 190 | (list) option as well, to see the counters immediately before they are |
| 191 | cleared. (See above.) |
| 192 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 193 | \fB\-N\fP, \fB\-\-new\-chain\fP \fIchain\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 194 | Create a new user-defined chain by the given name. There must be no |
| 195 | target of that name already. |
| 196 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 197 | \fB\-X\fP, \fB\-\-delete\-chain\fP [\fIchain\fP] |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 198 | Delete the optional user-defined chain specified. There must be no references |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 199 | to the chain. If there are, you must delete or replace the referring rules |
| 200 | before the chain can be deleted. The chain must be empty, i.e. not contain |
| 201 | any rules. If no argument is given, it will attempt to delete every |
| 202 | non-builtin chain in the table. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 203 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 204 | \fB\-P\fP, \fB\-\-policy\fP \fIchain target\fP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 205 | Set the policy for the chain to the given target. See the section \fBTARGETS\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 206 | for the legal targets. Only built-in (non-user-defined) chains can have |
| 207 | policies, and neither built-in nor user-defined chains can be policy |
| 208 | targets. |
| 209 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 210 | \fB\-E\fP, \fB\-\-rename\-chain\fP \fIold\-chain new\-chain\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 211 | Rename the user specified chain to the user supplied name. This is |
| 212 | cosmetic, and has no effect on the structure of the table. |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 213 | .TP |
| 214 | \fB\-A\fP, \fB\-\-append\fP \fIchain rule-specification\fP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 215 | Append one or more rules to the end of the selected chain. |
| 216 | When the source and/or destination names resolve to more than one |
| 217 | address, a rule will be added for each possible address combination. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 218 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 219 | \fB\-h\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 220 | Help. |
| 221 | Give a (currently very brief) description of the command syntax. |
| 222 | .SS PARAMETERS |
| 223 | The following parameters make up a rule specification (as used in the |
| 224 | add, delete, insert, replace and append commands). |
| 225 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 226 | [\fB!\fP] \fB\-p\fP, \fB\-\-protocol\fP \fIprotocol\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 227 | The protocol of the rule or of the packet to check. |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 228 | The specified protocol can be one of \fBtcp\fP, \fBudp\fP, \fBudplite\fP, |
| 229 | \fBicmpv6\fP, \fBesp\fP, \fBmh\fP or \fBall\fP, |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 230 | or it can be a numeric value, representing one of these protocols or a |
Yasuyuki KOZAKAI | 28e5b79 | 2006-01-30 08:50:09 +0000 | [diff] [blame] | 231 | different one. A protocol name from /etc/protocols is also allowed. |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 232 | But IPv6 extension headers except \fBesp\fP are not allowed. |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 233 | \fBesp\fP and \fBipv6\-nonext\fP |
Yasuyuki KOZAKAI | 28e5b79 | 2006-01-30 08:50:09 +0000 | [diff] [blame] | 234 | can be used with Kernel version 2.6.11 or later. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 235 | A "!" argument before the protocol inverts the |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 236 | test. The number zero is equivalent to \fBall\fP. |
| 237 | Protocol \fBall\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 238 | will match with all protocols and is taken as default when this |
| 239 | option is omitted. |
| 240 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 241 | [\fB!\fP] \fB\-s\fP, \fB\-\-source\fP \fIaddress\fP[\fB/\fP\fImask\fP] |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 242 | Source specification. |
Jan Engelhardt | 1bd2f0a | 2009-11-18 00:00:37 +0100 | [diff] [blame] | 243 | \fIAddress\fP can be either be a hostname, |
| 244 | a network IP address (with \fB/\fP\fImask\fP), or a plain IP address. |
| 245 | Names will be resolved once only, before the rule is submitted to the kernel. |
| 246 | Please note that specifying any name to be resolved with a remote query such as |
| 247 | DNS is a really bad idea. |
| 248 | (Resolving network names is not supported at this time.) |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 249 | The \fImask\fP is a plain number, |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 250 | specifying the number of 1's at the left side of the network mask. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 251 | A "!" argument before the address specification inverts the sense of |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 252 | the address. The flag \fB\-\-src\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 253 | is an alias for this option. |
Michael Granzow | 332e4ac | 2009-04-09 18:24:36 +0100 | [diff] [blame] | 254 | Multiple addresses can be specified, but this will \fBexpand to multiple |
| 255 | rules\fP (when adding with \-A), or will cause multiple rules to be |
| 256 | deleted (with \-D). |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 257 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 258 | [\fB!\fP] \fB\-d\fP, \fB\-\-destination\fP \fIaddress\fP[\fB/\fP\fImask\fP] |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 259 | Destination specification. |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 260 | See the description of the \fB\-s\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 261 | (source) flag for a detailed description of the syntax. The flag |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 262 | \fB\-\-dst\fP is an alias for this option. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 263 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 264 | \fB\-j\fP, \fB\-\-jump\fP \fItarget\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 265 | This specifies the target of the rule; i.e., what to do if the packet |
| 266 | matches it. The target can be a user-defined chain (other than the |
| 267 | one this rule is in), one of the special builtin targets which decide |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 268 | the fate of the packet immediately, or an extension (see \fBEXTENSIONS\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 269 | below). If this |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 270 | option is omitted in a rule (and \fB\-g\fP |
Thomas Jacob | eaf831e | 2008-06-23 11:35:29 +0200 | [diff] [blame] | 271 | is not used), then matching the rule will have no |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 272 | effect on the packet's fate, but the counters on the rule will be |
| 273 | incremented. |
| 274 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 275 | \fB\-g\fP, \fB\-\-goto\fP \fIchain\fP |
Thomas Jacob | eaf831e | 2008-06-23 11:35:29 +0200 | [diff] [blame] | 276 | This specifies that the processing should continue in a user |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 277 | specified chain. Unlike the \-\-jump option return will not continue |
Thomas Jacob | eaf831e | 2008-06-23 11:35:29 +0200 | [diff] [blame] | 278 | processing in this chain but instead in the chain that called us via |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 279 | \-\-jump. |
Thomas Jacob | eaf831e | 2008-06-23 11:35:29 +0200 | [diff] [blame] | 280 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 281 | [\fB!\fP] \fB\-i\fP, \fB\-\-in\-interface\fP \fIname\fP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 282 | Name of an interface via which a packet was received (only for |
| 283 | packets entering the \fBINPUT\fP, \fBFORWARD\fP and \fBPREROUTING\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 284 | chains). When the "!" argument is used before the interface name, the |
| 285 | sense is inverted. If the interface name ends in a "+", then any |
| 286 | interface which begins with this name will match. If this option is |
| 287 | omitted, any interface name will match. |
| 288 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 289 | [\fB!\fP] \fB\-o\fP, \fB\-\-out\-interface\fP \fIname\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 290 | Name of an interface via which a packet is going to be sent (for packets |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 291 | entering the \fBFORWARD\fP, \fBOUTPUT\fP and \fBPOSTROUTING\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 292 | chains). When the "!" argument is used before the interface name, the |
| 293 | sense is inverted. If the interface name ends in a "+", then any |
| 294 | interface which begins with this name will match. If this option is |
| 295 | omitted, any interface name will match. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 296 | .\" Currently not supported (header-based) |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 297 | .\" .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 298 | .\" [\fB!\fP] \fB\-f\fP, \fB\-\-fragment\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 299 | .\" This means that the rule only refers to second and further fragments |
| 300 | .\" of fragmented packets. Since there is no way to tell the source or |
| 301 | .\" destination ports of such a packet (or ICMP type), such a packet will |
| 302 | .\" not match any rules which specify them. When the "!" argument |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 303 | .\" precedes the "\-f" flag, the rule will only match head fragments, or |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 304 | .\" unfragmented packets. |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 305 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 306 | \fB\-c\fP, \fB\-\-set\-counters\fP \fIpackets bytes\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 307 | This enables the administrator to initialize the packet and byte |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 308 | counters of a rule (during \fBINSERT\fP, \fBAPPEND\fP, \fBREPLACE\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 309 | operations). |
| 310 | .SS "OTHER OPTIONS" |
| 311 | The following additional options can be specified: |
| 312 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 313 | \fB\-v\fP, \fB\-\-verbose\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 314 | Verbose output. This option makes the list command show the interface |
| 315 | name, the rule options (if any), and the TOS masks. The packet and |
| 316 | byte counters are also listed, with the suffix 'K', 'M' or 'G' for |
| 317 | 1000, 1,000,000 and 1,000,000,000 multipliers respectively (but see |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 318 | the \fB\-x\fP flag to change this). |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 319 | For appending, insertion, deletion and replacement, this causes |
| 320 | detailed information on the rule or rules to be printed. |
| 321 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 322 | \fB\-n\fP, \fB\-\-numeric\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 323 | Numeric output. |
| 324 | IP addresses and port numbers will be printed in numeric format. |
| 325 | By default, the program will try to display them as host names, |
| 326 | network names, or services (whenever applicable). |
| 327 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 328 | \fB\-x\fP, \fB\-\-exact\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 329 | Expand numbers. |
| 330 | Display the exact value of the packet and byte counters, |
| 331 | instead of only the rounded number in K's (multiples of 1000) |
| 332 | M's (multiples of 1000K) or G's (multiples of 1000M). This option is |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 333 | only relevant for the \fB\-L\fP command. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 334 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 335 | \fB\-\-line\-numbers\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 336 | When listing rules, add line numbers to the beginning of each rule, |
| 337 | corresponding to that rule's position in the chain. |
| 338 | .TP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 339 | \fB\-\-modprobe=\fP\fIcommand\fP |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 340 | When adding or inserting rules into a chain, use \fIcommand\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 341 | to load any necessary modules (targets, match extensions, etc). |
| 342 | .SH MATCH EXTENSIONS |
| 343 | ip6tables can use extended packet matching modules. These are loaded |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 344 | in two ways: implicitly, when \fB\-p\fP or \fB\-\-protocol\fP |
| 345 | is specified, or with the \fB\-m\fP or \fB\-\-match\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 346 | options, followed by the matching module name; after these, various |
| 347 | extra command line options become available, depending on the specific |
| 348 | module. You can specify multiple extended match modules in one line, |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 349 | and you can use the \fB\-h\fP or \fB\-\-help\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 350 | options after the module has been specified to receive help specific |
| 351 | to that module. |
Jan Engelhardt | 0c2b5a4 | 2009-01-08 18:04:40 +0100 | [diff] [blame] | 352 | .PP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 353 | The following are included in the base package, and most of these can |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 354 | be preceded by a "\fB!\fP" to invert the sense of the match. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 355 | .\" @MATCH@ |
| 356 | .SH TARGET EXTENSIONS |
| 357 | ip6tables can use extended target modules: the following are included |
| 358 | in the standard distribution. |
| 359 | .\" @TARGET@ |
| 360 | .SH DIAGNOSTICS |
| 361 | Various error messages are printed to standard error. The exit code |
| 362 | is 0 for correct functioning. Errors which appear to be caused by |
| 363 | invalid or abused command line parameters cause an exit code of 2, and |
| 364 | other errors cause an exit code of 1. |
| 365 | .SH BUGS |
| 366 | Bugs? What's this? ;-) |
| 367 | Well... the counters are not reliable on sparc64. |
| 368 | .SH COMPATIBILITY WITH IPCHAINS |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 369 | This \fBip6tables\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 370 | is very similar to ipchains by Rusty Russell. The main difference is |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 371 | that the chains \fBINPUT\fP and \fBOUTPUT\fP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 372 | are only traversed for packets coming into the local host and |
| 373 | originating from the local host respectively. Hence every packet only |
| 374 | passes through one of the three chains (except loopback traffic, which |
| 375 | involves both INPUT and OUTPUT chains); previously a forwarded packet |
| 376 | would pass through all three. |
| 377 | .PP |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 378 | The other main difference is that \fB\-i\fP refers to the input interface; |
| 379 | \fB\-o\fP refers to the output interface, and both are available for packets |
Jan Engelhardt | 55dffef | 2008-07-03 20:27:50 +0200 | [diff] [blame] | 380 | entering the \fBFORWARD\fP chain. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 381 | There are several other changes in ip6tables. |
| 382 | .SH SEE ALSO |
Jan Engelhardt | 0e8984a | 2009-01-12 07:06:12 +0100 | [diff] [blame] | 383 | \fBip6tables\-save\fP(8), |
| 384 | \fBip6tables\-restore\fP(8), |
| 385 | \fBiptables\fP(8), |
| 386 | \fBiptables\-save\fP(8), |
| 387 | \fBiptables\-restore\fP(8), |
| 388 | \fBlibipq\fP(3). |
| 389 | .PP |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 390 | The packet-filtering-HOWTO details iptables usage for |
Jan Engelhardt | 9c6ff6b | 2008-09-08 15:42:41 +0200 | [diff] [blame] | 391 | packet filtering, |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 392 | the netfilter-extensions-HOWTO details the extensions that are |
| 393 | not in the standard distribution, |
| 394 | and the netfilter-hacking-HOWTO details the netfilter internals. |
| 395 | .br |
| 396 | See |
| 397 | .BR "http://www.netfilter.org/" . |
| 398 | .SH AUTHORS |
| 399 | Rusty Russell wrote iptables, in early consultation with Michael |
| 400 | Neuling. |
| 401 | .PP |
| 402 | Marc Boucher made Rusty abandon ipnatctl by lobbying for a generic packet |
| 403 | selection framework in iptables, then wrote the mangle table, the owner match, |
| 404 | the mark stuff, and ran around doing cool stuff everywhere. |
| 405 | .PP |
| 406 | James Morris wrote the TOS target, and tos match. |
| 407 | .PP |
| 408 | Jozsef Kadlecsik wrote the REJECT target. |
| 409 | .PP |
Jan Engelhardt | 6cf172e | 2008-03-10 17:48:59 +0100 | [diff] [blame] | 410 | Harald Welte wrote the ULOG and NFQUEUE target, the new libiptc, as well as TTL match+target and libipulog. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 411 | .PP |
Patrick McHardy | 110a89a | 2007-01-28 01:24:55 +0000 | [diff] [blame] | 412 | The Netfilter Core Team is: Marc Boucher, Martin Josefsson, Yasuyuki Kozakai, |
Yasuyuki KOZAKAI | e605d76 | 2007-02-15 06:41:58 +0000 | [diff] [blame] | 413 | Jozsef Kadlecsik, Patrick McHardy, James Morris, Pablo Neira Ayuso, |
| 414 | Harald Welte and Rusty Russell. |
Henrik Nordstrom | c279413 | 2004-01-22 15:04:24 +0000 | [diff] [blame] | 415 | .PP |
| 416 | ip6tables man page created by Andras Kis-Szabo, based on |
| 417 | iptables man page written by Herve Eychenne <rv@wallfire.org>. |
| 418 | .\" .. and did I mention that we are incredibly cool people? |
| 419 | .\" .. sexy, too .. |
| 420 | .\" .. witty, charming, powerful .. |
| 421 | .\" .. and most of all, modest .. |