blob: 1dc8cd54bb2206e41bd9665fd27fd8da8889efd7 [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 Schuymer6622a012005-01-19 21:09:05 +000037.BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [ [" --Ln "] [" --Lc "] ] | [" --Lx "] ] [" --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
302Places the rule number in front of every rule.
303.br
304.B "--Lc"
305.br
306Shows the counters at the end of each rule displayed by the
307.B "-L"
308command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000309The frame counter shows how many frames have matched the specific rule, the byte
310counter shows the sum of the frame sizes of these matching frames.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000311.br
312.B "--Lx"
313.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000314Changes the output so that it produces a set of ebtables commands that construct
315the contents of the chain, when specified.
316If no chain is specified, ebtables commands to construct the contents of the
317table are given, including commands for creating the user-defined chains (if any).
318You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000319script. For example the output could be used at system startup.
320The
321.B "--Lx"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000322option is incompatible with both the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000323.B "--Ln"
324and
325.B "--Lc"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000326listing options.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000327.br
328.B "--Lmac2"
329.br
330Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000331if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000332.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000333.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000334Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000335user-defined chains is limited only by the number of possible chain names.
336A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000337length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000338ACCEPT. The policy of the new chain can be initialized to a different standard
339target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000340.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000341command together with the
342.B -N
343command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000344.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000345command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000346.TP
347.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000348Delete the specified user-defined chain. There must be no remaining references (jumps)
349to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
350specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000351.TP
352.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000353Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000354chain, you can rename a standard chain to a name that suits your
355taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000356then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000357rename one of the standard ebtables chain names, please be sure to mention
358this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000359It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000360ebtables chain in this fashion has no effect on the structure or functioning
361of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000362.TP
363.B "--init-table"
364Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000365.TP
366.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000367Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000368file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000369to the file. The file can be specified using the
370.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000371command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000372.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000373.TP
374.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000375Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000376file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000377to the file. The file can be specified using the
378.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000379command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000380.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000381.TP
382.B "--atomic-commit"
383Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000384file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000385certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000386time and allowing atomic updates of the tables. The file which contains
387the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000388.B "--atomic-init"
389or the
390.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000391command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000392.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000393command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000394.IR EBTABLES_ATOMIC_FILE " environment variable"
395allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000396committing it to the kernel. This command can be very useful in boot scripts
397to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000398.SS MISCELLANOUS COMMANDS
399.TP
400.B "-V, --version"
401Show the version of the ebtables userspace program.
402.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000403.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000404Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000405names of extensions and ebtables will try to write help about those
406extensions. E.g.
407.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000408Specify
409.I list_extensions
410to list all extensions supported by the userspace
411utility.
412.TP
413.BR "-j, --jump " "\fItarget\fP"
414The target of the rule. This is one of the following values:
415.BR ACCEPT ,
416.BR DROP ,
417.BR CONTINUE ,
418.BR RETURN ,
419a target extension (see
420.BR "TARGET EXTENSIONS" ")"
421or a user-defined chain name.
422.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000423.B --atomic-file "\fIfile\fP"
424Let the command operate on the specified
425.IR file .
426The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000427operate on will be extracted from the file and the result of the operation
428will be saved back into the file. If specified, this option should come
429before the command specification. An alternative that should be preferred,
430is setting the
431.IR EBTABLES_ATOMIC_FILE " environment variable."
432.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000433.B -M, --modprobe "\fIprogram\fP"
434When talking to the kernel, use this
435.I program
436to try to automatically load missing kernel modules.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000437
Bart De Schuymer29749c62002-06-25 21:27:57 +0000438.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000439RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000440The following command line arguments make up a rule specification (as used
441in the add and delete commands). A "!" option before the specification
442inverts the test for that specification. Apart from these standard rule
443specifications there are some other command line arguments of interest.
444See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000445.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000446and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000447.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000448below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000449.TP
450.BR "-p, --protocol " "[!] \fIprotocol\fP"
451The protocol that was responsible for creating the frame. This can be a
452hexadecimal number, above
453.IR 0x0600 ,
454a name (e.g.
455.I ARP
456) or
457.BR LENGTH .
458The protocol field of the Ethernet frame can be used to denote the
459length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000460below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000461.IR 0x0600 ,
462the value equals the size of the header and shouldn't be used as a
463protocol number. Instead, all frames where the protocol field is used as
464the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000465name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000466.BR LENGTH .
467.br
468The file
469.B /etc/ethertypes
470can be used to show readable
471characters instead of hexadecimal numbers for the protocols. For example,
472.I 0x0800
473will be represented by
474.IR IPV4 .
475The use of this file is not case sensitive.
476See that file for more information. The flag
477.B --proto
478is an alias for this option.
479.TP
480.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000481The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000482.BR INPUT ,
483.BR FORWARD ,
484.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000485chains). If the interface name ends with '+', then
486any interface name that begins with this name (disregarding '+') will match.
487The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000488.B --in-if
489is an alias for this option.
490.TP
491.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000492The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000493.BR INPUT ,
494.BR FORWARD ,
495.BR PREROUTING " and " BROUTING
496chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000497If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000498any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000499.TP
500.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000501The 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 +0000502.BR OUTPUT ,
503.B FORWARD
504and
505.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000506chains). If the interface name ends with '+', then
507any interface name that begins with this name (disregarding '+') will match.
508The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000509.B --out-if
510is an alias for this option.
511.TP
512.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000513The (logical) bridge interface via which a frame is going to be sent (this option
514is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000515.BR OUTPUT ,
516.B FORWARD
517and
518.B POSTROUTING
519chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000520If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000521any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000522.TP
523.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000524The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000525numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000526Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000527.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000528.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
529.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
530.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
531.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000532Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000533address will also match the multicast specification. The flag
534.B --src
535is an alias for this option.
536.TP
537.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000538The destination MAC address. See
539.B -s
540(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000541.B --dst
542is an alias for this option.
543
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000544.SS MATCH EXTENSIONS
545Ebtables extensions are dynamically loaded into the userspace tool,
546there is therefore no need to explicitly load them with a
547-m option like is done in iptables.
548These extensions deal with functionality supported by kernel modules supplemental to
549the core ebtables code.
550.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000551Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000552.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000553.TP
554.BR "--802_3-sap " "[!] \fIsap\fP"
555DSAP and SSAP are two one byte 802.3 fields. The bytes are always
556equal, so only one byte (hexadecimal) is needed as an argument.
557.TP
558.BR "--802_3-type " "[!] \fItype\fP"
559If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
560be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000561(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000562checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000563.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000564Match a MAC address or MAC/IP address pair versus a list of MAC addresses
565and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000566A list entry has the following format:
567.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000568list entries are separated by a comma, specifying an IP address corresponding to
569the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
570but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000571match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000572.TP
573.BR "--among-dst " "[!] \fIlist\fP"
574Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000575.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000576then comparison with MAC/IP destination address pairs from the
577list is possible.
578.TP
579.BR "--among-src " "[!] \fIlist\fP"
580Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000581.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000582then comparison with MAC/IP source address pairs from the list
583is possible.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000584.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000585Specify (R)ARP fields. The protocol must be specified as
586.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000587.TP
588.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000589The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000590.BR "ebtables -h arp" ).
591.TP
592.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000593The hardware type, this can be a decimal or the string
594.I Ethernet
595(which sets
596.I type
597to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000598.TP
599.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000600The protocol type for which the (r)arp is used (hexadecimal or the string
601.IR IPv4 ,
602denoting 0x0800).
603Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000604.TP
605.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000606The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000607.TP
608.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000609The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000610.TP
611.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000612The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000613.TP
614.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000615The (R)ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000616.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000617Specify IPv4 fields. The protocol must be specified as
618.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000619.TP
620.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000621The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000622The flag
623.B --ip-src
624is an alias for this option.
625.TP
626.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000627The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000628The flag
629.B --ip-dst
630is an alias for this option.
631.TP
632.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000633The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000634.BR IPv4 .
635.TP
636.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000637The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000638The flag
639.B --ip-proto
640is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000641.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000642.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
643The source port or port range for the IP protocols 6 (TCP) and 17
644(UDP). The
645.B --ip-protocol
646option must be specified as
647.IR TCP " or " UDP .
648If
649.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
650The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000651.B --ip-sport
652is an alias for this option.
653.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000654.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000655The destination port or port range for ip protocols 6 (TCP) and
Bart De Schuymer00bbac82004-12-21 20:29:12 +000065617 (UDP). The
657.B --ip-protocol
658option must be specified as
659.IR TCP " or " UDP .
660If
661.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
662The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000663.B --ip-dport
664is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000665.SS limit
666This module matches at a limited rate using a token bucket filter.
667A rule using this extension will match until this limit is reached.
668It can be used with the
669.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000670watcher to give limited logging, for example. Its use is the same
671as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000672.TP
673.BR "--limit " "[\fIvalue\fP]"
674Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000675.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000676.TP
677.BR "--limit-burst " "[\fInumber\fP]"
678Maximum initial number of packets to match: this number gets recharged by
679one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000680number; the default is
681.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000682.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000683.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000684.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000685Matches frames with the given unsigned mark value. If a
686.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
687the user-specified
688.IR mask " is taken before comparing it with the"
689user-specified mark
690.IR value ". When only a mark "
691.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000692only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000693mark
694.IR value .
695If only a
696.IR mask " is specified, the logical"
697AND of the mark value of the frame and the user-specified
698.IR mask " is taken and the frame matches when the result of this logical AND is"
699non-zero. Only specifying a
700.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000701.SS pkttype
702.TP
703.BR "--pkttype-type " "[!] \fItype\fP"
704Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000705generic networking code. Possible values:
706.IR broadcast " (MAC destination is the broadcast address),"
707.IR multicast " (MAC destination is a multicast address),"
708.IR host " (MAC destination is the receiving network device), or "
709.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000710.SS stp
711Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000712address
713.BR "" ( -d ") must be specified as the bridge group address"
714.IR "" ( BGA ).
715For all options for which a range of values can be specified, it holds that
716if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
717for that option is used, while if the upper bound is omitted (but the colon again is not), the
718highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000719.TP
720.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000721The BPDU type (0-255), recognized non-numerical types are
722.IR config ", denoting a configuration BPDU (=0), and"
723.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000724.TP
725.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000726The BPDU flag (0-255), recognized non-numerical flags are
727.IR topology-change ", denoting the topology change flag (=1), and"
728.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000729.TP
730.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
731The root priority (0-65535) range.
732.TP
733.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
734The root mac address, see the option
735.BR -s " for more details."
736.TP
737.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
738The root path cost (0-4294967295) range.
739.TP
740.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
741The BPDU's sender priority (0-65535) range.
742.TP
743.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
744The BPDU's sender mac address, see the option
745.BR -s " for more details."
746.TP
747.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
748The port identifier (0-65535) range.
749.TP
750.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
751The message age timer (0-65535) range.
752.TP
753.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
754The max age timer (0-65535) range.
755.TP
756.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
757The hello time timer (0-65535) range.
758.TP
759.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
760The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000761.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000762Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000763The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000764.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000765.TP
766.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000767The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000768.TP
769.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000770The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000771The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000772(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000773.TP
fnm3ed7e9012002-06-25 16:43:23 +0000774.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000775The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000776Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000777number from 0x0000 to 0xFFFF or as a symbolic name
778from
779.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000780
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000781.SS WATCHER EXTENSIONS
782Watchers only look at frames passing by, they don't modify them nor decide
783to accept the frames or not. These watchers only
784see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000785target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000786.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000787The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000788.TP
789.B "--log"
790.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000791Log with the default loggin options: log-level=
792.IR info ,
793log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000794.TP
795.B --log-level "\fIlevel\fP"
796.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000797Defines the logging level. For the possible values, see
798.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000799The default level is
800.IR info .
801.TP
802.BR --log-prefix " \fItext\fP"
803.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000804Defines the prefix
805.I text
806to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000807.TP
808.B --log-ip
809.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000810Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000811the rule. The default is no ip information logging.
812.TP
813.B --log-arp
814.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000815Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000816matches the rule. The default is no (r)arp information logging.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000817.SS ulog
818The ulog watcher passes the packet to a userspace
819logging daemon using netlink multicast sockets. This differs
820from the log watcher in the sense that the complete packet is
821sent to userspace instead of a descriptive text and that
822netlink multicast sockets are used instead of the syslog.
823This watcher enables parsing of packets with userspace programs, the
824physical bridge in and out ports are also included in the netlink messages.
825The ulog watcher module accepts 2 parameters when the module is loaded
826into the kernel (e.g. with modprobe):
827.B nlbufsiz
828specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000829group is. If you say
830.IR nlbufsiz=8192 ,
831for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000832get accumulated in the kernel until they are sent to userspace. It is
833not possible to allocate more than 128kB. Please also keep in mind that
834this buffer size is allocated for each nlgroup you are using, so the
835total kernel memory usage increases by that factor. The default is 4096.
836.B flushtimeout
837specifies after how many hundredths of a second the queue should be
838flushed, even if it is not full yet. The default is 10 (one tenth of
839a second).
840.TP
841.B "--ulog"
842.br
843Use the default settings: ulog-prefix="", ulog-nlgroup=1,
844ulog-cprange=4096, ulog-qthreshold=1.
845.TP
846.B --ulog-prefix "\fItext\fP"
847.br
848Defines the prefix included with the packets sent to userspace.
849.TP
850.BR --ulog-nlgroup " \fIgroup\fP"
851.br
852Defines which netlink group number to use (a number from 1 to 32).
853Make sure the netlink group numbers used for the iptables ULOG
854target differ from those used for the ebtables ulog watcher.
855The default group number is 1.
856.TP
857.BR --ulog-cprange " \fIrange\fP"
858.br
859Defines the maximum copy range to userspace, for packets matching the
860rule. The default range is 0, which means the maximum copy range is
861given by
862.BR nlbufsiz .
863A maximum copy range larger than
864128*1024 is meaningless as the packets sent to userspace have an upper
865size limit of 128*1024.
866.TP
867.BR --ulog-qthreshold " \fIthreshold\fP"
868.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000869Queue at most
870.I threshold
871number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000872userspace with a netlink socket. Note that packets can be sent to
873userspace before the queue is full, this happens when the ulog
874kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000875.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000876.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000877.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000878.B arpreply
879The
880.B arpreply
881target can be used in the
882.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000883If this target sees an ARP request it will automatically reply
884with an ARP reply. The used MAC address for the reply can be specified.
885The protocol must be specified as
886.IR ARP .
887When the ARP message is not an ARP request or when the ARP request isn't
888for an IP address on an Ethernet network, it is ignored by this target
889.BR "" ( CONTINUE ).
890When the ARP request is malformed, it is dropped
891.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000892.TP
893.BR "--arpreply-mac " "\fIaddress\fP"
894Specifies the MAC address to reply with: the Ethernet source MAC and the
895ARP payload source MAC will be filled in with this address.
896.TP
897.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000898Specifies the standard target. After sending the ARP reply, the rule still
899has to give a standard target so ebtables knows what to do with the ARP request.
900The default target
901.BR "" "is " DROP .
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000902.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000903.B dnat
904The
905.B dnat
906target can only be used in the
907.BR BROUTING " chain of the " broute " table and the "
908.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000909It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000910.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000911.BR "--to-destination " "\fIaddress\fP"
912.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000913Change the destination MAC address to the specified
914.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000915The flag
916.B --to-dst
917is an alias for this option.
918.TP
919.BR "--dnat-target " "\fItarget\fP"
920.br
921Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000922give a standard target so ebtables knows what to do with the dnated frame.
923The default target is
924.BR ACCEPT .
925Making it
926.BR CONTINUE " could let you use"
927multiple target extensions on the same frame. Making it
928.BR DROP " only makes"
929sense in the
930.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
931in a base chain is not allowed (for obvious reasons).
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000932.SS
933.B mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000934.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000935to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000936if the bridge-nf code is compiled into the kernel. Both put the marking at the
937same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000938.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000939.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000940.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000941Mark the frame with the specified non-negative
942.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000943.TP
944.BR "--mark-target " "\fItarget\fP"
945.br
946Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000947still has to give a standard target so ebtables knows what to do.
948The default target is
949.BR ACCEPT ". Making it " CONTINUE " can let you do other"
950things with the frame in subsequent rules of the chain.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000951.SS
952.B redirect
953The
954.B redirect
955target will change the MAC target address to that of the bridge device the
956frame arrived on. This target can only be used in the
957.BR BROUTING " chain of the " broute " table and the "
958.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000959In the
960.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
961.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000962.TP
963.BR "--redirect-target " "\fItarget\fP"
964.br
965Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000966still has to give a standard target so ebtables knows what to do.
967The default target is
968.BR ACCEPT ". Making it " CONTINUE " could let you use"
969multiple target extensions on the same frame. Making it
970.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
971.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000972.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000973.B snat
974The
975.B snat
976target can only be used in the
977.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000978It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000979.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000980.BR "--to-source " "\fIaddress\fP"
981.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000982Changes the source MAC address to the specified
983.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000984.B --to-src
985is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000986.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000987.BR "--snat-target " "\fItarget\fP"
988.br
989Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000990to give a standard target so ebtables knows what to do.
991.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
992.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
993.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
994.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000995.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000996.SH FILES
997.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000998.SH ENVIRONMENT VARIABLES
999.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001000.SH MAILINGLISTS
1001.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +00001002.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001003.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001004.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001005.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)