| 1 |
.TH ARPTABLES 8 "March 2019" |
| 2 |
.\" |
| 3 |
.\" Man page originally written by Jochen Friedrich <[email protected]>, |
| 4 |
.\" maintained by Bart De Schuymer. |
| 5 |
.\" It is based on the iptables man page. |
| 6 |
.\" |
| 7 |
.\" Iptables page by Herve Eychenne March 2000. |
| 8 |
.\" |
| 9 |
.\" This program is free software; you can redistribute it and/or modify |
| 10 |
.\" it under the terms of the GNU General Public License as published by |
| 11 |
.\" the Free Software Foundation; either version 2 of the License, or |
| 12 |
.\" (at your option) any later version. |
| 13 |
.\" |
| 14 |
.\" This program is distributed in the hope that it will be useful, |
| 15 |
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
.\" GNU General Public License for more details. |
| 18 |
.\" |
| 19 |
.\" You should have received a copy of the GNU General Public License |
| 20 |
.\" along with this program; if not, write to the Free Software |
| 21 |
.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 |
.\" |
| 23 |
.\" |
| 24 |
.SH NAME |
| 25 |
arptables \(em ARP table administration (nft-based) |
| 26 |
.SH SYNOPSIS |
| 27 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] {\fB\-A|\-D\fP} \fIchain\fP |
| 28 |
\fIrule-specification\fP [options...] |
| 29 |
.PP |
| 30 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-I\fP \fIchain\fP [\fIrulenum\fP] |
| 31 |
\fIrule-specification\fP |
| 32 |
.PP |
| 33 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-R\fP \fIchain rulenum |
| 34 |
rule-specification\fP |
| 35 |
.PP |
| 36 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-D\fP \fIchain rulenum\fP |
| 37 |
.PP |
| 38 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] {\fB\-F\fP|\fB\-L\fP|\fB\-Z\fP} |
| 39 |
[\fIchain\fP [\fIrulenum\fP]] [\fIoptions...\fP] |
| 40 |
.PP |
| 41 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-N\fP \fIchain\fP |
| 42 |
.PP |
| 43 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-X\fP [\fIchain\fP] |
| 44 |
.PP |
| 45 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-P\fP \fIchain policy\fP |
| 46 |
.PP |
| 47 |
\fBarptables\fP [\fB\-t\fP \fItable\fP] \fB\-E\fP \fIold-chain-name |
| 48 |
new-chain-name\fP |
| 49 |
.PP |
| 50 |
rule-specification := [matches...] [target] |
| 51 |
.PP |
| 52 |
match := \fB\-m\fP \fImatchname\fP [per-match-options] |
| 53 |
.PP |
| 54 |
target := \fB\-j\fP \fItargetname\fP [per-target-options] |
| 55 |
.SH DESCRIPTION |
| 56 |
.B arptables |
| 57 |
is a user space tool, it is used to set up and maintain the |
| 58 |
tables of ARP rules in the Linux kernel. These rules inspect |
| 59 |
the ARP frames which they see. |
| 60 |
.B arptables |
| 61 |
is analogous to the |
| 62 |
.B iptables |
| 63 |
user space tool, but |
| 64 |
.B arptables |
| 65 |
is less complicated. |
| 66 |
|
| 67 |
.SS CHAINS |
| 68 |
The kernel table is used to divide functionality into |
| 69 |
different sets of rules. Each set of rules is called a chain. |
| 70 |
Each chain is an ordered list of rules that can match ARP frames. If a |
| 71 |
rule matches an ARP frame, then a processing specification tells |
| 72 |
what to do with that matching frame. The processing specification is |
| 73 |
called a 'target'. However, if the frame does not match the current |
| 74 |
rule in the chain, then the next rule in the chain is examined and so forth. |
| 75 |
The user can create new (user-defined) chains which can be used as the 'target' of a rule. |
| 76 |
|
| 77 |
.SS TARGETS |
| 78 |
A firewall rule specifies criteria for an ARP frame and a frame |
| 79 |
processing specification called a target. When a frame matches a rule, |
| 80 |
then the next action performed by the kernel is specified by the target. |
| 81 |
The target can be one of these values: |
| 82 |
.IR ACCEPT , |
| 83 |
.IR DROP , |
| 84 |
.IR CONTINUE , |
| 85 |
.IR RETURN , |
| 86 |
an 'extension' (see below) or a user-defined chain. |
| 87 |
.PP |
| 88 |
.I ACCEPT |
| 89 |
means to let the frame through. |
| 90 |
.I DROP |
| 91 |
means the frame has to be dropped. |
| 92 |
.I CONTINUE |
| 93 |
means the next rule has to be checked. This can be handy to know how many |
| 94 |
frames pass a certain point in the chain or to log those frames. |
| 95 |
.I RETURN |
| 96 |
means stop traversing this chain and resume at the next rule in the |
| 97 |
previous (calling) chain. |
| 98 |
For the extension targets please see the |
| 99 |
.B "TARGET EXTENSIONS" |
| 100 |
section of this man page. |
| 101 |
.SS TABLES |
| 102 |
There is only one ARP table in the Linux |
| 103 |
kernel. The table is |
| 104 |
.BR filter. |
| 105 |
You can drop the '\-t filter' argument to the arptables command. |
| 106 |
The \-t argument must be the |
| 107 |
first argument on the arptables command line, if used. |
| 108 |
.TP |
| 109 |
.B "\-t, \-\-table" |
| 110 |
.br |
| 111 |
.BR filter , |
| 112 |
is the only table and contains two built-in chains: |
| 113 |
.B INPUT |
| 114 |
(for frames destined for the host) and |
| 115 |
.B OUTPUT |
| 116 |
(for locally-generated frames). |
| 117 |
.br |
| 118 |
.br |
| 119 |
.SH ARPTABLES COMMAND LINE ARGUMENTS |
| 120 |
After the initial arptables command line argument, the remaining |
| 121 |
arguments can be divided into several different groups. These groups |
| 122 |
are commands, miscellaneous commands, rule-specifications, match-extensions, |
| 123 |
and watcher-extensions. |
| 124 |
.SS COMMANDS |
| 125 |
The arptables command arguments specify the actions to perform on the table |
| 126 |
defined with the \-t argument. If you do not use the \-t argument to name |
| 127 |
a table, the commands apply to the default filter table. |
| 128 |
With the exception of the |
| 129 |
.B "\-Z" |
| 130 |
command, only one command may be used on the command line at a time. |
| 131 |
.TP |
| 132 |
.B "\-A, \-\-append" |
| 133 |
Append a rule to the end of the selected chain. |
| 134 |
.TP |
| 135 |
.B "\-D, \-\-delete" |
| 136 |
Delete the specified rule from the selected chain. There are two ways to |
| 137 |
use this command. The first is by specifying an interval of rule numbers |
| 138 |
to delete, syntax: start_nr[:end_nr]. Using negative numbers is allowed, for more |
| 139 |
details about using negative numbers, see the \-I command. The second usage is by |
| 140 |
specifying the complete rule as it would have been specified when it was added. |
| 141 |
.TP |
| 142 |
.B "\-I, \-\-insert" |
| 143 |
Insert the specified rule into the selected chain at the specified rule number. |
| 144 |
If the current number of rules equals N, then the specified number can be |
| 145 |
between \-N and N+1. For a positive number i, it holds that i and i\-N\-1 specify the |
| 146 |
same place in the chain where the rule should be inserted. The number 0 specifies |
| 147 |
the place past the last rule in the chain and using this number is therefore |
| 148 |
equivalent with using the \-A command. |
| 149 |
.TP |
| 150 |
.B "\-R, \-\-replace" |
| 151 |
Replaces the specified rule into the selected chain at the specified rule number. |
| 152 |
If the current number of rules equals N, then the specified number can be |
| 153 |
between 1 and N. i specifies the place in the chain where the rule should be replaced. |
| 154 |
.TP |
| 155 |
.B "\-P, \-\-policy" |
| 156 |
Set the policy for the chain to the given target. The policy can be |
| 157 |
.BR ACCEPT ", " DROP " or " RETURN . |
| 158 |
.TP |
| 159 |
.B "\-F, \-\-flush" |
| 160 |
Flush the selected chain. If no chain is selected, then every chain will be |
| 161 |
flushed. Flushing the chain does not change the policy of the |
| 162 |
chain, however. |
| 163 |
.TP |
| 164 |
.B "\-Z, \-\-zero" |
| 165 |
Set the counters of the selected chain to zero. If no chain is selected, all the counters |
| 166 |
are set to zero. The |
| 167 |
.B "\-Z" |
| 168 |
command can be used in conjunction with the |
| 169 |
.B "\-L" |
| 170 |
command. |
| 171 |
When both the |
| 172 |
.B "\-Z" |
| 173 |
and |
| 174 |
.B "\-L" |
| 175 |
commands are used together in this way, the rule counters are printed on the screen |
| 176 |
before they are set to zero. |
| 177 |
.TP |
| 178 |
.B "\-L, \-\-list" |
| 179 |
List all rules in the selected chain. If no chain is selected, all chains |
| 180 |
are listed. |
| 181 |
.TP |
| 182 |
.B "\-N, \-\-new-chain" |
| 183 |
Create a new user-defined chain with the given name. The number of |
| 184 |
user-defined chains is unlimited. A user-defined chain name has maximum |
| 185 |
length of 31 characters. |
| 186 |
.TP |
| 187 |
.B "\-X, \-\-delete-chain" |
| 188 |
Delete the specified user-defined chain. There must be no remaining references |
| 189 |
to the specified chain, otherwise |
| 190 |
.B arptables |
| 191 |
will refuse to delete it. If no chain is specified, all user-defined |
| 192 |
chains that aren't referenced will be removed. |
| 193 |
.TP |
| 194 |
.B "\-E, \-\-rename\-chain" |
| 195 |
Rename the specified chain to a new name. Besides renaming a user-defined |
| 196 |
chain, you may rename a standard chain name to a name that suits your |
| 197 |
taste. For example, if you like PREBRIDGING more than PREROUTING, |
| 198 |
then you can use the \-E command to rename the PREROUTING chain. If you do |
| 199 |
rename one of the standard |
| 200 |
.B arptables |
| 201 |
chain names, please be sure to mention |
| 202 |
this fact should you post a question on the |
| 203 |
.B arptables |
| 204 |
mailing lists. |
| 205 |
It would be wise to use the standard name in your post. Renaming a standard |
| 206 |
.B arptables |
| 207 |
chain in this fashion has no effect on the structure or function |
| 208 |
of the |
| 209 |
.B arptables |
| 210 |
kernel table. |
| 211 |
|
| 212 |
.SS MISCELLANEOUS COMMANDS |
| 213 |
.TP |
| 214 |
.B "\-V, \-\-version" |
| 215 |
Show the version of the arptables userspace program. |
| 216 |
.TP |
| 217 |
.B "\-h, \-\-help" |
| 218 |
Give a brief description of the command syntax. |
| 219 |
.TP |
| 220 |
.BR "\-j, \-\-jump " "\fItarget\fP" |
| 221 |
The target of the rule. This is one of the following values: |
| 222 |
.BR ACCEPT , |
| 223 |
.BR DROP , |
| 224 |
.BR CONTINUE , |
| 225 |
.BR RETURN , |
| 226 |
a target extension (see |
| 227 |
.BR "TARGET EXTENSIONS" ")" |
| 228 |
or a user-defined chain name. |
| 229 |
.TP |
| 230 |
.BI "\-c, \-\-set-counters " "PKTS BYTES" |
| 231 |
This enables the administrator to initialize the packet and byte |
| 232 |
counters of a rule (during |
| 233 |
.B INSERT, |
| 234 |
.B APPEND, |
| 235 |
.B REPLACE |
| 236 |
operations). |
| 237 |
|
| 238 |
.SS RULE-SPECIFICATIONS |
| 239 |
The following command line arguments make up a rule specification (as used |
| 240 |
in the add and delete commands). A "!" option before the specification |
| 241 |
inverts the test for that specification. Apart from these standard rule |
| 242 |
specifications there are some other command line arguments of interest. |
| 243 |
.TP |
| 244 |
.BR "\-s, \-\-source\-ip " "[!] \fIaddress\fP[/\fImask]\fP" |
| 245 |
The Source IP specification. |
| 246 |
.TP |
| 247 |
.BR "\-d, \-\-destination\-ip " "[!] \fIaddress\fP[/\fImask]\fP" |
| 248 |
The Destination IP specification. |
| 249 |
.TP |
| 250 |
.BR "\-\-source\-mac " "[!] \fIaddress\fP[/\fImask\fP]" |
| 251 |
The source mac address. Both mask and address are written as 6 hexadecimal |
| 252 |
numbers separated by colons. |
| 253 |
.TP |
| 254 |
.BR "\-\-destination\-mac " "[!] \fIaddress\fP[/\fImask\fP]" |
| 255 |
The destination mac address. Both mask and address are written as 6 hexadecimal |
| 256 |
numbers separated by colons. |
| 257 |
.TP |
| 258 |
.BR "\-i, \-\-in\-interface " "[!] \fIname\fP" |
| 259 |
The interface via which a frame is received (for the |
| 260 |
.B INPUT |
| 261 |
chain). The flag |
| 262 |
.B \-\-in\-if |
| 263 |
is an alias for this option. |
| 264 |
.TP |
| 265 |
.BR "\-o, \-\-out-interface " "[!] \fIname\fP" |
| 266 |
The interface via which a frame is going to be sent (for the |
| 267 |
.B OUTPUT |
| 268 |
chain). The flag |
| 269 |
.B \-\-out\-if |
| 270 |
is an alias for this option. |
| 271 |
.TP |
| 272 |
.BR "\-l, \-\-h\-length " "\fIlength\fP[/\fImask\fP]" |
| 273 |
The hardware length (nr of bytes) |
| 274 |
.TP |
| 275 |
.BR "\-\-opcode " "\fIcode\fP[/\fImask\fP] |
| 276 |
The operation code (2 bytes). Available values are: |
| 277 |
.BR 1 = Request |
| 278 |
.BR 2 = Reply |
| 279 |
.BR 3 = Request_Reverse |
| 280 |
.BR 4 = Reply_Reverse |
| 281 |
.BR 5 = DRARP_Request |
| 282 |
.BR 6 = DRARP_Reply |
| 283 |
.BR 7 = DRARP_Error |
| 284 |
.BR 8 = InARP_Request |
| 285 |
.BR 9 = ARP_NAK . |
| 286 |
.TP |
| 287 |
.BR "\-\-h\-type " "\fItype\fP[/\fImask\fP]" |
| 288 |
The hardware type (2 bytes, hexadecimal). Available values are: |
| 289 |
.BR 1 = Ethernet . |
| 290 |
.TP |
| 291 |
.BR "\-\-proto\-type " "\fItype\fP[/\fImask\fP]" |
| 292 |
The protocol type (2 bytes). Available values are: |
| 293 |
.BR 0x800 = IPv4 . |
| 294 |
|
| 295 |
.SS TARGET-EXTENSIONS |
| 296 |
.B arptables |
| 297 |
extensions are precompiled into the userspace tool. So there is no need |
| 298 |
to explicitly load them with a \-m option like in |
| 299 |
.BR iptables . |
| 300 |
However, these |
| 301 |
extensions deal with functionality supported by supplemental kernel modules. |
| 302 |
.SS mangle |
| 303 |
.TP |
| 304 |
.BR "\-\-mangle\-ip\-s IP address" |
| 305 |
Mangles Source IP Address to given value. |
| 306 |
.TP |
| 307 |
.BR "\-\-mangle\-ip\-d IP address" |
| 308 |
Mangles Destination IP Address to given value. |
| 309 |
.TP |
| 310 |
.BR "\-\-mangle\-mac\-s MAC address" |
| 311 |
Mangles Source MAC Address to given value. |
| 312 |
.TP |
| 313 |
.BR "\-\-mangle\-mac\-d MAC address" |
| 314 |
Mangles Destination MAC Address to given value. |
| 315 |
.TP |
| 316 |
.BR "\-\-mangle\-target target " |
| 317 |
Target of ARP mangle operation |
| 318 |
.BR "" ( DROP ", " CONTINUE " or " ACCEPT " \(em default is " ACCEPT ). |
| 319 |
.SS CLASSIFY |
| 320 |
This module allows you to set the skb\->priority value (and thus |
| 321 |
classify the packet into a specific CBQ class). |
| 322 |
|
| 323 |
.TP |
| 324 |
.BR "\-\-set\-class major:minor" |
| 325 |
|
| 326 |
Set the major and minor class value. The values are always |
| 327 |
interpreted as hexadecimal even if no 0x prefix is given. |
| 328 |
|
| 329 |
.SS MARK |
| 330 |
This module allows you to set the skb\->mark value (and thus classify |
| 331 |
the packet by the mark in u32) |
| 332 |
|
| 333 |
.TP |
| 334 |
.BR "\-\-set\-mark mark" |
| 335 |
Set the mark value. The values are always |
| 336 |
interpreted as hexadecimal even if no 0x prefix is given |
| 337 |
|
| 338 |
.TP |
| 339 |
.BR "\-\-and\-mark mark" |
| 340 |
Binary AND the mark with bits. |
| 341 |
|
| 342 |
.TP |
| 343 |
.BR "\-\-or\-mark mark" |
| 344 |
Binary OR the mark with bits. |
| 345 |
|
| 346 |
.SH NOTES |
| 347 |
In this nft-based version of |
| 348 |
.BR arptables , |
| 349 |
support for |
| 350 |
.B FORWARD |
| 351 |
chain has not been implemented. Since ARP packets are "forwarded" only by Linux |
| 352 |
bridges, the same may be achieved using |
| 353 |
.B FORWARD |
| 354 |
chain in |
| 355 |
.BR ebtables . |
| 356 |
|
| 357 |
.SH MAILINGLISTS |
| 358 |
.BR "" "See " http://netfilter.org/mailinglists.html |
| 359 |
.SH SEE ALSO |
| 360 |
.BR xtables\-nft "(8), " iptables "(8), " ebtables "(8), " ip (8) |
| 361 |
.PP |
| 362 |
.BR "" "See " https://wiki.nftables.org |