Blame iptables/arptables-nft.8

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