blob: 81d1cf6b26c3af500884473c08bfd9e4840aff0a [file] [log] [blame]
Bart De Schuymer592d5652006-12-15 11:36:30 +00001.TH EBTABLES 8 "$(DATE)"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00002.\"
Bart De Schuymer64182a32004-01-21 20:39:54 +00003.\" Man page written by Bart De Schuymer <bdschuym@pandora.be>
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00004.\" It is based on the iptables man page.
5.\"
Bart De Schuymer38cd75e2003-07-25 17:44:30 +00006.\" The man page was edited, February 25th 2003, by
Bart De Schuymer7085d662003-02-25 22:33:28 +00007.\" Greg Morgan <" dr_kludge_at_users_sourceforge_net >
8.\"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00009.\" Iptables page by Herve Eychenne March 2000.
10.\"
11.\" This program is free software; you can redistribute it and/or modify
12.\" it under the terms of the GNU General Public License as published by
13.\" the Free Software Foundation; either version 2 of the License, or
14.\" (at your option) any later version.
15.\"
16.\" This program is distributed in the hope that it will be useful,
17.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19.\" GNU General Public License for more details.
20.\"
21.\" You should have received a copy of the GNU General Public License
22.\" along with this program; if not, write to the Free Software
23.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24.\"
25.\"
26.SH NAME
Bart De Schuymer592d5652006-12-15 11:36:30 +000027ebtables (v$(VERSION)) \- Ethernet bridge frame table administration
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028.SH SYNOPSIS
Bart De Schuymerab611e22005-02-14 20:20:03 +000029.BR "ebtables " [ -t " table ] " - [ ACDI "] chain rule specification [match extensions] [watcher extensions] target"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000030.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000031.BR "ebtables " [ -t " table ] " -P " chain " ACCEPT " | " DROP " | " RETURN
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000033.BR "ebtables " [ -t " table ] " -F " [chain]"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000035.BR "ebtables " [ -t " table ] " -Z " [chain]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000036.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +000037.BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [" --Ln "] | [" --Lx "] ] [" --Lc "] [" --Lmac2 ]
Bart De Schuymer29749c62002-06-25 21:27:57 +000038.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000039.BR "ebtables " [ -t " table ] " -N " chain [" "-P ACCEPT " | " DROP " | " RETURN" ]
Bart De Schuymer637ecd22003-07-13 18:53:50 +000040.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000041.BR "ebtables " [ -t " table ] " -X " [chain]"
Bart De Schuymera02773a2002-07-15 19:42:11 +000042.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000043.BR "ebtables " [ -t " table ] " -E " old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000045.BR "ebtables " [ -t " table ] " --init-table
Bart De Schuymer234bce92002-07-14 21:25:08 +000046.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000047.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-commit
Bart De Schuymer7085d662003-02-25 22:33:28 +000048.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000049.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-init
Bart De Schuymer7085d662003-02-25 22:33:28 +000050.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000051.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-save
52.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000053.SH DESCRIPTION
54.B ebtables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000055is an application program used to set up and maintain the
56tables of rules (inside the Linux kernel) that inspect
57Ethernet frames.
58It is analogous to the
Bart De Schuymer7085d662003-02-25 22:33:28 +000059.B iptables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000060application, but less complicated, due to the fact that the Ethernet protocol
61is much simpler than the IP protocol.
Bart De Schuymer7085d662003-02-25 22:33:28 +000062.SS CHAINS
Bart De Schuymer00bbac82004-12-21 20:29:12 +000063There are three ebtables tables with built-in chains in the
64Linux kernel. These tables are used to divide functionality into
Bart De Schuymer7085d662003-02-25 22:33:28 +000065different sets of rules. Each set of rules is called a chain.
66Each chain is an ordered list of rules that can match Ethernet frames. If a
67rule matches an Ethernet frame, then a processing specification tells
68what to do with that matching frame. The processing specification is
69called a 'target'. However, if the frame does not match the current
70rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000071The user can create new (user-defined) chains that can be used as the 'target'
Bart De Schuymer37d520d2004-10-24 07:36:15 +000072of a rule. User-defined chains are very useful to get better performance
Bart De Schuymer00bbac82004-12-21 20:29:12 +000073over the linear traversal of the rules and are also essential for structuring
74the filtering rules into well-organized and maintainable sets of rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000075.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +000076A firewall rule specifies criteria for an Ethernet frame and a frame
77processing specification called a target. When a frame matches a rule,
78then the next action performed by the kernel is specified by the target.
79The target can be one of these values:
Bart De Schuymer00bbac82004-12-21 20:29:12 +000080.BR ACCEPT ,
81.BR DROP ,
82.BR CONTINUE ,
83.BR RETURN ,
84an 'extension' (see below) or a jump to a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000085.PP
Bart De Schuymer00bbac82004-12-21 20:29:12 +000086.B ACCEPT
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000087means to let the frame through.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000088.B DROP
Bart De Schuymer1902d182006-01-23 19:02:18 +000089means the frame has to be dropped. In the
90.BR BROUTING " chain however, the " ACCEPT " and " DROP " target have different"
91meanings (see the info provided for the
92.BR -t " option)."
Bart De Schuymer00bbac82004-12-21 20:29:12 +000093.B CONTINUE
94means the next rule has to be checked. This can be handy, f.e., to know how many
95frames pass a certain point in the chain, to log those frames or to apply multiple
96targets on a frame.
97.B RETURN
Bart De Schuymer29749c62002-06-25 21:27:57 +000098means stop traversing this chain and resume at the next rule in the
99previous (calling) chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000100For the extension targets please refer to the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000101.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000102section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000103.SS TABLES
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000104As stated earlier, there are three ebtables tables in the Linux
105kernel. The table names are
Bart De Schuymer7085d662003-02-25 22:33:28 +0000106.BR filter ", " nat " and " broute .
107Of these three tables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000108the filter table is the default table that the command operates on.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000109If you are working with the filter table, then you can drop the '-t filter'
110argument to the ebtables command. However, you will need to provide
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000111the -t argument for the other two tables. Moreover, the -t argument must be the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000112first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000113.TP
114.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000115.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000116.B filter
Bart De Schuymer7085d662003-02-25 22:33:28 +0000117is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000118.B INPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000119(for frames destined for the bridge itself, on the level of the MAC destination address),
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000120.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000121(for locally-generated or (b)routed frames) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000122.B FORWARD
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000123(for frames being forwarded by the bridge).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000124.br
125.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000126.B nat
127is mostly used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000128.B PREROUTING
129(for altering frames as soon as they come in),
130.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000131(for altering locally generated or (b)routed frames before they are bridged) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000132.B POSTROUTING
133(for altering frames as they are about to go out). A small note on the naming
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000134of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000135PREFORWARDING and POSTFORWARDING, but for all those who come from the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000136iptables world to ebtables it is easier to have the same names. Note that you
137can change the name
138.BR "" ( -E )
139if you don't like the default.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000140.br
141.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000142.B broute
Bart De Schuymer7085d662003-02-25 22:33:28 +0000143is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000144.BR BROUTING .
145The targets
146.BR DROP " and " ACCEPT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000147have a special meaning in the broute table (these names are used instead of
148more descriptive names to keep the implementation generic).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000149.B DROP
150actually means the frame has to be routed, while
151.B ACCEPT
152means the frame has to be bridged. The
153.B BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000154chain is traversed very early. However, it is only traversed by frames entering on
155a bridge port that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000156would be bridged, but you can decide otherwise here. The
157.B redirect
158target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000159.SH EBTABLES COMMAND LINE ARGUMENTS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000160After the initial ebtables '-t table' command line argument, the remaining
161arguments can be divided into several groups. These groups
162are commands, miscellaneous commands, rule specifications, match extensions,
163watcher extensions and target extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000164.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000165The ebtables command arguments specify the actions to perform on the table
166defined with the -t argument. If you do not use the -t argument to name
167a table, the commands apply to the default filter table.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000168Only one command may be used on the command line at a time, except when
169the commands
170.BR -L " and " -Z
171are combined, the commands
172.BR -N " and " -P
173are combined, or when
174.B --atomic-file
175is used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000176.TP
177.B "-A, --append"
178Append a rule to the end of the selected chain.
179.TP
180.B "-D, --delete"
Bart De Schuymerab611e22005-02-14 20:20:03 +0000181Delete the specified rule or rules from the selected chain. There are two ways to
Bart De Schuymerabc84172002-11-06 21:02:33 +0000182use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000183to delete (directly after
184.BR -D ).
185Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
186.B -L --Ln
Bart De Schuymerab611e22005-02-14 20:20:03 +0000187to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000188from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
189details about using negative numbers, see the
190.B -I
191command. The second usage is by
192specifying the complete rule as it would have been specified when it was added. Only
193the first encountered rule that is the same as this specified rule, in other
Bart De Schuymerab611e22005-02-14 20:20:03 +0000194words the matching rule with the lowest (positive) rule number, is deleted.
195.TP
196.B "-C, --change-counters"
197Change the counters of the specified rule or rules from the selected chain. There are two ways to
198use this command. The first is by specifying an interval of rule numbers
199to do the changes on (directly after
200.BR -C ).
201Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
202.B -L --Ln
203to list the rules with their rule number). The details are the same as for the
204.BR -D " command. The second usage is by"
205specifying the complete rule as it would have been specified when it was added. Only
206the counters of the first encountered rule that is the same as this specified rule, in other
207words the matching rule with the lowest (positive) rule number, are changed.
208In the first usage, the counters are specified directly after the interval specification,
209in the second usage directly after
210.BR -C .
211First the packet counter is specified, then the byte counter. If the specified counters start
212with a '+', the counter values are added to the respective current counter values.
213If the specified counters start with a '-', the counter values are decreased from the respective
214current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
Bart De Schuymerc900a012005-09-29 20:12:22 +0000215the current counters are changed to the specified counters.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000216.TP
217.B "-I, --insert"
Bart De Schuymer01581232005-07-24 09:46:09 +0000218Insert the specified rule into the selected chain at the specified rule number. If the
219rule number is not specified, the rule is added at the head of the chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000220If the current number of rules equals
221.IR N ,
222then the specified number can be
223between
224.IR -N " and " N+1 .
225For a positive number
226.IR i ,
227it holds that
228.IR i " and " i-N-1
229specify the same place in the chain where the rule should be inserted. The rule number
2300 specifies the place past the last rule in the chain and using this number is therefore
231equivalent to using the
232.BR -A " command."
233Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
234in a chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000235.TP
236.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000237Set the policy for the chain to the given target. The policy can be
238.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000239.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000240.B "-F, --flush"
241Flush the selected chain. If no chain is selected, then every chain will be
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000242flushed. Flushing a chain does not change the policy of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000243chain, however.
244.TP
245.B "-Z, --zero"
246Set the counters of the selected chain to zero. If no chain is selected, all the counters
247are set to zero. The
248.B "-Z"
249command can be used in conjunction with the
250.B "-L"
251command.
252When both the
253.B "-Z"
254and
255.B "-L"
256commands are used together in this way, the rule counters are printed on the screen
257before they are set to zero.
258.TP
259.B "-L, --list"
260List all rules in the selected chain. If no chain is selected, all chains
261are listed.
262.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000263The following options change the output of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000264.B "-L"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000265command.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000266.br
267.B "--Ln"
268.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000269Places the rule number in front of every rule. This option is incompatible with the
270.BR --Lx " option."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000271.br
272.B "--Lc"
273.br
274Shows the counters at the end of each rule displayed by the
275.B "-L"
276command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000277The frame counter shows how many frames have matched the specific rule, the byte
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000278counter shows the sum of the frame sizes of these matching frames. Using this option
279.BR "" "in combination with the " --Lx " option causes the counters to be written out"
280.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000281.br
282.B "--Lx"
283.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000284Changes the output so that it produces a set of ebtables commands that construct
285the contents of the chain, when specified.
286If no chain is specified, ebtables commands to construct the contents of the
287table are given, including commands for creating the user-defined chains (if any).
288You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000289script. For example the output could be used at system startup.
290The
291.B "--Lx"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000292option is incompatible with the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000293.B "--Ln"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000294listing option. Using the
295.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
296.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000297.br
298.B "--Lmac2"
299.br
300Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000301if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000302.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000303.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000304Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000305user-defined chains is limited only by the number of possible chain names.
306A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000307length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000308ACCEPT. The policy of the new chain can be initialized to a different standard
309target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000310.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000311command together with the
312.B -N
313command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000314.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000315command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000316.TP
317.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000318Delete the specified user-defined chain. There must be no remaining references (jumps)
319to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
320specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000321.TP
322.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000323Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000324chain, you can rename a standard chain to a name that suits your
325taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000327rename one of the standard ebtables chain names, please be sure to mention
328this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000329It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000330ebtables chain in this fashion has no effect on the structure or functioning
331of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000332.TP
333.B "--init-table"
334Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000335.TP
336.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000337Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000338file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000339to the file. The file can be specified using the
340.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000341command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000342.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000343.TP
344.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000345Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000346file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000347to the file. The file can be specified using the
348.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000349command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000350.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000351.TP
352.B "--atomic-commit"
353Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000354file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000355certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000356time and allowing atomic updates of the tables. The file which contains
357the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000358.B "--atomic-init"
359or the
360.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000361command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000362.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000363command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000364.IR EBTABLES_ATOMIC_FILE " environment variable"
365allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000366committing it to the kernel. This command can be very useful in boot scripts
367to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000368.SS MISCELLANOUS COMMANDS
369.TP
370.B "-V, --version"
371Show the version of the ebtables userspace program.
372.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000373.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000374Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000375names of extensions and ebtables will try to write help about those
376extensions. E.g.
377.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000378Specify
379.I list_extensions
380to list all extensions supported by the userspace
381utility.
382.TP
383.BR "-j, --jump " "\fItarget\fP"
384The target of the rule. This is one of the following values:
385.BR ACCEPT ,
386.BR DROP ,
387.BR CONTINUE ,
388.BR RETURN ,
389a target extension (see
390.BR "TARGET EXTENSIONS" ")"
391or a user-defined chain name.
392.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000393.B --atomic-file "\fIfile\fP"
394Let the command operate on the specified
395.IR file .
396The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000397operate on will be extracted from the file and the result of the operation
398will be saved back into the file. If specified, this option should come
399before the command specification. An alternative that should be preferred,
400is setting the
401.IR EBTABLES_ATOMIC_FILE " environment variable."
402.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000403.B -M, --modprobe "\fIprogram\fP"
404When talking to the kernel, use this
405.I program
406to try to automatically load missing kernel modules.
Bart De Schuymerf9b4bcb2011-06-19 18:52:37 +0000407.TP
408.B --concurrent
409Use a file lock to support concurrent scripts updating the ebtables kernel tables.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000410
Bart De Schuymer29749c62002-06-25 21:27:57 +0000411.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000412RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000413The following command line arguments make up a rule specification (as used
414in the add and delete commands). A "!" option before the specification
415inverts the test for that specification. Apart from these standard rule
416specifications there are some other command line arguments of interest.
417See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000418.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000419and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000420.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000421below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000422.TP
423.BR "-p, --protocol " "[!] \fIprotocol\fP"
424The protocol that was responsible for creating the frame. This can be a
425hexadecimal number, above
426.IR 0x0600 ,
427a name (e.g.
428.I ARP
429) or
430.BR LENGTH .
431The protocol field of the Ethernet frame can be used to denote the
432length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000433below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000434.IR 0x0600 ,
435the value equals the size of the header and shouldn't be used as a
436protocol number. Instead, all frames where the protocol field is used as
437the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000438name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000439.BR LENGTH .
440.br
441The file
442.B /etc/ethertypes
443can be used to show readable
444characters instead of hexadecimal numbers for the protocols. For example,
445.I 0x0800
446will be represented by
447.IR IPV4 .
448The use of this file is not case sensitive.
449See that file for more information. The flag
450.B --proto
451is an alias for this option.
452.TP
453.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000454The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000455.BR INPUT ,
456.BR FORWARD ,
457.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000458chains). If the interface name ends with '+', then
459any interface name that begins with this name (disregarding '+') will match.
460The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000461.B --in-if
462is an alias for this option.
463.TP
464.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000465The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000466.BR INPUT ,
467.BR FORWARD ,
468.BR PREROUTING " and " BROUTING
469chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000470If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000471any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000472.TP
473.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000474The interface (bridge port) via which a frame is going to be sent (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000475.BR OUTPUT ,
476.B FORWARD
477and
478.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000479chains). If the interface name ends with '+', then
480any interface name that begins with this name (disregarding '+') will match.
481The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000482.B --out-if
483is an alias for this option.
484.TP
485.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000486The (logical) bridge interface via which a frame is going to be sent (this option
487is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000488.BR OUTPUT ,
489.B FORWARD
490and
491.B POSTROUTING
492chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000493If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000494any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000495.TP
496.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000497The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000498numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000499Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000500.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000501.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
502.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
503.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
504.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000505Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000506address will also match the multicast specification. The flag
507.B --src
508is an alias for this option.
509.TP
510.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000511The destination MAC address. See
512.B -s
513(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000514.B --dst
515is an alias for this option.
Bart De Schuymerab611e22005-02-14 20:20:03 +0000516.TP
517.BR "-c, --set-counter " "\fIpcnt bcnt\fP"
518If used with
519.BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
520.IR pcnt ", resp. " bcnt ".
521If used with the
522.BR -C " or " -D " commands, only rules with a packet and byte count equal to"
523.IR pcnt ", resp. " bcnt " will match."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000524
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000525.SS MATCH EXTENSIONS
526Ebtables extensions are dynamically loaded into the userspace tool,
527there is therefore no need to explicitly load them with a
528-m option like is done in iptables.
529These extensions deal with functionality supported by kernel modules supplemental to
530the core ebtables code.
531.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000532Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000533.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000534.TP
535.BR "--802_3-sap " "[!] \fIsap\fP"
536DSAP and SSAP are two one byte 802.3 fields. The bytes are always
537equal, so only one byte (hexadecimal) is needed as an argument.
538.TP
539.BR "--802_3-type " "[!] \fItype\fP"
540If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
541be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000542(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000543checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000544.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000545Match a MAC address or MAC/IP address pair versus a list of MAC addresses
546and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000547A list entry has the following format:
548.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000549list entries are separated by a comma, specifying an IP address corresponding to
550the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
551but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000552match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000553.TP
554.BR "--among-dst " "[!] \fIlist\fP"
555Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000556.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000557then comparison with MAC/IP destination address pairs from the
558list is possible.
559.TP
560.BR "--among-src " "[!] \fIlist\fP"
561Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000562.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000563then comparison with MAC/IP source address pairs from the list
564is possible.
Bart De Schuymer8069b5a2006-08-17 10:18:02 +0000565.TP
566.BR "--among-dst-file " "[!] \fIfile\fP"
567Same as
568.BR --among-dst " but the list is read in from the specified file."
569.TP
570.BR "--among-src-file " "[!] \fIfile\fP"
571Same as
572.BR --among-src " but the list is read in from the specified file."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000573.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000574Specify (R)ARP fields. The protocol must be specified as
575.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000576.TP
577.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000578The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000579.BR "ebtables -h arp" ).
580.TP
581.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000582The hardware type, this can be a decimal or the string
583.I Ethernet
584(which sets
585.I type
586to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000587.TP
588.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000589The protocol type for which the (r)arp is used (hexadecimal or the string
590.IR IPv4 ,
591denoting 0x0800).
592Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000593.TP
594.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000595The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000596.TP
597.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000598The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000599.TP
600.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000601The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000602.TP
603.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000604The (R)ARP MAC destination address specification.
Bart De Schuymer29d62112007-03-28 16:54:04 +0000605.TP
606.BR "" "[!]" " --arp-gratuitous"
607Checks for ARP gratuitous packets: checks equality of IPv4 source
608address and IPv4 destination address inside the ARP header.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000609.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000610Specify IPv4 fields. The protocol must be specified as
611.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000612.TP
613.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000614The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000615The flag
616.B --ip-src
617is an alias for this option.
618.TP
619.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000620The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000621The flag
622.B --ip-dst
623is an alias for this option.
624.TP
625.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000626The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000627.BR IPv4 .
628.TP
629.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000630The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000631The flag
632.B --ip-proto
633is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000634.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000635.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer1902d182006-01-23 19:02:18 +0000636The source port or port range for the IP protocols 6 (TCP), 17
637(UDP), 33 (DCCP) or 132 (SCTP). The
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000638.B --ip-protocol
639option must be specified as
Bart De Schuymer1902d182006-01-23 19:02:18 +0000640.IR TCP ", " UDP ", " DCCP " or " SCTP .
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000641If
642.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
643The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000644.B --ip-sport
645is an alias for this option.
646.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000647.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer1902d182006-01-23 19:02:18 +0000648The destination port or port range for ip protocols 6 (TCP), 17
649(UDP), 33 (DCCP) or 132 (SCTP). The
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000650.B --ip-protocol
651option must be specified as
Bart De Schuymer1902d182006-01-23 19:02:18 +0000652.IR TCP ", " UDP ", " DCCP " or " SCTP .
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000653If
654.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
655The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000656.B --ip-dport
657is an alias for this option.
Bart De Schuymer005837e2008-02-21 21:32:25 +0000658.SS ip6
659Specify IPv6 fields. The protocol must be specified as
660.IR IPv6 .
661.TP
662.BR "--ip6-source " "[!] \fIaddress\fP[/\fImask\fP]"
663The source IPv6 address.
664The flag
665.B --ip6-src
666is an alias for this option.
667.TP
668.BR "--ip6-destination " "[!] \fIaddress\fP[/\fImask\fP]"
669The destination IPv6 address.
670The flag
671.B --ip6-dst
672is an alias for this option.
673.TP
674.BR "--ip6-tclass " "[!] \fItclass\fP"
675The IPv6 traffic class, in hexadecimal numbers.
676.TP
677.BR "--ip6-protocol " "[!] \fIprotocol\fP"
678The IP protocol.
679The flag
680.B --ip6-proto
681is an alias for this option.
682.TP
683.BR "--ip6-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
684The source port or port range for the IPv6 protocols 6 (TCP), 17
685(UDP), 33 (DCCP) or 132 (SCTP). The
686.B --ip6-protocol
687option must be specified as
688.IR TCP ", " UDP ", " DCCP " or " SCTP .
689If
690.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
691The flag
692.B --ip6-sport
693is an alias for this option.
694.TP
695.BR "--ip6-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
696The destination port or port range for IPv6 protocols 6 (TCP), 17
697(UDP), 33 (DCCP) or 132 (SCTP). The
698.B --ip6-protocol
699option must be specified as
700.IR TCP ", " UDP ", " DCCP " or " SCTP .
701If
702.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
703The flag
704.B --ip6-dport
705is an alias for this option.
Bart De Schuymer6f7130a2011-01-18 20:08:34 +0000706.TP
707.BR "--ip6-icmp-type " "[!] {\fItype\fP[:\fItype\fP]/\fIcode\fP[:\fIcode\fP]|\fItypename\fP}"
708Specify ipv6\-icmp type and code to match.
709Ranges for both type and code are supported. Type and code are
710separated by a slash. Valid numbers for type and range are 0 to 255.
711To match a single type including all valid codes, symbolic names can
712be used instead of numbers. The list of known type names is shown by the command
713.nf
714 ebtables \-\-help ip6
715.fi
716This option is only valid for \-\-ip6-prococol ipv6-icmp.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000717.SS limit
718This module matches at a limited rate using a token bucket filter.
719A rule using this extension will match until this limit is reached.
720It can be used with the
721.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000722watcher to give limited logging, for example. Its use is the same
723as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000724.TP
725.BR "--limit " "[\fIvalue\fP]"
726Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000727.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000728.TP
729.BR "--limit-burst " "[\fInumber\fP]"
730Maximum initial number of packets to match: this number gets recharged by
731one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000732number; the default is
733.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000734.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000735.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000736.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000737Matches frames with the given unsigned mark value. If a
738.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
739the user-specified
740.IR mask " is taken before comparing it with the"
741user-specified mark
742.IR value ". When only a mark "
743.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000744only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000745mark
746.IR value .
747If only a
748.IR mask " is specified, the logical"
749AND of the mark value of the frame and the user-specified
750.IR mask " is taken and the frame matches when the result of this logical AND is"
751non-zero. Only specifying a
752.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000753.SS pkttype
754.TP
755.BR "--pkttype-type " "[!] \fItype\fP"
756Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000757generic networking code. Possible values:
758.IR broadcast " (MAC destination is the broadcast address),"
759.IR multicast " (MAC destination is a multicast address),"
760.IR host " (MAC destination is the receiving network device), or "
761.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000762.SS stp
763Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000764address
765.BR "" ( -d ") must be specified as the bridge group address"
766.IR "" ( BGA ).
767For all options for which a range of values can be specified, it holds that
768if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
769for that option is used, while if the upper bound is omitted (but the colon again is not), the
770highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000771.TP
772.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000773The BPDU type (0-255), recognized non-numerical types are
774.IR config ", denoting a configuration BPDU (=0), and"
775.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000776.TP
777.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000778The BPDU flag (0-255), recognized non-numerical flags are
779.IR topology-change ", denoting the topology change flag (=1), and"
780.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000781.TP
782.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
783The root priority (0-65535) range.
784.TP
785.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
786The root mac address, see the option
787.BR -s " for more details."
788.TP
789.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
790The root path cost (0-4294967295) range.
791.TP
792.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
793The BPDU's sender priority (0-65535) range.
794.TP
795.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
796The BPDU's sender mac address, see the option
797.BR -s " for more details."
798.TP
799.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
800The port identifier (0-65535) range.
801.TP
802.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
803The message age timer (0-65535) range.
804.TP
805.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
806The max age timer (0-65535) range.
807.TP
808.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
809The hello time timer (0-65535) range.
810.TP
811.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
812The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000813.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000814Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000815The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000816.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000817.TP
818.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000819The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000820.TP
821.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000822The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000823The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000824(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000825.TP
fnm3ed7e9012002-06-25 16:43:23 +0000826.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000827The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000828Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000829number from 0x0000 to 0xFFFF or as a symbolic name
830from
831.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000832
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000833.SS WATCHER EXTENSIONS
834Watchers only look at frames passing by, they don't modify them nor decide
835to accept the frames or not. These watchers only
836see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000837target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000838.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000839The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000840.TP
841.B "--log"
842.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000843Log with the default loggin options: log-level=
844.IR info ,
845log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000846.TP
847.B --log-level "\fIlevel\fP"
848.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000849Defines the logging level. For the possible values, see
850.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000851The default level is
852.IR info .
853.TP
854.BR --log-prefix " \fItext\fP"
855.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000856Defines the prefix
857.I text
858to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000859.TP
860.B --log-ip
861.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000862Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000863the rule. The default is no ip information logging.
864.TP
Bart De Schuymer005837e2008-02-21 21:32:25 +0000865.B --log-ip6
866.br
867Will log the ipv6 information when a frame made by the ipv6 protocol matches
868the rule. The default is no ipv6 information logging.
869.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000870.B --log-arp
871.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000872Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000873matches the rule. The default is no (r)arp information logging.
Bart De Schuymer03e60002008-03-17 22:10:49 +0000874.SS nflog
875The nflog watcher passes the packet to the loaded logging backend
876in order to log the packet. This is usually used in combination with
877nfnetlink_log as logging backend, which will multicast the packet
878through a
879.IR netlink
880socket to the specified multicast group. One or more userspace processes
881may subscribe to the group to receive the packets.
882.TP
883.B "--nflog"
884.br
885Log with the default logging options
886.TP
887.B --nflog-group "\fInlgroup\fP"
888.br
889The netlink group (1 - 2^32-1) to which packets are (only applicable for
890nfnetlink_log). The default value is 1.
891.TP
892.B --nflog-prefix "\fIprefix\fP"
893.br
894A prefix string to include in the log message, up to 30 characters
895long, useful for distinguishing messages in the logs.
896.TP
897.B --nflog-range "\fIsize\fP"
898.br
899The number of bytes to be copied to userspace (only applicable for
900nfnetlink_log). nfnetlink_log instances may specify their own
901range, this option overrides it.
902.TP
903.B --nflog-threshold "\fIsize\fP"
904.br
905Number of packets to queue inside the kernel before sending them
906to userspace (only applicable for nfnetlink_log). Higher values
907result in less overhead per packet, but increase delay until the
908packets reach userspace. The default value is 1.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000909.SS ulog
910The ulog watcher passes the packet to a userspace
911logging daemon using netlink multicast sockets. This differs
912from the log watcher in the sense that the complete packet is
913sent to userspace instead of a descriptive text and that
914netlink multicast sockets are used instead of the syslog.
915This watcher enables parsing of packets with userspace programs, the
916physical bridge in and out ports are also included in the netlink messages.
917The ulog watcher module accepts 2 parameters when the module is loaded
918into the kernel (e.g. with modprobe):
919.B nlbufsiz
920specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000921group is. If you say
922.IR nlbufsiz=8192 ,
923for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000924get accumulated in the kernel until they are sent to userspace. It is
925not possible to allocate more than 128kB. Please also keep in mind that
926this buffer size is allocated for each nlgroup you are using, so the
927total kernel memory usage increases by that factor. The default is 4096.
928.B flushtimeout
929specifies after how many hundredths of a second the queue should be
930flushed, even if it is not full yet. The default is 10 (one tenth of
931a second).
932.TP
933.B "--ulog"
934.br
935Use the default settings: ulog-prefix="", ulog-nlgroup=1,
936ulog-cprange=4096, ulog-qthreshold=1.
937.TP
938.B --ulog-prefix "\fItext\fP"
939.br
940Defines the prefix included with the packets sent to userspace.
941.TP
942.BR --ulog-nlgroup " \fIgroup\fP"
943.br
944Defines which netlink group number to use (a number from 1 to 32).
945Make sure the netlink group numbers used for the iptables ULOG
946target differ from those used for the ebtables ulog watcher.
947The default group number is 1.
948.TP
949.BR --ulog-cprange " \fIrange\fP"
950.br
951Defines the maximum copy range to userspace, for packets matching the
952rule. The default range is 0, which means the maximum copy range is
953given by
954.BR nlbufsiz .
955A maximum copy range larger than
956128*1024 is meaningless as the packets sent to userspace have an upper
957size limit of 128*1024.
958.TP
959.BR --ulog-qthreshold " \fIthreshold\fP"
960.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000961Queue at most
962.I threshold
963number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000964userspace with a netlink socket. Note that packets can be sent to
965userspace before the queue is full, this happens when the ulog
966kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000967.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000968.SS TARGET EXTENSIONS
Bart De Schuymer4cd1da62006-01-23 19:51:30 +0000969.SS arpreply
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000970The
971.B arpreply
972target can be used in the
973.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000974If this target sees an ARP request it will automatically reply
975with an ARP reply. The used MAC address for the reply can be specified.
976The protocol must be specified as
977.IR ARP .
978When the ARP message is not an ARP request or when the ARP request isn't
979for an IP address on an Ethernet network, it is ignored by this target
980.BR "" ( CONTINUE ).
981When the ARP request is malformed, it is dropped
982.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000983.TP
984.BR "--arpreply-mac " "\fIaddress\fP"
985Specifies the MAC address to reply with: the Ethernet source MAC and the
986ARP payload source MAC will be filled in with this address.
987.TP
988.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000989Specifies the standard target. After sending the ARP reply, the rule still
990has to give a standard target so ebtables knows what to do with the ARP request.
991The default target
992.BR "" "is " DROP .
Bart De Schuymer4cd1da62006-01-23 19:51:30 +0000993.SS dnat
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000994The
995.B dnat
996target can only be used in the
997.BR BROUTING " chain of the " broute " table and the "
998.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000999It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001000.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001001.BR "--to-destination " "\fIaddress\fP"
1002.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001003Change the destination MAC address to the specified
1004.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001005The flag
1006.B --to-dst
1007is an alias for this option.
1008.TP
1009.BR "--dnat-target " "\fItarget\fP"
1010.br
1011Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001012give a standard target so ebtables knows what to do with the dnated frame.
1013The default target is
1014.BR ACCEPT .
1015Making it
1016.BR CONTINUE " could let you use"
1017multiple target extensions on the same frame. Making it
1018.BR DROP " only makes"
1019sense in the
1020.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
1021in a base chain is not allowed (for obvious reasons).
Bart De Schuymer4cd1da62006-01-23 19:51:30 +00001022.SS mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001023.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001024to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001025if the bridge-nf code is compiled into the kernel. Both put the marking at the
1026same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001027.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +00001028.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001029.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001030Mark the frame with the specified non-negative
1031.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001032.TP
Bart De Schuymer45462702006-10-03 10:04:46 +00001033.BR "--mark-or " "\fIvalue\fP"
1034.br
1035Or the frame with the specified non-negative
1036.IR value .
1037.TP
1038.BR "--mark-and " "\fIvalue\fP"
1039.br
1040And the frame with the specified non-negative
1041.IR value .
1042.TP
1043.BR "--mark-xor " "\fIvalue\fP"
1044.br
1045Xor the frame with the specified non-negative
1046.IR value .
1047.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001048.BR "--mark-target " "\fItarget\fP"
1049.br
1050Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001051still has to give a standard target so ebtables knows what to do.
1052The default target is
1053.BR ACCEPT ". Making it " CONTINUE " can let you do other"
1054things with the frame in subsequent rules of the chain.
Bart De Schuymer4cd1da62006-01-23 19:51:30 +00001055.SS redirect
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001056The
1057.B redirect
1058target will change the MAC target address to that of the bridge device the
1059frame arrived on. This target can only be used in the
1060.BR BROUTING " chain of the " broute " table and the "
1061.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001062In the
1063.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
1064.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001065.TP
1066.BR "--redirect-target " "\fItarget\fP"
1067.br
1068Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001069still has to give a standard target so ebtables knows what to do.
1070The default target is
1071.BR ACCEPT ". Making it " CONTINUE " could let you use"
1072multiple target extensions on the same frame. Making it
1073.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
1074.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer4cd1da62006-01-23 19:51:30 +00001075.SS snat
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001076The
1077.B snat
1078target can only be used in the
1079.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001080It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001081.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001082.BR "--to-source " "\fIaddress\fP"
1083.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001084Changes the source MAC address to the specified
1085.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001086.B --to-src
1087is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001088.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001089.BR "--snat-target " "\fItarget\fP"
1090.br
1091Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001092to give a standard target so ebtables knows what to do.
1093.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
1094.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
1095.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
1096.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +00001097.br
Bart De Schuymer592d5652006-12-15 11:36:30 +00001098.TP
1099.BR "--snat-arp "
1100.br
1101Also change the hardware source address inside the arp header if the packet is an
1102arp message and the hardware address length in the arp header is 6 bytes.
1103.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001104.SH FILES
1105.I /etc/ethertypes
Bart De Schuymerb102e882011-07-10 09:05:10 +00001106.I $(LOCKFILE)
Bart De Schuymereecff422002-12-03 20:50:30 +00001107.SH ENVIRONMENT VARIABLES
1108.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001109.SH MAILINGLISTS
Bart De Schuymer614ec3e2010-12-18 15:47:34 +00001110.BR "" "See " http://netfilter.org/mailinglists.html
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001111.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001112.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)
Bart De Schuymer614ec3e2010-12-18 15:47:34 +00001113.PP
1114.BR "" "See " http://ebtables.sf.net