blob: 7d8671f60e65dad15ec2bbaedd8e6209ae5dbfdf [file] [log] [blame]
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001.TH EBTABLES 8 "December 21, 2004"
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 Schuymer6622a012005-01-19 21:09:05 +000027ebtables (v.2.0.7), ebtablesd, ebtablesu \- Ethernet bridge frame table administration
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028.SH SYNOPSIS
Bart De Schuymer6622a012005-01-19 21:09:05 +000029.BR "ebtables " [ -t " table ] " - [ ADI "] 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
53.BR "ebtablesu open " table
54.br
55.BR "ebtablesu fopen " "table file"
56.br
57.BR "ebtablesu free " table
58.br
59.BR "ebtablesu commit " table
60.br
61.BR "ebtablesu fcommit " "table file"
62.br
63.B ebtablesu quit
Bart De Schuymer234bce92002-07-14 21:25:08 +000064.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000065.SH DESCRIPTION
66.B ebtables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000067is an application program used to set up and maintain the
68tables of rules (inside the Linux kernel) that inspect
69Ethernet frames.
70It is analogous to the
Bart De Schuymer7085d662003-02-25 22:33:28 +000071.B iptables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000072application, but less complicated, due to the fact that the Ethernet protocol
73is much simpler than the IP protocol.
Bart De Schuymer6622a012005-01-19 21:09:05 +000074.br
75.BR ebtablesu " and " ebtablesd " can be used to speed up adding rules using a script when the"
76.B --atomic-commit
77option is not satisfactory. The
78.BR open " command makes ebtablesd open the specified kernel table for processing"
79.BR "" "in userspace (multiple tables can be open in the same time). The " fopen
80command opens the table from the specified file.
81.BR "" "The " free " command removes the specified table out of the memory of ebtablesd."
82No data is written to a file or to the kernel.
83.BR "" "The " commit " command stores the table from the memory of ebtablesd to the kernel."
84.BR "" "The " fcommit " command stores the table from the memory of ebtablesd to the specified file."
85This file can be read later, e.g. with
86.BR "ebtables --atomic-file " file " -L" .
87.BR "" "The " quit " command lets ebtablesd finish gracefully."
88All commands, options and extensions that ebtables uses can be used with ebtablesu, except for
89.BR --init-table ", " --atomic-file ", " --atomic-commit ", " --atomic-init ", " --atomic-save " and " -h .
90.br
91Example usage:
92.br
93# ebtablesd&
94.br
95# ebtablesu open filter
96.br
97# ebtablesu -A FORWARD -j DROP
98.br
99# ebtablesu commit filter
100.br
101# ebtablesu quit
102.br
103Alternatively, the commands can be echo'ed directly to the pipe used by ebtablesd,
104which has default location /tmp/ebtables-vx.y.z/ebtablesd_pipe, where
105x.y.z is the ebtables version (e.g. 2.0.7). Using echo instead of ebtablesu is
106much faster because echo is a bash built-in command. Commands like cat can be used
107too, of course.
108.br
109Example usage:
110.br
111# (./ebtablesd&) ; PIPE=/tmp/ebtables-v2.0.7/ebtablesd_pipe ; sleep 1
112.br
113# echo "ebtablesu open filter" >> $PIPE
114.br
115# echo "ebtablesu -A FORWARD -j DROP" >> $PIPE
116.br
117# echo "ebtablesu commit filter" >> $PIPE
118.br
119# echo "ebtablesu quit" >> $PIPE
Bart De Schuymer7085d662003-02-25 22:33:28 +0000120.SS CHAINS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000121There are three ebtables tables with built-in chains in the
122Linux kernel. These tables are used to divide functionality into
Bart De Schuymer7085d662003-02-25 22:33:28 +0000123different sets of rules. Each set of rules is called a chain.
124Each chain is an ordered list of rules that can match Ethernet frames. If a
125rule matches an Ethernet frame, then a processing specification tells
126what to do with that matching frame. The processing specification is
127called a 'target'. However, if the frame does not match the current
128rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000129The user can create new (user-defined) chains that can be used as the 'target'
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000130of a rule. User-defined chains are very useful to get better performance
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000131over the linear traversal of the rules and are also essential for structuring
132the filtering rules into well-organized and maintainable sets of rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000133.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000134A firewall rule specifies criteria for an Ethernet frame and a frame
135processing specification called a target. When a frame matches a rule,
136then the next action performed by the kernel is specified by the target.
137The target can be one of these values:
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000138.BR ACCEPT ,
139.BR DROP ,
140.BR CONTINUE ,
141.BR RETURN ,
142an 'extension' (see below) or a jump to a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000143.PP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000144.B ACCEPT
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000145means to let the frame through.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000146.B DROP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000147means the frame has to be dropped.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000148.B CONTINUE
149means the next rule has to be checked. This can be handy, f.e., to know how many
150frames pass a certain point in the chain, to log those frames or to apply multiple
151targets on a frame.
152.B RETURN
Bart De Schuymer29749c62002-06-25 21:27:57 +0000153means stop traversing this chain and resume at the next rule in the
154previous (calling) chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000155For the extension targets please refer to the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000156.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000157section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000158.SS TABLES
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000159As stated earlier, there are three ebtables tables in the Linux
160kernel. The table names are
Bart De Schuymer7085d662003-02-25 22:33:28 +0000161.BR filter ", " nat " and " broute .
162Of these three tables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000163the filter table is the default table that the command operates on.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000164If you are working with the filter table, then you can drop the '-t filter'
165argument to the ebtables command. However, you will need to provide
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000166the -t argument for the other two tables. Moreover, the -t argument must be the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000167first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000168.TP
169.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000170.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000171.B filter
Bart De Schuymer7085d662003-02-25 22:33:28 +0000172is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000173.B INPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000174(for frames destined for the bridge itself, on the level of the MAC destination address),
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000175.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000176(for locally-generated or (b)routed frames) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000177.B FORWARD
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000178(for frames being forwarded by the bridge).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000179.br
180.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000181.B nat
182is mostly used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000183.B PREROUTING
184(for altering frames as soon as they come in),
185.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000186(for altering locally generated or (b)routed frames before they are bridged) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000187.B POSTROUTING
188(for altering frames as they are about to go out). A small note on the naming
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000189of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000190PREFORWARDING and POSTFORWARDING, but for all those who come from the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000191iptables world to ebtables it is easier to have the same names. Note that you
192can change the name
193.BR "" ( -E )
194if you don't like the default.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000195.br
196.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000197.B broute
Bart De Schuymer7085d662003-02-25 22:33:28 +0000198is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000199.BR BROUTING .
200The targets
201.BR DROP " and " ACCEPT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000202have a special meaning in the broute table (these names are used instead of
203more descriptive names to keep the implementation generic).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000204.B DROP
205actually means the frame has to be routed, while
206.B ACCEPT
207means the frame has to be bridged. The
208.B BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000209chain is traversed very early. However, it is only traversed by frames entering on
210a bridge port that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000211would be bridged, but you can decide otherwise here. The
212.B redirect
213target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000214.SH EBTABLES COMMAND LINE ARGUMENTS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000215After the initial ebtables '-t table' command line argument, the remaining
216arguments can be divided into several groups. These groups
217are commands, miscellaneous commands, rule specifications, match extensions,
218watcher extensions and target extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000219.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000220The ebtables command arguments specify the actions to perform on the table
221defined with the -t argument. If you do not use the -t argument to name
222a table, the commands apply to the default filter table.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000223Only one command may be used on the command line at a time, except when
224the commands
225.BR -L " and " -Z
226are combined, the commands
227.BR -N " and " -P
228are combined, or when
229.B --atomic-file
230is used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000231.TP
232.B "-A, --append"
233Append a rule to the end of the selected chain.
234.TP
235.B "-D, --delete"
Bart De Schuymerabc84172002-11-06 21:02:33 +0000236Delete the specified rule from the selected chain. There are two ways to
237use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000238to delete (directly after
239.BR -D ).
240Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
241.B -L --Ln
242to list the rules with their rule number). When \fI:end_nr\fP is omitted, all rules starting
243from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
244details about using negative numbers, see the
245.B -I
246command. The second usage is by
247specifying the complete rule as it would have been specified when it was added. Only
248the first encountered rule that is the same as this specified rule, in other
249words the matching rule with the lowest rule number, is deleted.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000250.TP
251.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000252Insert the specified rule into the selected chain at the specified rule number.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000253If the current number of rules equals
254.IR N ,
255then the specified number can be
256between
257.IR -N " and " N+1 .
258For a positive number
259.IR i ,
260it holds that
261.IR i " and " i-N-1
262specify the same place in the chain where the rule should be inserted. The rule number
2630 specifies the place past the last rule in the chain and using this number is therefore
264equivalent to using the
265.BR -A " command."
266Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
267in a chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000268.TP
269.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000270Set the policy for the chain to the given target. The policy can be
271.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000272.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000273.B "-F, --flush"
274Flush the selected chain. If no chain is selected, then every chain will be
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000275flushed. Flushing a chain does not change the policy of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000276chain, however.
277.TP
278.B "-Z, --zero"
279Set the counters of the selected chain to zero. If no chain is selected, all the counters
280are set to zero. The
281.B "-Z"
282command can be used in conjunction with the
283.B "-L"
284command.
285When both the
286.B "-Z"
287and
288.B "-L"
289commands are used together in this way, the rule counters are printed on the screen
290before they are set to zero.
291.TP
292.B "-L, --list"
293List all rules in the selected chain. If no chain is selected, all chains
294are listed.
295.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000296The following options change the output of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000297.B "-L"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000298command.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000299.br
300.B "--Ln"
301.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000302Places the rule number in front of every rule. This option is incompatible with the
303.BR --Lx " option."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000304.br
305.B "--Lc"
306.br
307Shows the counters at the end of each rule displayed by the
308.B "-L"
309command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000310The frame counter shows how many frames have matched the specific rule, the byte
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000311counter shows the sum of the frame sizes of these matching frames. Using this option
312.BR "" "in combination with the " --Lx " option causes the counters to be written out"
313.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000314.br
315.B "--Lx"
316.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000317Changes the output so that it produces a set of ebtables commands that construct
318the contents of the chain, when specified.
319If no chain is specified, ebtables commands to construct the contents of the
320table are given, including commands for creating the user-defined chains (if any).
321You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000322script. For example the output could be used at system startup.
323The
324.B "--Lx"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000325option is incompatible with the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326.B "--Ln"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000327listing option. Using the
328.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
329.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000330.br
331.B "--Lmac2"
332.br
333Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000334if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000335.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000336.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000337Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000338user-defined chains is limited only by the number of possible chain names.
339A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000340length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000341ACCEPT. The policy of the new chain can be initialized to a different standard
342target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000343.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000344command together with the
345.B -N
346command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000347.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000348command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000349.TP
350.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000351Delete the specified user-defined chain. There must be no remaining references (jumps)
352to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
353specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000354.TP
355.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000356Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000357chain, you can rename a standard chain to a name that suits your
358taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000359then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000360rename one of the standard ebtables chain names, please be sure to mention
361this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000362It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000363ebtables chain in this fashion has no effect on the structure or functioning
364of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000365.TP
366.B "--init-table"
367Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000368.TP
369.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000370Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000371file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000372to the file. The file can be specified using the
373.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000374command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000375.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000376.TP
377.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000378Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000379file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000380to the file. The file can be specified using the
381.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000382command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000383.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000384.TP
385.B "--atomic-commit"
386Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000387file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000388certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000389time and allowing atomic updates of the tables. The file which contains
390the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000391.B "--atomic-init"
392or the
393.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000394command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000395.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000396command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000397.IR EBTABLES_ATOMIC_FILE " environment variable"
398allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000399committing it to the kernel. This command can be very useful in boot scripts
400to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000401.SS MISCELLANOUS COMMANDS
402.TP
403.B "-V, --version"
404Show the version of the ebtables userspace program.
405.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000406.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000407Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000408names of extensions and ebtables will try to write help about those
409extensions. E.g.
410.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000411Specify
412.I list_extensions
413to list all extensions supported by the userspace
414utility.
415.TP
416.BR "-j, --jump " "\fItarget\fP"
417The target of the rule. This is one of the following values:
418.BR ACCEPT ,
419.BR DROP ,
420.BR CONTINUE ,
421.BR RETURN ,
422a target extension (see
423.BR "TARGET EXTENSIONS" ")"
424or a user-defined chain name.
425.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000426.B --atomic-file "\fIfile\fP"
427Let the command operate on the specified
428.IR file .
429The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000430operate on will be extracted from the file and the result of the operation
431will be saved back into the file. If specified, this option should come
432before the command specification. An alternative that should be preferred,
433is setting the
434.IR EBTABLES_ATOMIC_FILE " environment variable."
435.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000436.B -M, --modprobe "\fIprogram\fP"
437When talking to the kernel, use this
438.I program
439to try to automatically load missing kernel modules.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000440
Bart De Schuymer29749c62002-06-25 21:27:57 +0000441.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000442RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000443The following command line arguments make up a rule specification (as used
444in the add and delete commands). A "!" option before the specification
445inverts the test for that specification. Apart from these standard rule
446specifications there are some other command line arguments of interest.
447See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000448.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000449and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000450.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000451below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000452.TP
453.BR "-p, --protocol " "[!] \fIprotocol\fP"
454The protocol that was responsible for creating the frame. This can be a
455hexadecimal number, above
456.IR 0x0600 ,
457a name (e.g.
458.I ARP
459) or
460.BR LENGTH .
461The protocol field of the Ethernet frame can be used to denote the
462length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000463below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000464.IR 0x0600 ,
465the value equals the size of the header and shouldn't be used as a
466protocol number. Instead, all frames where the protocol field is used as
467the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000468name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000469.BR LENGTH .
470.br
471The file
472.B /etc/ethertypes
473can be used to show readable
474characters instead of hexadecimal numbers for the protocols. For example,
475.I 0x0800
476will be represented by
477.IR IPV4 .
478The use of this file is not case sensitive.
479See that file for more information. The flag
480.B --proto
481is an alias for this option.
482.TP
483.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000484The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000485.BR INPUT ,
486.BR FORWARD ,
487.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000488chains). If the interface name ends with '+', then
489any interface name that begins with this name (disregarding '+') will match.
490The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000491.B --in-if
492is an alias for this option.
493.TP
494.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000495The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000496.BR INPUT ,
497.BR FORWARD ,
498.BR PREROUTING " and " BROUTING
499chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000500If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000501any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000502.TP
503.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000504The 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 +0000505.BR OUTPUT ,
506.B FORWARD
507and
508.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000509chains). If the interface name ends with '+', then
510any interface name that begins with this name (disregarding '+') will match.
511The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000512.B --out-if
513is an alias for this option.
514.TP
515.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000516The (logical) bridge interface via which a frame is going to be sent (this option
517is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000518.BR OUTPUT ,
519.B FORWARD
520and
521.B POSTROUTING
522chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000523If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000524any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000525.TP
526.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000527The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000528numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000529Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000530.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000531.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
532.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
533.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
534.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000535Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000536address will also match the multicast specification. The flag
537.B --src
538is an alias for this option.
539.TP
540.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000541The destination MAC address. See
542.B -s
543(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000544.B --dst
545is an alias for this option.
546
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000547.SS MATCH EXTENSIONS
548Ebtables extensions are dynamically loaded into the userspace tool,
549there is therefore no need to explicitly load them with a
550-m option like is done in iptables.
551These extensions deal with functionality supported by kernel modules supplemental to
552the core ebtables code.
553.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000554Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000555.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000556.TP
557.BR "--802_3-sap " "[!] \fIsap\fP"
558DSAP and SSAP are two one byte 802.3 fields. The bytes are always
559equal, so only one byte (hexadecimal) is needed as an argument.
560.TP
561.BR "--802_3-type " "[!] \fItype\fP"
562If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
563be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000564(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000565checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000566.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000567Match a MAC address or MAC/IP address pair versus a list of MAC addresses
568and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000569A list entry has the following format:
570.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000571list entries are separated by a comma, specifying an IP address corresponding to
572the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
573but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000574match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000575.TP
576.BR "--among-dst " "[!] \fIlist\fP"
577Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000578.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000579then comparison with MAC/IP destination address pairs from the
580list is possible.
581.TP
582.BR "--among-src " "[!] \fIlist\fP"
583Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000584.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000585then comparison with MAC/IP source address pairs from the list
586is possible.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000587.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000588Specify (R)ARP fields. The protocol must be specified as
589.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000590.TP
591.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000592The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000593.BR "ebtables -h arp" ).
594.TP
595.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000596The hardware type, this can be a decimal or the string
597.I Ethernet
598(which sets
599.I type
600to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000601.TP
602.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000603The protocol type for which the (r)arp is used (hexadecimal or the string
604.IR IPv4 ,
605denoting 0x0800).
606Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000607.TP
608.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000609The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000610.TP
611.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000612The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000613.TP
614.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000615The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000616.TP
617.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000618The (R)ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000619.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000620Specify IPv4 fields. The protocol must be specified as
621.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000622.TP
623.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000624The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000625The flag
626.B --ip-src
627is an alias for this option.
628.TP
629.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000630The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000631The flag
632.B --ip-dst
633is an alias for this option.
634.TP
635.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000636The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000637.BR IPv4 .
638.TP
639.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000640The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000641The flag
642.B --ip-proto
643is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000644.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000645.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
646The source port or port range for the IP protocols 6 (TCP) and 17
647(UDP). The
648.B --ip-protocol
649option must be specified as
650.IR TCP " or " UDP .
651If
652.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
653The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000654.B --ip-sport
655is an alias for this option.
656.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000657.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000658The destination port or port range for ip protocols 6 (TCP) and
Bart De Schuymer00bbac82004-12-21 20:29:12 +000065917 (UDP). The
660.B --ip-protocol
661option must be specified as
662.IR TCP " or " UDP .
663If
664.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
665The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000666.B --ip-dport
667is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000668.SS limit
669This module matches at a limited rate using a token bucket filter.
670A rule using this extension will match until this limit is reached.
671It can be used with the
672.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000673watcher to give limited logging, for example. Its use is the same
674as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000675.TP
676.BR "--limit " "[\fIvalue\fP]"
677Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000678.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000679.TP
680.BR "--limit-burst " "[\fInumber\fP]"
681Maximum initial number of packets to match: this number gets recharged by
682one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000683number; the default is
684.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000685.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000686.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000687.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000688Matches frames with the given unsigned mark value. If a
689.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
690the user-specified
691.IR mask " is taken before comparing it with the"
692user-specified mark
693.IR value ". When only a mark "
694.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000695only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000696mark
697.IR value .
698If only a
699.IR mask " is specified, the logical"
700AND of the mark value of the frame and the user-specified
701.IR mask " is taken and the frame matches when the result of this logical AND is"
702non-zero. Only specifying a
703.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000704.SS pkttype
705.TP
706.BR "--pkttype-type " "[!] \fItype\fP"
707Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000708generic networking code. Possible values:
709.IR broadcast " (MAC destination is the broadcast address),"
710.IR multicast " (MAC destination is a multicast address),"
711.IR host " (MAC destination is the receiving network device), or "
712.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000713.SS stp
714Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000715address
716.BR "" ( -d ") must be specified as the bridge group address"
717.IR "" ( BGA ).
718For all options for which a range of values can be specified, it holds that
719if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
720for that option is used, while if the upper bound is omitted (but the colon again is not), the
721highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000722.TP
723.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000724The BPDU type (0-255), recognized non-numerical types are
725.IR config ", denoting a configuration BPDU (=0), and"
726.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000727.TP
728.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000729The BPDU flag (0-255), recognized non-numerical flags are
730.IR topology-change ", denoting the topology change flag (=1), and"
731.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000732.TP
733.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
734The root priority (0-65535) range.
735.TP
736.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
737The root mac address, see the option
738.BR -s " for more details."
739.TP
740.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
741The root path cost (0-4294967295) range.
742.TP
743.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
744The BPDU's sender priority (0-65535) range.
745.TP
746.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
747The BPDU's sender mac address, see the option
748.BR -s " for more details."
749.TP
750.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
751The port identifier (0-65535) range.
752.TP
753.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
754The message age timer (0-65535) range.
755.TP
756.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
757The max age timer (0-65535) range.
758.TP
759.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
760The hello time timer (0-65535) range.
761.TP
762.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
763The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000764.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000765Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000766The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000767.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000768.TP
769.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000770The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000771.TP
772.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000773The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000774The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000775(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000776.TP
fnm3ed7e9012002-06-25 16:43:23 +0000777.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000778The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000779Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000780number from 0x0000 to 0xFFFF or as a symbolic name
781from
782.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000783
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000784.SS WATCHER EXTENSIONS
785Watchers only look at frames passing by, they don't modify them nor decide
786to accept the frames or not. These watchers only
787see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000788target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000789.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000790The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000791.TP
792.B "--log"
793.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000794Log with the default loggin options: log-level=
795.IR info ,
796log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000797.TP
798.B --log-level "\fIlevel\fP"
799.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000800Defines the logging level. For the possible values, see
801.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000802The default level is
803.IR info .
804.TP
805.BR --log-prefix " \fItext\fP"
806.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000807Defines the prefix
808.I text
809to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000810.TP
811.B --log-ip
812.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000813Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000814the rule. The default is no ip information logging.
815.TP
816.B --log-arp
817.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000818Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000819matches the rule. The default is no (r)arp information logging.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000820.SS ulog
821The ulog watcher passes the packet to a userspace
822logging daemon using netlink multicast sockets. This differs
823from the log watcher in the sense that the complete packet is
824sent to userspace instead of a descriptive text and that
825netlink multicast sockets are used instead of the syslog.
826This watcher enables parsing of packets with userspace programs, the
827physical bridge in and out ports are also included in the netlink messages.
828The ulog watcher module accepts 2 parameters when the module is loaded
829into the kernel (e.g. with modprobe):
830.B nlbufsiz
831specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000832group is. If you say
833.IR nlbufsiz=8192 ,
834for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000835get accumulated in the kernel until they are sent to userspace. It is
836not possible to allocate more than 128kB. Please also keep in mind that
837this buffer size is allocated for each nlgroup you are using, so the
838total kernel memory usage increases by that factor. The default is 4096.
839.B flushtimeout
840specifies after how many hundredths of a second the queue should be
841flushed, even if it is not full yet. The default is 10 (one tenth of
842a second).
843.TP
844.B "--ulog"
845.br
846Use the default settings: ulog-prefix="", ulog-nlgroup=1,
847ulog-cprange=4096, ulog-qthreshold=1.
848.TP
849.B --ulog-prefix "\fItext\fP"
850.br
851Defines the prefix included with the packets sent to userspace.
852.TP
853.BR --ulog-nlgroup " \fIgroup\fP"
854.br
855Defines which netlink group number to use (a number from 1 to 32).
856Make sure the netlink group numbers used for the iptables ULOG
857target differ from those used for the ebtables ulog watcher.
858The default group number is 1.
859.TP
860.BR --ulog-cprange " \fIrange\fP"
861.br
862Defines the maximum copy range to userspace, for packets matching the
863rule. The default range is 0, which means the maximum copy range is
864given by
865.BR nlbufsiz .
866A maximum copy range larger than
867128*1024 is meaningless as the packets sent to userspace have an upper
868size limit of 128*1024.
869.TP
870.BR --ulog-qthreshold " \fIthreshold\fP"
871.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000872Queue at most
873.I threshold
874number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000875userspace with a netlink socket. Note that packets can be sent to
876userspace before the queue is full, this happens when the ulog
877kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000878.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000879.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000880.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000881.B arpreply
882The
883.B arpreply
884target can be used in the
885.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000886If this target sees an ARP request it will automatically reply
887with an ARP reply. The used MAC address for the reply can be specified.
888The protocol must be specified as
889.IR ARP .
890When the ARP message is not an ARP request or when the ARP request isn't
891for an IP address on an Ethernet network, it is ignored by this target
892.BR "" ( CONTINUE ).
893When the ARP request is malformed, it is dropped
894.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000895.TP
896.BR "--arpreply-mac " "\fIaddress\fP"
897Specifies the MAC address to reply with: the Ethernet source MAC and the
898ARP payload source MAC will be filled in with this address.
899.TP
900.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000901Specifies the standard target. After sending the ARP reply, the rule still
902has to give a standard target so ebtables knows what to do with the ARP request.
903The default target
904.BR "" "is " DROP .
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000905.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000906.B dnat
907The
908.B dnat
909target can only be used in the
910.BR BROUTING " chain of the " broute " table and the "
911.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000912It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000913.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000914.BR "--to-destination " "\fIaddress\fP"
915.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000916Change the destination MAC address to the specified
917.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000918The flag
919.B --to-dst
920is an alias for this option.
921.TP
922.BR "--dnat-target " "\fItarget\fP"
923.br
924Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000925give a standard target so ebtables knows what to do with the dnated frame.
926The default target is
927.BR ACCEPT .
928Making it
929.BR CONTINUE " could let you use"
930multiple target extensions on the same frame. Making it
931.BR DROP " only makes"
932sense in the
933.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
934in a base chain is not allowed (for obvious reasons).
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000935.SS
936.B mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000937.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000938to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000939if the bridge-nf code is compiled into the kernel. Both put the marking at the
940same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000941.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000942.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000943.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000944Mark the frame with the specified non-negative
945.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000946.TP
947.BR "--mark-target " "\fItarget\fP"
948.br
949Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000950still has to give a standard target so ebtables knows what to do.
951The default target is
952.BR ACCEPT ". Making it " CONTINUE " can let you do other"
953things with the frame in subsequent rules of the chain.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000954.SS
955.B redirect
956The
957.B redirect
958target will change the MAC target address to that of the bridge device the
959frame arrived on. This target can only be used in the
960.BR BROUTING " chain of the " broute " table and the "
961.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000962In the
963.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
964.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000965.TP
966.BR "--redirect-target " "\fItarget\fP"
967.br
968Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000969still has to give a standard target so ebtables knows what to do.
970The default target is
971.BR ACCEPT ". Making it " CONTINUE " could let you use"
972multiple target extensions on the same frame. Making it
973.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
974.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000975.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000976.B snat
977The
978.B snat
979target can only be used in the
980.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000981It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000982.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000983.BR "--to-source " "\fIaddress\fP"
984.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000985Changes the source MAC address to the specified
986.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000987.B --to-src
988is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000989.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000990.BR "--snat-target " "\fItarget\fP"
991.br
992Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000993to give a standard target so ebtables knows what to do.
994.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
995.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
996.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
997.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000998.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000999.SH FILES
1000.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +00001001.SH ENVIRONMENT VARIABLES
1002.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001003.SH MAILINGLISTS
1004.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +00001005.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001006.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001007.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001008.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)