Blame iptables/ebtables-nft.8

Packit 7b22a4
.TH EBTABLES 8  "December 2011"
Packit 7b22a4
.\"
Packit 7b22a4
.\" Man page written by Bart De Schuymer <bdschuym@pandora.be>
Packit 7b22a4
.\" It is based on the iptables man page.
Packit 7b22a4
.\"
Packit 7b22a4
.\" The man page was edited, February 25th 2003, by 
Packit 7b22a4
.\"      Greg Morgan <" dr_kludge_at_users_sourceforge_net >
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
ebtables \- Ethernet bridge frame table administration (nft-based)
Packit 7b22a4
.SH SYNOPSIS
Packit 7b22a4
.BR "ebtables " [ -t " table ] " - [ ACDI "] chain rule specification [match extensions] [watcher extensions] target"
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -P " chain " ACCEPT " | " DROP " | " RETURN
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -F " [chain]"
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -Z " [chain]"
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [" --Ln "] | [" --Lx "] ] [" --Lc "] [" --Lmac2 ]
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -N " chain [" "-P ACCEPT " | " DROP " | " RETURN" ]
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -X " [chain]"
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " -E " old-chain-name new-chain-name"
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] " --init-table
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-commit
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-init
Packit 7b22a4
.br
Packit 7b22a4
.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-save
Packit 7b22a4
.br
Packit 7b22a4
Packit 7b22a4
.SH DESCRIPTION
Packit 7b22a4
.B ebtables
Packit 7b22a4
is an application program used to set up and maintain the
Packit 7b22a4
tables of rules (inside the Linux kernel) that inspect
Packit 7b22a4
Ethernet frames.
Packit 7b22a4
It is analogous to the
Packit 7b22a4
.B iptables
Packit 7b22a4
application, but less complicated, due to the fact that the Ethernet protocol
Packit 7b22a4
is much simpler than the IP protocol.
Packit 7b22a4
.SS CHAINS
Packit 7b22a4
There are two ebtables tables with built-in chains in the
Packit 7b22a4
Linux kernel. These tables are 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 Ethernet frames. If a
Packit 7b22a4
rule matches an Ethernet 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 that can be used as the 'target'
Packit 7b22a4
of a rule. User-defined chains are very useful to get better performance
Packit 7b22a4
over the linear traversal of the rules and are also essential for structuring
Packit 7b22a4
the filtering rules into well-organized and maintainable sets of rules.
Packit 7b22a4
.SS TARGETS
Packit 7b22a4
A firewall rule specifies criteria for an Ethernet 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
.BR ACCEPT ,
Packit 7b22a4
.BR DROP ,
Packit 7b22a4
.BR CONTINUE ,
Packit 7b22a4
.BR RETURN ,
Packit 7b22a4
an 'extension' (see below) or a jump to a user-defined chain.
Packit 7b22a4
.PP
Packit 7b22a4
.B ACCEPT
Packit 7b22a4
means to let the frame through.
Packit 7b22a4
.B DROP
Packit 7b22a4
means the frame has to be dropped.
Packit 7b22a4
.B CONTINUE
Packit 7b22a4
means the next rule has to be checked. This can be handy, f.e., to know how many
Packit 7b22a4
frames pass a certain point in the chain, to log those frames or to apply multiple
Packit 7b22a4
targets on a frame.
Packit 7b22a4
.B 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 refer to the
Packit 7b22a4
.B "TARGET EXTENSIONS"
Packit 7b22a4
section of this man page.
Packit 7b22a4
.SS TABLES
Packit 7b22a4
As stated earlier, there are two ebtables tables in the Linux
Packit 7b22a4
kernel.  The table names are
Packit 7b22a4
.BR filter " and " nat .
Packit 7b22a4
Of these two tables,
Packit 7b22a4
the filter table is the default table that the command operates on.
Packit 7b22a4
If you are working with the filter table, then you can drop the '-t filter'
Packit 7b22a4
argument to the ebtables command.  However, you will need to provide
Packit 7b22a4
the -t argument for
Packit 7b22a4
.B nat
Packit 7b22a4
table.  Moreover, the -t argument must be the
Packit 7b22a4
first argument on the ebtables command line, if used. 
Packit 7b22a4
.TP
Packit 7b22a4
.B "-t, --table"
Packit 7b22a4
.br
Packit 7b22a4
.B filter
Packit 7b22a4
is the default table and contains three built-in chains:
Packit 7b22a4
.B INPUT 
Packit 7b22a4
(for frames destined for the bridge itself, on the level of the MAC destination address), 
Packit 7b22a4
.B OUTPUT 
Packit 7b22a4
(for locally-generated or (b)routed frames) and
Packit 7b22a4
.B FORWARD 
Packit 7b22a4
(for frames being forwarded by the bridge).
Packit 7b22a4
.br
Packit 7b22a4
.br
Packit 7b22a4
.B nat
Packit 7b22a4
is mostly used to change the mac addresses and contains three built-in chains:
Packit 7b22a4
.B PREROUTING 
Packit 7b22a4
(for altering frames as soon as they come in), 
Packit 7b22a4
.B OUTPUT 
Packit 7b22a4
(for altering locally generated or (b)routed frames before they are bridged) and 
Packit 7b22a4
.B POSTROUTING
Packit 7b22a4
(for altering frames as they are about to go out). A small note on the naming
Packit 7b22a4
of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Packit 7b22a4
PREFORWARDING and POSTFORWARDING, but for all those who come from the
Packit 7b22a4
iptables world to ebtables it is easier to have the same names. Note that you
Packit 7b22a4
can change the name
Packit 7b22a4
.BR "" ( -E )
Packit 7b22a4
if you don't like the default.
Packit 7b22a4
.SH EBTABLES COMMAND LINE ARGUMENTS
Packit 7b22a4
After the initial ebtables '-t table' command line argument, the remaining
Packit 7b22a4
arguments can be divided into several groups.  These groups
Packit 7b22a4
are commands, miscellaneous commands, rule specifications, match extensions,
Packit 7b22a4
watcher extensions and target extensions.
Packit 7b22a4
.SS COMMANDS
Packit 7b22a4
The ebtables 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
Only one command may be used on the command line at a time, except when
Packit 7b22a4
the commands
Packit 7b22a4
.BR -L " and " -Z
Packit 7b22a4
are combined, the commands
Packit 7b22a4
.BR -N " and " -P
Packit 7b22a4
are combined, or when
Packit 7b22a4
.B --atomic-file
Packit 7b22a4
is used.
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 or rules 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 (directly after
Packit 7b22a4
.BR -D ).
Packit 7b22a4
Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
Packit 7b22a4
.B -L --Ln
Packit 7b22a4
to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
Packit 7b22a4
from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
Packit 7b22a4
details about using negative numbers, see the
Packit 7b22a4
.B -I
Packit 7b22a4
command. The second usage is by
Packit 7b22a4
specifying the complete rule as it would have been specified when it was added. Only
Packit 7b22a4
the first encountered rule that is the same as this specified rule, in other
Packit 7b22a4
words the matching rule with the lowest (positive) rule number, is deleted.
Packit 7b22a4
.TP
Packit 7b22a4
.B "-C, --change-counters"
Packit 7b22a4
Change the counters of the specified rule or rules 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 do the changes on (directly after
Packit 7b22a4
.BR -C ).
Packit 7b22a4
Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
Packit 7b22a4
.B -L --Ln
Packit 7b22a4
to list the rules with their rule number). The details are the same as for the
Packit 7b22a4
.BR -D " command. The second usage is by"
Packit 7b22a4
specifying the complete rule as it would have been specified when it was added. Only
Packit 7b22a4
the counters of the first encountered rule that is the same as this specified rule, in other
Packit 7b22a4
words the matching rule with the lowest (positive) rule number, are changed.
Packit 7b22a4
In the first usage, the counters are specified directly after the interval specification,
Packit 7b22a4
in the second usage directly after
Packit 7b22a4
.BR -C .
Packit 7b22a4
First the packet counter is specified, then the byte counter. If the specified counters start
Packit 7b22a4
with a '+', the counter values are added to the respective current counter values.
Packit 7b22a4
If the specified counters start with a '-', the counter values are decreased from the respective
Packit 7b22a4
current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
Packit 7b22a4
the current counters are changed to the specified counters.
Packit 7b22a4
.TP
Packit 7b22a4
.B "-I, --insert"
Packit 7b22a4
Insert the specified rule into the selected chain at the specified rule number. If the
Packit 7b22a4
rule number is not specified, the rule is added at the head of the chain.
Packit 7b22a4
If the current number of rules equals
Packit 7b22a4
.IR N ,
Packit 7b22a4
then the specified number can be
Packit 7b22a4
between
Packit 7b22a4
.IR -N " and " N+1 .
Packit 7b22a4
For a positive number
Packit 7b22a4
.IR i ,
Packit 7b22a4
it holds that
Packit 7b22a4
.IR i " and " i-N-1
Packit 7b22a4
specify the same place in the chain where the rule should be inserted. The rule number
Packit 7b22a4
0 specifies the place past the last rule in the chain and using this number is therefore
Packit 7b22a4
equivalent to using the
Packit 7b22a4
.BR -A " command."
Packit 7b22a4
Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
Packit 7b22a4
in a chain.
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 a 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
.br
Packit 7b22a4
The following options change the output of the
Packit 7b22a4
.B "-L"
Packit 7b22a4
command.
Packit 7b22a4
.br
Packit 7b22a4
.B "--Ln"
Packit 7b22a4
.br
Packit 7b22a4
Places the rule number in front of every rule. This option is incompatible with the
Packit 7b22a4
.BR --Lx " option."
Packit 7b22a4
.br
Packit 7b22a4
.B "--Lc"
Packit 7b22a4
.br
Packit 7b22a4
Shows the counters at the end of each rule displayed by the
Packit 7b22a4
.B "-L"
Packit 7b22a4
command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Packit 7b22a4
The frame counter shows how many frames have matched the specific rule, the byte
Packit 7b22a4
counter shows the sum of the frame sizes of these matching frames. Using this option
Packit 7b22a4
.BR "" "in combination with the " --Lx " option causes the counters to be written out"
Packit 7b22a4
.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Packit 7b22a4
.br
Packit 7b22a4
.B "--Lx"
Packit 7b22a4
.br
Packit 7b22a4
Changes the output so that it produces a set of ebtables commands that construct
Packit 7b22a4
the contents of the chain, when specified.
Packit 7b22a4
If no chain is specified, ebtables commands to construct the contents of the
Packit 7b22a4
table are given, including commands for creating the user-defined chains (if any).
Packit 7b22a4
You can use this set of commands in an ebtables boot or reload
Packit 7b22a4
script.  For example the output could be used at system startup.
Packit 7b22a4
The 
Packit 7b22a4
.B "--Lx"
Packit 7b22a4
option is incompatible with the
Packit 7b22a4
.B "--Ln"
Packit 7b22a4
listing option. Using the
Packit 7b22a4
.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
Packit 7b22a4
.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Packit 7b22a4
.br
Packit 7b22a4
.B "--Lmac2"
Packit 7b22a4
.br
Packit 7b22a4
Shows all MAC addresses with the same length, adding leading zeroes
Packit 7b22a4
if necessary. The default representation omits leading zeroes in the addresses.
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 limited only by the number of possible chain names.
Packit 7b22a4
A user-defined chain name has a maximum
Packit 7b22a4
length of 31 characters. The standard policy of the user-defined chain is
Packit 7b22a4
ACCEPT. The policy of the new chain can be initialized to a different standard
Packit 7b22a4
target by using the
Packit 7b22a4
.B -P
Packit 7b22a4
command together with the
Packit 7b22a4
.B -N
Packit 7b22a4
command. In this case, the chain name does not have to be specified for the
Packit 7b22a4
.B -P
Packit 7b22a4
command.
Packit 7b22a4
.TP
Packit 7b22a4
.B "-X, --delete-chain"
Packit 7b22a4
Delete the specified user-defined chain. There must be no remaining references (jumps)
Packit 7b22a4
to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
Packit 7b22a4
specified, all user-defined 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 can rename a standard chain to a name that suits your
Packit 7b22a4
taste. For example, if you like PREFORWARDING 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 ebtables chain names, please be sure to mention
Packit 7b22a4
this fact should you post a question on the ebtables mailing lists.
Packit 7b22a4
It would be wise to use the standard name in your post. Renaming a standard
Packit 7b22a4
ebtables chain in this fashion has no effect on the structure or functioning
Packit 7b22a4
of the ebtables kernel table.
Packit 7b22a4
.TP
Packit 7b22a4
.B "--init-table"
Packit 7b22a4
Replace the current table data by the initial table data.
Packit 7b22a4
.TP
Packit 7b22a4
.B "--atomic-init"
Packit 7b22a4
Copy the kernel's initial data of the table to the specified
Packit 7b22a4
file. This can be used as the first action, after which rules are added
Packit 7b22a4
to the file. The file can be specified using the
Packit 7b22a4
.B --atomic-file
Packit 7b22a4
command or through the
Packit 7b22a4
.IR EBTABLES_ATOMIC_FILE " environment variable."
Packit 7b22a4
.TP
Packit 7b22a4
.B "--atomic-save"
Packit 7b22a4
Copy the kernel's current data of the table to the specified
Packit 7b22a4
file. This can be used as the first action, after which rules are added
Packit 7b22a4
to the file. The file can be specified using the
Packit 7b22a4
.B --atomic-file
Packit 7b22a4
command or through the
Packit 7b22a4
.IR EBTABLES_ATOMIC_FILE " environment variable."
Packit 7b22a4
.TP
Packit 7b22a4
.B "--atomic-commit"
Packit 7b22a4
Replace the kernel table data with the data contained in the specified
Packit 7b22a4
file. This is a useful command that allows you to load all your rules of a
Packit 7b22a4
certain table into the kernel at once, saving the kernel a lot of precious
Packit 7b22a4
time and allowing atomic updates of the tables. The file which contains
Packit 7b22a4
the table data is constructed by using either the
Packit 7b22a4
.B "--atomic-init"
Packit 7b22a4
or the
Packit 7b22a4
.B "--atomic-save"
Packit 7b22a4
command to generate a starting file. After that, using the
Packit 7b22a4
.B "--atomic-file"
Packit 7b22a4
command when constructing rules or setting the
Packit 7b22a4
.IR EBTABLES_ATOMIC_FILE " environment variable"
Packit 7b22a4
allows you to extend the file and build the complete table before
Packit 7b22a4
committing it to the kernel. This command can be very useful in boot scripts
Packit 7b22a4
to populate the ebtables tables in a fast way.
Packit 7b22a4
.SS MISCELLANOUS COMMANDS
Packit 7b22a4
.TP
Packit 7b22a4
.B "-V, --version"
Packit 7b22a4
Show the version of the ebtables userspace program.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-h, --help " "[\fIlist of module names\fP]"
Packit 7b22a4
Give a brief description of the command syntax. Here you can also specify
Packit 7b22a4
names of extensions and ebtables will try to write help about those
Packit 7b22a4
extensions. E.g.
Packit 7b22a4
.IR "ebtables -h snat log ip arp" .
Packit 7b22a4
Specify
Packit 7b22a4
.I list_extensions
Packit 7b22a4
to list all extensions supported by the userspace
Packit 7b22a4
utility.
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
.B --atomic-file "\fIfile\fP"
Packit 7b22a4
Let the command operate on the specified
Packit 7b22a4
.IR file .
Packit 7b22a4
The data of the table to
Packit 7b22a4
operate on will be extracted from the file and the result of the operation
Packit 7b22a4
will be saved back into the file. If specified, this option should come
Packit 7b22a4
before the command specification. An alternative that should be preferred,
Packit 7b22a4
is setting the
Packit 7b22a4
.IR EBTABLES_ATOMIC_FILE " environment variable."
Packit 7b22a4
.TP
Packit 7b22a4
.B -M, --modprobe "\fIprogram\fP"
Packit 7b22a4
When talking to the kernel, use this
Packit 7b22a4
.I program
Packit 7b22a4
to try to automatically load missing kernel modules.
Packit 7b22a4
.TP
Packit 7b22a4
.B --concurrent
Packit 7b22a4
Use a file lock to support concurrent scripts updating the ebtables kernel tables.
Packit 7b22a4
Packit 7b22a4
.SS
Packit 7b22a4
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
See both the 
Packit 7b22a4
.BR "MATCH EXTENSIONS" 
Packit 7b22a4
and the
Packit 7b22a4
.BR "WATCHER EXTENSIONS" 
Packit 7b22a4
below.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-p, --protocol " "[!] \fIprotocol\fP"
Packit 7b22a4
The protocol that was responsible for creating the frame. This can be a
Packit 7b22a4
hexadecimal number, above 
Packit 7b22a4
.IR 0x0600 ,
Packit 7b22a4
a name (e.g.
Packit 7b22a4
.I ARP
Packit 7b22a4
) or
Packit 7b22a4
.BR LENGTH .
Packit 7b22a4
The protocol field of the Ethernet frame can be used to denote the
Packit 7b22a4
length of the header (802.2/802.3 networks). When the value of that field is
Packit 7b22a4
below or equals
Packit 7b22a4
.IR 0x0600 ,
Packit 7b22a4
the value equals the size of the header and shouldn't be used as a
Packit 7b22a4
protocol number. Instead, all frames where the protocol field is used as
Packit 7b22a4
the length field are assumed to be of the same 'protocol'. The protocol
Packit 7b22a4
name used in ebtables for these frames is
Packit 7b22a4
.BR LENGTH .
Packit 7b22a4
.br
Packit 7b22a4
The file
Packit 7b22a4
.B /etc/ethertypes
Packit 7b22a4
can be used to show readable
Packit 7b22a4
characters instead of hexadecimal numbers for the protocols. For example,
Packit 7b22a4
.I 0x0800
Packit 7b22a4
will be represented by 
Packit 7b22a4
.IR IPV4 .
Packit 7b22a4
The use of this file is not case sensitive. 
Packit 7b22a4
See that file for more information. The flag 
Packit 7b22a4
.B --proto
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP 
Packit 7b22a4
.BR "-i, --in-interface " "[!] \fIname\fP"
Packit 7b22a4
The interface (bridge port) via which a frame is received (this option is useful in the
Packit 7b22a4
.BR INPUT ,
Packit 7b22a4
.BR FORWARD ,
Packit 7b22a4
.BR PREROUTING " and " BROUTING
Packit 7b22a4
chains). If the interface name ends with '+', then
Packit 7b22a4
any interface name that begins with this name (disregarding '+') will match.
Packit 7b22a4
The flag
Packit 7b22a4
.B --in-if
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--logical-in " "[!] \fIname\fP"
Packit 7b22a4
The (logical) bridge interface via which a frame is received (this option is useful in the
Packit 7b22a4
.BR INPUT ,
Packit 7b22a4
.BR FORWARD ,
Packit 7b22a4
.BR PREROUTING " and " BROUTING
Packit 7b22a4
chains).
Packit 7b22a4
If the interface name ends with '+', then
Packit 7b22a4
any interface name that begins with this name (disregarding '+') will match.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-o, --out-interface " "[!] \fIname\fP"
Packit 7b22a4
The interface (bridge port) via which a frame is going to be sent (this option is useful in the
Packit 7b22a4
.BR OUTPUT ,
Packit 7b22a4
.B FORWARD
Packit 7b22a4
and
Packit 7b22a4
.B POSTROUTING
Packit 7b22a4
chains). If the interface name ends with '+', then
Packit 7b22a4
any interface name that begins with this name (disregarding '+') will match.
Packit 7b22a4
The flag
Packit 7b22a4
.B --out-if
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--logical-out " "[!] \fIname\fP"
Packit 7b22a4
The (logical) bridge interface via which a frame is going to be sent (this option
Packit 7b22a4
is useful in the
Packit 7b22a4
.BR OUTPUT ,
Packit 7b22a4
.B FORWARD
Packit 7b22a4
and
Packit 7b22a4
.B POSTROUTING
Packit 7b22a4
chains).
Packit 7b22a4
If the interface name ends with '+', then
Packit 7b22a4
any interface name that begins with this name (disregarding '+') will match.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-s, --source " "[!] \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. Alternatively one can specify Unicast,
Packit 7b22a4
Multicast, Broadcast or BGA (Bridge Group Address):
Packit 7b22a4
.br
Packit 7b22a4
.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
Packit 7b22a4
.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
Packit 7b22a4
.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
Packit 7b22a4
.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Packit 7b22a4
Note that a broadcast
Packit 7b22a4
address will also match the multicast specification. The flag
Packit 7b22a4
.B --src
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The destination MAC address. See
Packit 7b22a4
.B -s
Packit 7b22a4
(above) for more details on MAC addresses. The flag
Packit 7b22a4
.B --dst
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "-c, --set-counter " "\fIpcnt bcnt\fP"
Packit 7b22a4
If used with
Packit 7b22a4
.BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
Packit 7b22a4
.IR pcnt ", resp. " bcnt ".
Packit 7b22a4
If used with the
Packit 7b22a4
.BR -C " or " -D " commands, only rules with a packet and byte count equal to"
Packit 7b22a4
.IR pcnt ", resp. " bcnt " will match."
Packit 7b22a4
Packit 7b22a4
.SS MATCH EXTENSIONS
Packit 7b22a4
Ebtables extensions are dynamically loaded into the userspace tool,
Packit 7b22a4
there is therefore no need to explicitly load them with a
Packit 7b22a4
-m option like is done in iptables.
Packit 7b22a4
These extensions deal with functionality supported by kernel modules supplemental to
Packit 7b22a4
the core ebtables code.
Packit 7b22a4
.SS 802_3
Packit 7b22a4
Specify 802.3 DSAP/SSAP fields or SNAP type.  The protocol must be specified as
Packit 7b22a4
.IR "LENGTH " "(see the option " " -p " above).
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--802_3-sap " "[!] \fIsap\fP"
Packit 7b22a4
DSAP and SSAP are two one byte 802.3 fields.  The bytes are always
Packit 7b22a4
equal, so only one byte (hexadecimal) is needed as an argument.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--802_3-type " "[!] \fItype\fP"
Packit 7b22a4
If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
Packit 7b22a4
be consulted to determine the payload protocol.  This is a two byte
Packit 7b22a4
(hexadecimal) argument.  Only 802.3 frames with DSAP/SSAP 0xaa are
Packit 7b22a4
checked for type.
Packit 7b22a4
.SS among
Packit 7b22a4
Match a MAC address or MAC/IP address pair versus a list of MAC addresses
Packit 7b22a4
and MAC/IP address pairs.
Packit 7b22a4
A list entry has the following format:
Packit 7b22a4
.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Packit 7b22a4
list entries are separated by a comma, specifying an IP address corresponding to
Packit 7b22a4
the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
Packit 7b22a4
but different IP address (and vice versa) can be specified. If the MAC address doesn't
Packit 7b22a4
match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--among-dst " "[!] \fIlist\fP"
Packit 7b22a4
Compare the MAC destination to the given list. If the Ethernet frame has type
Packit 7b22a4
.IR IPv4 " or " ARP ,
Packit 7b22a4
then comparison with MAC/IP destination address pairs from the
Packit 7b22a4
list is possible.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--among-src " "[!] \fIlist\fP"
Packit 7b22a4
Compare the MAC source to the given list. If the Ethernet frame has type
Packit 7b22a4
.IR IPv4 " or " ARP ,
Packit 7b22a4
then comparison with MAC/IP source address pairs from the list
Packit 7b22a4
is possible.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--among-dst-file " "[!] \fIfile\fP"
Packit 7b22a4
Same as
Packit 7b22a4
.BR --among-dst " but the list is read in from the specified file."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--among-src-file " "[!] \fIfile\fP"
Packit 7b22a4
Same as
Packit 7b22a4
.BR --among-src " but the list is read in from the specified file."
Packit Service 635b90
.PP
Packit Service 635b90
Note that in this implementation of ebtables, among lists uses must be
Packit Service 635b90
internally homogeneous regarding whether IP addresses are present or not. Mixed
Packit Service 635b90
use of MAC addresses and MAC/IP address pairs is not supported yet.
Packit 7b22a4
.SS arp
Packit 7b22a4
Specify (R)ARP fields. The protocol must be specified as
Packit 7b22a4
.IR ARP " or " RARP .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-opcode " "[!] \fIopcode\fP"
Packit 7b22a4
The (R)ARP opcode (decimal or a string, for more details see
Packit 7b22a4
.BR "ebtables -h arp" ).
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-htype " "[!] \fIhardware type\fP"
Packit 7b22a4
The hardware type, this can be a decimal or the string
Packit 7b22a4
.I Ethernet
Packit 7b22a4
(which sets
Packit 7b22a4
.I type
Packit 7b22a4
to 1). Most (R)ARP packets have Eternet as hardware type.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Packit 7b22a4
The protocol type for which the (r)arp is used (hexadecimal or the string
Packit 7b22a4
.IR IPv4 ,
Packit 7b22a4
denoting 0x0800).
Packit 7b22a4
Most (R)ARP packets have protocol type IPv4.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The (R)ARP IP source address specification.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The (R)ARP IP destination address specification.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The (R)ARP MAC source address specification.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The (R)ARP MAC destination address specification.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "" "[!]" " --arp-gratuitous"
Packit 7b22a4
Checks for ARP gratuitous packets: checks equality of IPv4 source
Packit 7b22a4
address and IPv4 destination address inside the ARP header.
Packit 7b22a4
.SS ip
Packit 7b22a4
Specify IPv4 fields. The protocol must be specified as
Packit 7b22a4
.IR IPv4 .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The source IP address.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip-src
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The destination IP address.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip-dst
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-tos " "[!] \fItos\fP"
Packit 7b22a4
The IP type of service, in hexadecimal numbers.
Packit 7b22a4
.BR IPv4 .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-protocol " "[!] \fIprotocol\fP"
Packit 7b22a4
The IP protocol.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip-proto
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
Packit 7b22a4
The source port or port range for the IP protocols 6 (TCP), 17
Packit 7b22a4
(UDP), 33 (DCCP) or 132 (SCTP). The
Packit 7b22a4
.B --ip-protocol
Packit 7b22a4
option must be specified as
Packit 7b22a4
.IR TCP ", " UDP ", " DCCP " or " SCTP .
Packit 7b22a4
If
Packit 7b22a4
.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip-sport
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Packit 7b22a4
The destination port or port range for ip protocols 6 (TCP), 17
Packit 7b22a4
(UDP), 33 (DCCP) or 132 (SCTP). The
Packit 7b22a4
.B --ip-protocol
Packit 7b22a4
option must be specified as
Packit 7b22a4
.IR TCP ", " UDP ", " DCCP " or " SCTP .
Packit 7b22a4
If
Packit 7b22a4
.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip-dport
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.SS ip6
Packit 7b22a4
Specify IPv6 fields. The protocol must be specified as
Packit 7b22a4
.IR IPv6 .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-source " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The source IPv6 address.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip6-src
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Packit 7b22a4
The destination IPv6 address.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip6-dst
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-tclass " "[!] \fItclass\fP"
Packit 7b22a4
The IPv6 traffic class, in hexadecimal numbers.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-protocol " "[!] \fIprotocol\fP"
Packit 7b22a4
The IP protocol.
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip6-proto
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
Packit 7b22a4
The source port or port range for the IPv6 protocols 6 (TCP), 17
Packit 7b22a4
(UDP), 33 (DCCP) or 132 (SCTP). The
Packit 7b22a4
.B --ip6-protocol
Packit 7b22a4
option must be specified as
Packit 7b22a4
.IR TCP ", " UDP ", " DCCP " or " SCTP .
Packit 7b22a4
If
Packit 7b22a4
.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip6-sport
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Packit 7b22a4
The destination port or port range for IPv6 protocols 6 (TCP), 17
Packit 7b22a4
(UDP), 33 (DCCP) or 132 (SCTP). The
Packit 7b22a4
.B --ip6-protocol
Packit 7b22a4
option must be specified as
Packit 7b22a4
.IR TCP ", " UDP ", " DCCP " or " SCTP .
Packit 7b22a4
If
Packit 7b22a4
.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
Packit 7b22a4
The flag
Packit 7b22a4
.B --ip6-dport
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--ip6-icmp-type " "[!] {\fItype\fP[:\fItype\fP]/\fIcode\fP[:\fIcode\fP]|\fItypename\fP}"
Packit 7b22a4
Specify ipv6\-icmp type and code to match.
Packit 7b22a4
Ranges for both type and code are supported. Type and code are
Packit 7b22a4
separated by a slash. Valid numbers for type and range are 0 to 255.
Packit 7b22a4
To match a single type including all valid codes, symbolic names can
Packit 7b22a4
be used instead of numbers. The list of known type names is shown by the command
Packit 7b22a4
.nf
Packit 7b22a4
  ebtables \-\-help ip6
