Blame iptables/arptables-nft.8

Packit Service d1fe03
.TH ARPTABLES 8  "March 2019"
Packit Service d1fe03
.\"
Packit Service d1fe03
.\" Man page originally written by Jochen Friedrich <jochen@scram.de>,
Packit Service d1fe03
.\" maintained by Bart De Schuymer.
Packit Service d1fe03
.\" It is based on the iptables man page.
Packit Service d1fe03
.\"
Packit Service d1fe03
.\" Iptables page by Herve Eychenne March 2000.
Packit Service d1fe03
.\"
Packit Service d1fe03
.\"     This program is free software; you can redistribute it and/or modify
Packit Service d1fe03
.\"     it under the terms of the GNU General Public License as published by
Packit Service d1fe03
.\"     the Free Software Foundation; either version 2 of the License, or
Packit Service d1fe03
.\"     (at your option) any later version.
Packit Service d1fe03
.\"
Packit Service d1fe03
.\"     This program is distributed in the hope that it will be useful,
Packit Service d1fe03
.\"     but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service d1fe03
.\"     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service d1fe03
.\"     GNU General Public License for more details.
Packit Service d1fe03
.\"
Packit Service d1fe03
.\"     You should have received a copy of the GNU General Public License
Packit Service d1fe03
.\"     along with this program; if not, write to the Free Software
Packit Service d1fe03
.\"     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Packit Service d1fe03
.\"
Packit Service d1fe03
.\"
Packit Service d1fe03
.SH NAME
Packit Service d1fe03
arptables \- ARP table administration (nft-based)
Packit Service d1fe03
.SH SYNOPSIS
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -" [ AD ] " chain rule-specification " [ options ]
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -" [ RI ] " chain rulenum rule-specification " [ options ]
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -D chain rulenum " [ options ]
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -" [ "LFZ" ] " " [ chain ] " " [ options ]
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -" [ "NX" ] " chain"
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -E old-chain-name new-chain-name"
Packit Service d1fe03
.br
Packit Service d1fe03
.BR "arptables " [ "-t table" ] " -P chain target " [ options ]
Packit Service d1fe03
Packit Service d1fe03
.SH DESCRIPTION
Packit Service d1fe03
.B arptables
Packit Service d1fe03
is a user space tool, it is used to set up and maintain the
Packit Service d1fe03
tables of ARP rules in the Linux kernel. These rules inspect
Packit Service d1fe03
the ARP frames which they see.
Packit Service d1fe03
.B arptables
Packit Service d1fe03
is analogous to the
Packit Service d1fe03
.B iptables
Packit Service d1fe03
user space tool, but
Packit Service d1fe03
.B arptables
Packit Service d1fe03
is less complicated.
Packit Service d1fe03
Packit Service d1fe03
.SS CHAINS
Packit Service d1fe03
The kernel table is used to divide functionality into
Packit Service d1fe03
different sets of rules. Each set of rules is called a chain.
Packit Service d1fe03
Each chain is an ordered list of rules that can match ARP frames. If a
Packit Service d1fe03
rule matches an ARP frame, then a processing specification tells
Packit Service d1fe03
what to do with that matching frame. The processing specification is
Packit Service d1fe03
called a 'target'. However, if the frame does not match the current
Packit Service d1fe03
rule in the chain, then the next rule in the chain is examined and so forth.
Packit Service d1fe03
The user can create new (user-defined) chains which can be used as the 'target' of a rule.
Packit Service d1fe03
Packit Service d1fe03
.SS TARGETS
Packit Service d1fe03
A firewall rule specifies criteria for an ARP frame and a frame
Packit Service d1fe03
processing specification called a target.  When a frame matches a rule,
Packit Service d1fe03
then the next action performed by the kernel is specified by the target.
Packit Service d1fe03
The target can be one of these values:
Packit Service d1fe03
.IR ACCEPT ,
Packit Service d1fe03
.IR DROP ,
Packit Service d1fe03
.IR CONTINUE ,
Packit Service d1fe03
.IR RETURN ,
Packit Service d1fe03
an 'extension' (see below) or a user-defined chain.
Packit Service d1fe03
.PP
Packit Service d1fe03
.I ACCEPT
Packit Service d1fe03
means to let the frame through.
Packit Service d1fe03
.I DROP
Packit Service d1fe03
means the frame has to be dropped.
Packit Service d1fe03
.I CONTINUE
Packit Service d1fe03
means the next rule has to be checked. This can be handy to know how many
Packit Service d1fe03
frames pass a certain point in the chain or to log those frames.
Packit Service d1fe03
.I RETURN
Packit Service d1fe03
means stop traversing this chain and resume at the next rule in the
Packit Service d1fe03
previous (calling) chain.
Packit Service d1fe03
For the extension targets please see the
Packit Service d1fe03
.B "TARGET EXTENSIONS"
Packit Service d1fe03
section of this man page.
Packit Service d1fe03
.SS TABLES
Packit Service d1fe03
There is only one ARP table in the Linux
Packit Service d1fe03
kernel.  The table is
Packit Service d1fe03
.BR filter.
Packit Service d1fe03
You can drop the '-t filter' argument to the arptables command.
Packit Service d1fe03
The -t argument must be the
Packit Service d1fe03
first argument on the arptables command line, if used.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-t, --table"
Packit Service d1fe03
.br
Packit Service d1fe03
.BR filter ,
Packit Service d1fe03
is the only table and contains two built-in chains:
Packit Service d1fe03
.B INPUT 
Packit Service d1fe03
(for frames destined for the host) and
Packit Service d1fe03
.B OUTPUT 
Packit Service d1fe03
(for locally-generated frames).
Packit Service d1fe03
.br
Packit Service d1fe03
.br
Packit Service d1fe03
.SH ARPTABLES COMMAND LINE ARGUMENTS
Packit Service d1fe03
After the initial arptables command line argument, the remaining
Packit Service d1fe03
arguments can be divided into several different groups.  These groups
Packit Service d1fe03
are commands, miscellaneous commands, rule-specifications, match-extensions,
Packit Service d1fe03
and watcher-extensions.
Packit Service d1fe03
.SS COMMANDS
Packit Service d1fe03
The arptables command arguments specify the actions to perform on the table
Packit Service d1fe03
defined with the -t argument.  If you do not use the -t argument to name
Packit Service d1fe03
a table, the commands apply to the default filter table.
Packit Service d1fe03
With the exception of the
Packit Service d1fe03
.B "-Z"
Packit Service d1fe03
command, only one command may be used on the command line at a time.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-A, --append"
Packit Service d1fe03
Append a rule to the end of the selected chain.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-D, --delete"
Packit Service d1fe03
Delete the specified rule from the selected chain. There are two ways to
Packit Service d1fe03
use this command. The first is by specifying an interval of rule numbers
Packit Service d1fe03
to delete, syntax: start_nr[:end_nr]. Using negative numbers is allowed, for more
Packit Service d1fe03
details about using negative numbers, see the -I command. The second usage is by
Packit Service d1fe03
specifying the complete rule as it would have been specified when it was added.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-I, --insert"
Packit Service d1fe03
Insert the specified rule into the selected chain at the specified rule number.
Packit Service d1fe03
If the current number of rules equals N, then the specified number can be
Packit Service d1fe03
between -N and N+1. For a positive number i, it holds that i and i-N-1 specify the
Packit Service d1fe03
same place in the chain where the rule should be inserted. The number 0 specifies
Packit Service d1fe03
the place past the last rule in the chain and using this number is therefore
Packit Service d1fe03
equivalent with using the -A command.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-R, --replace"
Packit Service d1fe03
Replaces the specified rule into the selected chain at the specified rule number.
Packit Service d1fe03
If the current number of rules equals N, then the specified number can be
Packit Service d1fe03
between 1 and N. i specifies the place in the chain where the rule should be replaced.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-P, --policy"
Packit Service d1fe03
Set the policy for the chain to the given target. The policy can be
Packit Service d1fe03
.BR ACCEPT ", " DROP " or " RETURN .
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-F, --flush"
Packit Service d1fe03
Flush the selected chain. If no chain is selected, then every chain will be
Packit Service d1fe03
flushed. Flushing the chain does not change the policy of the
Packit Service d1fe03
chain, however.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-Z, --zero"
Packit Service d1fe03
Set the counters of the selected chain to zero. If no chain is selected, all the counters
Packit Service d1fe03
are set to zero. The
Packit Service d1fe03
.B "-Z"
Packit Service d1fe03
command can be used in conjunction with the 
Packit Service d1fe03
.B "-L"
Packit Service d1fe03
command.
Packit Service d1fe03
When both the
Packit Service d1fe03
.B "-Z"
Packit Service d1fe03
and
Packit Service d1fe03
.B "-L"
Packit Service d1fe03
commands are used together in this way, the rule counters are printed on the screen
Packit Service d1fe03
before they are set to zero.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-L, --list"
Packit Service d1fe03
List all rules in the selected chain. If no chain is selected, all chains
Packit Service d1fe03
are listed.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-N, --new-chain"
Packit Service d1fe03
Create a new user-defined chain with the given name. The number of
Packit Service d1fe03
user-defined chains is unlimited. A user-defined chain name has maximum
Packit Service d1fe03
length of 31 characters.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-X, --delete-chain"
Packit Service d1fe03
Delete the specified user-defined chain. There must be no remaining references
Packit Service d1fe03
to the specified chain, otherwise
Packit Service d1fe03
.B arptables
Packit Service d1fe03
will refuse to delete it. If no chain is specified, all user-defined
Packit Service d1fe03
chains that aren't referenced will be removed.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-E, --rename-chain"
Packit Service d1fe03
Rename the specified chain to a new name.  Besides renaming a user-defined
Packit Service d1fe03
chain, you may rename a standard chain name to a name that suits your
Packit Service d1fe03
taste. For example, if you like PREBRIDGING more than PREROUTING,
Packit Service d1fe03
then you can use the -E command to rename the PREROUTING chain. If you do
Packit Service d1fe03
rename one of the standard
Packit Service d1fe03
.B arptables
Packit Service d1fe03
chain names, please be sure to mention
Packit Service d1fe03
this fact should you post a question on the
Packit Service d1fe03
.B arptables
Packit Service d1fe03
mailing lists.
Packit Service d1fe03
It would be wise to use the standard name in your post. Renaming a standard
Packit Service d1fe03
.B arptables
Packit Service d1fe03
chain in this fashion has no effect on the structure or function
Packit Service d1fe03
of the
Packit Service d1fe03
.B arptables
Packit Service d1fe03
kernel table.
Packit Service d1fe03
Packit Service d1fe03
.SS MISCELLANOUS COMMANDS
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-V, --version"
Packit Service d1fe03
Show the version of the arptables userspace program.
Packit Service d1fe03
.TP
Packit Service d1fe03
.B "-h, --help"
Packit Service d1fe03
Give a brief description of the command syntax.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "-j, --jump " "\fItarget\fP"
Packit Service d1fe03
The target of the rule. This is one of the following values:
Packit Service d1fe03
.BR ACCEPT ,
Packit Service d1fe03
.BR DROP ,
Packit Service d1fe03
.BR CONTINUE ,
Packit Service d1fe03
.BR RETURN ,
Packit Service d1fe03
a target extension (see
Packit Service d1fe03
.BR "TARGET EXTENSIONS" ")"
Packit Service d1fe03
or a user-defined chain name.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BI "-c, --set-counters " "PKTS BYTES"
Packit Service d1fe03
This enables the administrator to initialize the packet and byte
Packit Service d1fe03
counters of a rule (during
Packit Service d1fe03
.B INSERT,
Packit Service d1fe03
.B APPEND,
Packit Service d1fe03
.B REPLACE
Packit Service d1fe03
operations).
Packit Service d1fe03
Packit Service d1fe03
.SS RULE-SPECIFICATIONS
Packit Service d1fe03
The following command line arguments make up a rule specification (as used 
Packit Service d1fe03
in the add and delete commands). A "!" option before the specification 
Packit Service d1fe03
inverts the test for that specification. Apart from these standard rule 
Packit Service d1fe03
specifications there are some other command line arguments of interest.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "-s, --source-ip " "[!] \fIaddress\fP[/\fImask]\fP"
Packit Service d1fe03
The Source IP specification.
Packit Service d1fe03
.TP 
Packit Service d1fe03
.BR "-d, --destination-ip " "[!] \fIaddress\fP[/\fImask]\fP"
Packit Service d1fe03
The Destination IP specification.
Packit Service d1fe03
.TP 
Packit Service d1fe03
.BR "--source-mac " "[!] \fIaddress\fP[/\fImask\fP]"
Packit Service d1fe03
The source mac address. Both mask and address are written as 6 hexadecimal
Packit Service d1fe03
numbers separated by colons.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--destination-mac " "[!] \fIaddress\fP[/\fImask\fP]"
Packit Service d1fe03
The destination mac address. Both mask and address are written as 6 hexadecimal
Packit Service d1fe03
numbers separated by colons.
Packit Service d1fe03
.TP 
Packit Service d1fe03
.BR "-i, --in-interface " "[!] \fIname\fP"
Packit Service d1fe03
The interface via which a frame is received (for the
Packit Service d1fe03
.B INPUT
Packit Service d1fe03
chain). The flag
Packit Service d1fe03
.B --in-if
Packit Service d1fe03
is an alias for this option.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "-o, --out-interface " "[!] \fIname\fP"
Packit Service d1fe03
The interface via which a frame is going to be sent (for the
Packit Service d1fe03
.B OUTPUT
Packit Service d1fe03
chain). The flag
Packit Service d1fe03
.B --out-if
Packit Service d1fe03
is an alias for this option.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "-l, --h-length " "\fIlength\fP[/\fImask\fP]"
Packit Service d1fe03
The hardware length (nr of bytes)
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--opcode " "\fIcode\fP[/\fImask\fP]
Packit Service d1fe03
The operation code (2 bytes). Available values are:
Packit Service d1fe03
.BR 1 = Request
Packit Service d1fe03
.BR 2 = Reply
Packit Service d1fe03
.BR 3 = Request_Reverse
Packit Service d1fe03
.BR 4 = Reply_Reverse
Packit Service d1fe03
.BR 5 = DRARP_Request
Packit Service d1fe03
.BR 6 = DRARP_Reply
Packit Service d1fe03
.BR 7 = DRARP_Error
Packit Service d1fe03
.BR 8 = InARP_Request
Packit Service d1fe03
.BR 9 = ARP_NAK .
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--h-type " "\fItype\fP[/\fImask\fP]"
Packit Service d1fe03
The hardware type (2 bytes, hexadecimal). Available values are:
Packit Service d1fe03
.BR 1 = Ethernet .
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--proto-type " "\fItype\fP[/\fImask\fP]"
Packit Service d1fe03
The protocol type (2 bytes). Available values are:
Packit Service d1fe03
.BR 0x800 = IPv4 .
Packit Service d1fe03
Packit Service d1fe03
.SS TARGET-EXTENSIONS
Packit Service d1fe03
.B arptables
Packit Service d1fe03
extensions are precompiled into the userspace tool. So there is no need
Packit Service d1fe03
to explicitly load them with a -m option like in
Packit Service d1fe03
.BR iptables .
Packit Service d1fe03
However, these
Packit Service d1fe03
extensions deal with functionality supported by supplemental kernel modules.
Packit Service d1fe03
.SS mangle
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--mangle-ip-s IP address"
Packit Service d1fe03
Mangles Source IP Address to given value.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--mangle-ip-d IP address"
Packit Service d1fe03
Mangles Destination IP Address to given value.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--mangle-mac-s MAC address"
Packit Service d1fe03
Mangles Source MAC Address to given value.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--mangle-mac-d MAC address"
Packit Service d1fe03
Mangles Destination MAC Address to given value.
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--mangle-target target "
Packit Service d1fe03
Target of ARP mangle operation
Packit Service d1fe03
.BR "" ( DROP ", " CONTINUE " or " ACCEPT " -- default is " ACCEPT ).
Packit Service d1fe03
.SS CLASSIFY
Packit Service d1fe03
This  module  allows you to set the skb->priority value (and thus clas-
Packit Service d1fe03
sify the packet into a specific CBQ class).
Packit Service d1fe03
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--set-class major:minor"
Packit Service d1fe03
Packit Service d1fe03
Set the major and minor  class  value.  The  values  are  always
Packit Service d1fe03
interpreted as hexadecimal even if no 0x prefix is given.
Packit Service d1fe03
Packit Service d1fe03
.SS MARK
Packit Service d1fe03
This  module  allows you to set the skb->mark value (and thus classify
Packit Service d1fe03
the packet by the mark in u32)
Packit Service d1fe03
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--set-mark mark"
Packit Service d1fe03
Set the mark value. The  values  are  always
Packit Service d1fe03
interpreted as hexadecimal even if no 0x prefix is given
Packit Service d1fe03
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--and-mark mark"
Packit Service d1fe03
Binary AND the mark with bits.
Packit Service d1fe03
Packit Service d1fe03
.TP
Packit Service d1fe03
.BR "--or-mark mark"
Packit Service d1fe03
Binary OR the mark with bits.
Packit Service d1fe03
Packit Service d1fe03
.SH NOTES
Packit Service d1fe03
In this nft-based version of
Packit Service d1fe03
.BR arptables ,
Packit Service d1fe03
support for
Packit Service d1fe03
.B FORWARD
Packit Service d1fe03
chain has not been implemented. Since ARP packets are "forwarded" only by Linux
Packit Service d1fe03
bridges, the same may be achieved using
Packit Service d1fe03
.B FORWARD
Packit Service d1fe03
chain in
Packit Service d1fe03
.BR ebtables .
Packit Service d1fe03
Packit Service d1fe03
.SH MAILINGLISTS
Packit Service d1fe03
.BR "" "See " http://netfilter.org/mailinglists.html
Packit Service d1fe03
.SH SEE ALSO
Packit Service d1fe03
.BR xtables-nft "(8), " iptables "(8), " ebtables "(8), " ip (8)
Packit Service d1fe03
.PP
Packit Service d1fe03
.BR "" "See " https://wiki.nftables.org