Packit 7b22a4
.fi
Packit 7b22a4
This option is only valid for \-\-ip6-prococol ipv6-icmp.
Packit 7b22a4
.SS limit
Packit 7b22a4
This module matches at a limited rate using a token bucket filter.
Packit 7b22a4
A rule using this extension will match until this limit is reached.
Packit 7b22a4
It can be used with the
Packit 7b22a4
.B --log
Packit 7b22a4
watcher to give limited logging, for example. Its use is the same
Packit 7b22a4
as the limit match of iptables.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--limit " "[\fIvalue\fP]"
Packit 7b22a4
Maximum average matching rate: specified as a number, with an optional
Packit 7b22a4
.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--limit-burst " "[\fInumber\fP]"
Packit 7b22a4
Maximum initial number of packets to match: this number gets recharged by
Packit 7b22a4
one every time the limit specified above is not reached, up to this
Packit 7b22a4
number; the default is
Packit 7b22a4
.IR 5 .
Packit 7b22a4
.SS mark_m
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Packit 7b22a4
Matches frames with the given unsigned mark value. If a
Packit 7b22a4
.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
Packit 7b22a4
the user-specified
Packit 7b22a4
.IR mask " is taken before comparing it with the"
Packit 7b22a4
user-specified mark
Packit 7b22a4
.IR value ". When only a mark "
Packit 7b22a4
.IR value " is specified, the packet"
Packit 7b22a4
only matches when the mark value of the frame equals the user-specified
Packit 7b22a4
mark
Packit 7b22a4
.IR value .
Packit 7b22a4
If only a
Packit 7b22a4
.IR mask " is specified, the logical"
Packit 7b22a4
AND of the mark value of the frame and the user-specified
Packit 7b22a4
.IR mask " is taken and the frame matches when the result of this logical AND is"
Packit 7b22a4
non-zero. Only specifying a
Packit 7b22a4
.IR mask " is useful to match multiple mark values."
Packit 7b22a4
.SS pkttype
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--pkttype-type " "[!] \fItype\fP"
Packit 7b22a4
Matches on the Ethernet "class" of the frame, which is determined by the
Packit 7b22a4
generic networking code. Possible values:
Packit 7b22a4
.IR broadcast " (MAC destination is the broadcast address),"
Packit 7b22a4
.IR multicast " (MAC destination is a multicast address),"
Packit 7b22a4
.IR host " (MAC destination is the receiving network device), or "
Packit 7b22a4
.IR otherhost " (none of the above)."
Packit 7b22a4
.SS stp
Packit 7b22a4
Specify stp BPDU (bridge protocol data unit) fields. The destination
Packit 7b22a4
address
Packit 7b22a4
.BR "" ( -d ") must be specified as the bridge group address"
Packit 7b22a4
.IR "" ( BGA ).
Packit 7b22a4
For all options for which a range of values can be specified, it holds that
Packit 7b22a4
if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
Packit 7b22a4
for that option is used, while if the upper bound is omitted (but the colon again is not), the
Packit 7b22a4
highest possible upper bound for that option is used.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-type " "[!] \fItype\fP"
Packit 7b22a4
The BPDU type (0-255), recognized non-numerical types are
Packit 7b22a4
.IR config ", denoting a configuration BPDU (=0), and"
Packit 7b22a4
.IR tcn ", denothing a topology change notification BPDU (=128)."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-flags " "[!] \fIflag\fP"
Packit 7b22a4
The BPDU flag (0-255), recognized non-numerical flags are
Packit 7b22a4
.IR topology-change ", denoting the topology change flag (=1), and"
Packit 7b22a4
.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
Packit 7b22a4
The root priority (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
Packit 7b22a4
The root mac address, see the option
Packit 7b22a4
.BR -s " for more details."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
Packit 7b22a4
The root path cost (0-4294967295) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
Packit 7b22a4
The BPDU's sender priority (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
Packit 7b22a4
The BPDU's sender mac address, see the option
Packit 7b22a4
.BR -s " for more details."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
Packit 7b22a4
The port identifier (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
Packit 7b22a4
The message age timer (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
Packit 7b22a4
The max age timer (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
Packit 7b22a4
The hello time timer (0-65535) range.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
Packit 7b22a4
The forward delay timer (0-65535) range.
Packit 7b22a4
.\" .SS string
Packit 7b22a4
.\" This module matches on a given string using some pattern matching strategy.
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string-algo " "\fIalgorithm\fP"
Packit 7b22a4
.\" The pattern matching strategy. (bm = Boyer-Moore, kmp = Knuth-Pratt-Morris)
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string-from " "\fIoffset\fP"
Packit 7b22a4
.\" The lowest offset from which a match can start. (default: 0)
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string-to " "\fIoffset\fP"
Packit 7b22a4
.\" The highest offset from which a match can start. (default: size of frame)
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string " "[!] \fIpattern\fP"
Packit 7b22a4
.\" Matches the given pattern.
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string-hex " "[!] \fIpattern\fP"
Packit 7b22a4
.\" Matches the given pattern in hex notation, e.g. '|0D 0A|', '|0D0A|', 'www|09|netfilter|03|org|00|'
Packit 7b22a4
.\" .TP
Packit 7b22a4
.\" .BR "--string-icase"
Packit 7b22a4
.\" Ignore case when searching.
Packit 7b22a4
.SS vlan
Packit 7b22a4
Specify 802.1Q Tag Control Information fields.
Packit 7b22a4
The protocol must be specified as
Packit 7b22a4
.IR 802_1Q " (0x8100)."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--vlan-id " "[!] \fIid\fP"
Packit 7b22a4
The VLAN identifier field (VID). Decimal number from 0 to 4095.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--vlan-prio " "[!] \fIprio\fP"
Packit 7b22a4
The user priority field, a decimal number from 0 to 7.
Packit 7b22a4
The VID should be set to 0 ("null VID") or unspecified
Packit 7b22a4
(in the latter case the VID is deliberately set to 0).
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--vlan-encap " "[!] \fItype\fP"
Packit 7b22a4
The encapsulated Ethernet frame type/length.
Packit 7b22a4
Specified as a hexadecimal
Packit 7b22a4
number from 0x0000 to 0xFFFF or as a symbolic name
Packit 7b22a4
from
Packit 7b22a4
.BR /etc/ethertypes .
Packit 7b22a4
Packit 7b22a4
.SS WATCHER EXTENSIONS
Packit 7b22a4
Watchers only look at frames passing by, they don't modify them nor decide
Packit 7b22a4
to accept the frames or not. These watchers only
Packit 7b22a4
see the frame if the frame matches the rule, and they see it before the
Packit 7b22a4
target is executed.
Packit 7b22a4
.SS log
Packit 7b22a4
The log watcher writes descriptive data about a frame to the syslog.
Packit 7b22a4
.TP
Packit 7b22a4
.B "--log"
Packit 7b22a4
.br
Packit 7b22a4
Log with the default loggin options: log-level=
Packit 7b22a4
.IR info ,
Packit 7b22a4
log-prefix="", no ip logging, no arp logging.
Packit 7b22a4
.TP
Packit 7b22a4
.B --log-level "\fIlevel\fP"
Packit 7b22a4
.br
Packit 7b22a4
Defines the logging level. For the possible values, see
Packit 7b22a4
.BR "ebtables -h log" .
Packit 7b22a4
The default level is 
Packit 7b22a4
.IR info .
Packit 7b22a4
.TP
Packit 7b22a4
.BR --log-prefix " \fItext\fP"
Packit 7b22a4
.br
Packit 7b22a4
Defines the prefix
Packit 7b22a4
.I text
Packit 7b22a4
to be printed at the beginning of the line with the logging information.
Packit 7b22a4
.TP
Packit 7b22a4
.B --log-ip 
Packit 7b22a4
.br
Packit 7b22a4
Will log the ip information when a frame made by the ip protocol matches 
Packit 7b22a4
the rule. The default is no ip information logging.
Packit 7b22a4
.TP
Packit 7b22a4
.B --log-ip6 
Packit 7b22a4
.br
Packit 7b22a4
Will log the ipv6 information when a frame made by the ipv6 protocol matches 
Packit 7b22a4
the rule. The default is no ipv6 information logging.
Packit 7b22a4
.TP
Packit 7b22a4
.B --log-arp
Packit 7b22a4
.br
Packit 7b22a4
Will log the (r)arp information when a frame made by the (r)arp protocols
Packit 7b22a4
matches the rule. The default is no (r)arp information logging.
Packit 7b22a4
.SS nflog
Packit 7b22a4
The nflog watcher passes the packet to the loaded logging backend
Packit 7b22a4
in order to log the packet. This is usually used in combination with
Packit 7b22a4
nfnetlink_log as logging backend, which will multicast the packet
Packit 7b22a4
through a
Packit 7b22a4
.IR netlink
Packit 7b22a4
socket to the specified multicast group. One or more userspace processes
Packit 7b22a4
may subscribe to the group to receive the packets.
Packit 7b22a4
.TP
Packit 7b22a4
.B "--nflog"
Packit 7b22a4
.br
Packit 7b22a4
Log with the default logging options
Packit 7b22a4
.TP
Packit 7b22a4
.B --nflog-group "\fInlgroup\fP"
Packit 7b22a4
.br
Packit 7b22a4
The netlink group (1 - 2^32-1) to which packets are (only applicable for
Packit 7b22a4
nfnetlink_log). The default value is 1.
Packit 7b22a4
.TP
Packit 7b22a4
.B --nflog-prefix "\fIprefix\fP"
Packit 7b22a4
.br
Packit 7b22a4
A prefix string to include in the log message, up to 30 characters
Packit 7b22a4
long, useful for distinguishing messages in the logs.
Packit 7b22a4
.TP
Packit 7b22a4
.B --nflog-range "\fIsize\fP"
Packit 7b22a4
.br
Packit 7b22a4
The number of bytes to be copied to userspace (only applicable for
Packit 7b22a4
nfnetlink_log). nfnetlink_log instances may specify their own
Packit 7b22a4
range, this option overrides it.
Packit 7b22a4
.TP
Packit 7b22a4
.B --nflog-threshold "\fIsize\fP"
Packit 7b22a4
.br
Packit 7b22a4
Number of packets to queue inside the kernel before sending them
Packit 7b22a4
to userspace (only applicable for nfnetlink_log). Higher values
Packit 7b22a4
result in less overhead per packet, but increase delay until the
Packit 7b22a4
packets reach userspace. The default value is 1.
Packit 7b22a4
.SS ulog
Packit 7b22a4
The ulog watcher passes the packet to a userspace
Packit 7b22a4
logging daemon using netlink multicast sockets. This differs
Packit 7b22a4
from the log watcher in the sense that the complete packet is
Packit 7b22a4
sent to userspace instead of a descriptive text and that
Packit 7b22a4
netlink multicast sockets are used instead of the syslog.
Packit 7b22a4
This watcher enables parsing of packets with userspace programs, the
Packit 7b22a4
physical bridge in and out ports are also included in the netlink messages.
Packit 7b22a4
The ulog watcher module accepts 2 parameters when the module is loaded
Packit 7b22a4
into the kernel (e.g. with modprobe):
Packit 7b22a4
.B nlbufsiz
Packit 7b22a4
specifies how big the buffer for each netlink multicast
Packit 7b22a4
group is. If you say
Packit 7b22a4
.IR nlbufsiz=8192 ,
Packit 7b22a4
for example, up to eight kB of packets will
Packit 7b22a4
get accumulated in the kernel until they are sent to userspace. It is
Packit 7b22a4
not possible to allocate more than 128kB. Please also keep in mind that
Packit 7b22a4
this buffer size is allocated for each nlgroup you are using, so the
Packit 7b22a4
total kernel memory usage increases by that factor. The default is 4096.
Packit 7b22a4
.B flushtimeout
Packit 7b22a4
specifies after how many hundredths of a second the queue should be
Packit 7b22a4
flushed, even if it is not full yet. The default is 10 (one tenth of
Packit 7b22a4
a second).
Packit 7b22a4
.TP
Packit 7b22a4
.B "--ulog"
Packit 7b22a4
.br
Packit 7b22a4
Use the default settings: ulog-prefix="", ulog-nlgroup=1,
Packit 7b22a4
ulog-cprange=4096, ulog-qthreshold=1.
Packit 7b22a4
.TP
Packit 7b22a4
.B --ulog-prefix "\fItext\fP"
Packit 7b22a4
.br
Packit 7b22a4
Defines the prefix included with the packets sent to userspace.
Packit 7b22a4
.TP
Packit 7b22a4
.BR --ulog-nlgroup " \fIgroup\fP"
Packit 7b22a4
.br
Packit 7b22a4
Defines which netlink group number to use (a number from 1 to 32).
Packit 7b22a4
Make sure the netlink group numbers used for the iptables ULOG
Packit 7b22a4
target differ from those used for the ebtables ulog watcher.
Packit 7b22a4
The default group number is 1.
Packit 7b22a4
.TP
Packit 7b22a4
.BR --ulog-cprange " \fIrange\fP"
Packit 7b22a4
.br
Packit 7b22a4
Defines the maximum copy range to userspace, for packets matching the
Packit 7b22a4
rule. The default range is 0, which means the maximum copy range is
Packit 7b22a4
given by
Packit 7b22a4
.BR nlbufsiz .
Packit 7b22a4
A maximum copy range larger than
Packit 7b22a4
128*1024 is meaningless as the packets sent to userspace have an upper
Packit 7b22a4
size limit of 128*1024.
Packit 7b22a4
.TP
Packit 7b22a4
.BR --ulog-qthreshold " \fIthreshold\fP"
Packit 7b22a4
.br
Packit 7b22a4
Queue at most
Packit 7b22a4
.I threshold
Packit 7b22a4
number of packets before sending them to
Packit 7b22a4
userspace with a netlink socket. Note that packets can be sent to
Packit 7b22a4
userspace before the queue is full, this happens when the ulog
Packit 7b22a4
kernel timer goes off (the frequency of this timer depends on
Packit 7b22a4
.BR flushtimeout ).
Packit 7b22a4
.SS TARGET EXTENSIONS
Packit 7b22a4
.SS arpreply
Packit 7b22a4
The
Packit 7b22a4
.B arpreply
Packit 7b22a4
target can be used in the
Packit 7b22a4
.BR PREROUTING " chain of the " nat " table."
Packit 7b22a4
If this target sees an ARP request it will automatically reply
Packit 7b22a4
with an ARP reply. The used MAC address for the reply can be specified.
Packit 7b22a4
The protocol must be specified as
Packit 7b22a4
.IR ARP .
Packit 7b22a4
When the ARP message is not an ARP request or when the ARP request isn't
Packit 7b22a4
for an IP address on an Ethernet network, it is ignored by this target
Packit 7b22a4
.BR "" ( CONTINUE ).
Packit 7b22a4
When the ARP request is malformed, it is dropped
Packit 7b22a4
.BR "" ( DROP ).
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arpreply-mac " "\fIaddress\fP"
Packit 7b22a4
Specifies the MAC address to reply with: the Ethernet source MAC and the
Packit 7b22a4
ARP payload source MAC will be filled in with this address.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--arpreply-target " "\fItarget\fP"
Packit 7b22a4
Specifies the standard target. After sending the ARP reply, the rule still
Packit 7b22a4
has to give a standard target so ebtables knows what to do with the ARP request.
Packit 7b22a4
The default target
Packit 7b22a4
.BR "" "is " DROP .
Packit 7b22a4
.SS dnat
Packit 7b22a4
The
Packit 7b22a4
.B dnat
Packit 7b22a4
target can only be used in the
Packit 7b22a4
.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Packit 7b22a4
It specifies that the destination MAC address has to be changed.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--to-destination " "\fIaddress\fP"
Packit 7b22a4
.br
Packit 7b22a4
Change the destination MAC address to the specified
Packit 7b22a4
.IR address .
Packit 7b22a4
The flag
Packit 7b22a4
.B --to-dst
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--dnat-target " "\fItarget\fP"
Packit 7b22a4
.br
Packit 7b22a4
Specifies the standard target. After doing the dnat, the rule still has to
Packit 7b22a4
give a standard target so ebtables knows what to do with the dnated frame.
Packit 7b22a4
The default target is
Packit 7b22a4
.BR ACCEPT .
Packit 7b22a4
Making it
Packit 7b22a4
.BR CONTINUE " could let you use"
Packit 7b22a4
multiple target extensions on the same frame. Making it
Packit 7b22a4
.BR DROP " only makes"
Packit 7b22a4
sense in the
Packit 7b22a4
.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
Packit 7b22a4
in a base chain is not allowed (for obvious reasons).
Packit 7b22a4
.SS mark
Packit 7b22a4
.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Packit 7b22a4
to use the marking of a frame/packet in both ebtables and iptables,
Packit 7b22a4
if the bridge-nf code is compiled into the kernel. Both put the marking at the
Packit 7b22a4
same place. This allows for a form of communication between ebtables and iptables.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark-set " "\fIvalue\fP"
Packit 7b22a4
.br
Packit 7b22a4
Mark the frame with the specified non-negative
Packit 7b22a4
.IR value .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark-or " "\fIvalue\fP"
Packit 7b22a4
.br
Packit 7b22a4
Or the frame with the specified non-negative
Packit 7b22a4
.IR value .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark-and " "\fIvalue\fP"
Packit 7b22a4
.br
Packit 7b22a4
And the frame with the specified non-negative
Packit 7b22a4
.IR value .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark-xor " "\fIvalue\fP"
Packit 7b22a4
.br
Packit 7b22a4
Xor the frame with the specified non-negative
Packit 7b22a4
.IR value .
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--mark-target " "\fItarget\fP"
Packit 7b22a4
.br
Packit 7b22a4
Specifies the standard target. After marking the frame, the rule
Packit 7b22a4
still has to give a standard target so ebtables knows what to do.
Packit 7b22a4
The default target is
Packit 7b22a4
.BR ACCEPT ". Making it " CONTINUE " can let you do other"
Packit 7b22a4
things with the frame in subsequent rules of the chain.
Packit 7b22a4
.SS redirect
Packit 7b22a4
The
Packit 7b22a4
.B redirect
Packit 7b22a4
target will change the MAC target address to that of the bridge device the
Packit 7b22a4
frame arrived on. This target can only be used in the
Packit 7b22a4
.BR PREROUTING " chain of the " nat " table."
Packit 7b22a4
The MAC address of the bridge is used as destination address."
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--redirect-target " "\fItarget\fP"
Packit 7b22a4
.br
Packit 7b22a4
Specifies the standard target. After doing the MAC redirect, the rule
Packit 7b22a4
still has to give a standard target so ebtables knows what to do.
Packit 7b22a4
The default target is
Packit 7b22a4
.BR ACCEPT ". Making it " CONTINUE " could let you use"
Packit 7b22a4
multiple target extensions on the same frame. Making it
Packit 7b22a4
.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
Packit 7b22a4
.BR "" "that using " RETURN " in a base chain is not allowed."
Packit 7b22a4
.SS snat
Packit 7b22a4
The
Packit 7b22a4
.B snat
Packit 7b22a4
target can only be used in the
Packit 7b22a4
.BR POSTROUTING " chain of the " nat " table."
Packit 7b22a4
It specifies that the source MAC address has to be changed.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--to-source " "\fIaddress\fP"
Packit 7b22a4
.br
Packit 7b22a4
Changes the source MAC address to the specified
Packit 7b22a4
.IR address ". The flag"
Packit 7b22a4
.B --to-src
Packit 7b22a4
is an alias for this option.
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--snat-target " "\fItarget\fP"
Packit 7b22a4
.br
Packit 7b22a4
Specifies the standard target. After doing the snat, the rule still has 
Packit 7b22a4
to give a standard target so ebtables knows what to do.
Packit 7b22a4
.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
Packit 7b22a4
.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
Packit 7b22a4
.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
Packit 7b22a4
.BR "" "that using " RETURN " in a base chain is not allowed."
Packit 7b22a4
.br
Packit 7b22a4
.TP
Packit 7b22a4
.BR "--snat-arp "
Packit 7b22a4
.br
Packit 7b22a4
Also change the hardware source address inside the arp header if the packet is an
Packit 7b22a4
arp message and the hardware address length in the arp header is 6 bytes.
Packit 7b22a4
.br
Packit 7b22a4
.SH FILES
Packit 7b22a4
.I /etc/ethertypes
Packit 7b22a4
.SH ENVIRONMENT VARIABLES
Packit 7b22a4
.I EBTABLES_ATOMIC_FILE
Packit 7b22a4
.SH MAILINGLISTS
Packit 7b22a4
.BR "" "See " http://netfilter.org/mailinglists.html
Packit 7b22a4
.SH BUGS
Packit 7b22a4
The version of ebtables this man page ships with does not support the
Packit 7b22a4
.B broute
Packit 7b22a4
table. Also there is no support for
Packit 7b22a4
.B string
Packit 7b22a4
match. And finally, this list is probably not complete.
Packit 7b22a4
.SH SEE ALSO
Packit 7b22a4
.BR xtables-nft "(8), " iptables "(8), " ip (8)
Packit 7b22a4
.PP
Packit 7b22a4
.BR "" "See " https://wiki.nftables.org