blob: a4c0461ffa2a6a01cf4bf088e911941090b8d5fc [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 Schuymerab611e22005-02-14 20:20:03 +000029.BR "ebtables " [ -t " table ] " - [ ACDI "] chain rule specification [match extensions] [watcher extensions] target"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000030.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000031.BR "ebtables " [ -t " table ] " -P " chain " ACCEPT " | " DROP " | " RETURN
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000033.BR "ebtables " [ -t " table ] " -F " [chain]"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000035.BR "ebtables " [ -t " table ] " -Z " [chain]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000036.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +000037.BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [" --Ln "] | [" --Lx "] ] [" --Lc "] [" --Lmac2 ]
Bart De Schuymer29749c62002-06-25 21:27:57 +000038.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000039.BR "ebtables " [ -t " table ] " -N " chain [" "-P ACCEPT " | " DROP " | " RETURN" ]
Bart De Schuymer637ecd22003-07-13 18:53:50 +000040.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000041.BR "ebtables " [ -t " table ] " -X " [chain]"
Bart De Schuymera02773a2002-07-15 19:42:11 +000042.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000043.BR "ebtables " [ -t " table ] " -E " old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000045.BR "ebtables " [ -t " table ] " --init-table
Bart De Schuymer234bce92002-07-14 21:25:08 +000046.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000047.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-commit
Bart De Schuymer7085d662003-02-25 22:33:28 +000048.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000049.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-init
Bart De Schuymer7085d662003-02-25 22:33:28 +000050.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000051.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-save
52.br
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 .
Bart De Schuymer01581232005-07-24 09:46:09 +000090When using ebtablesd, don't use spaces in string arguments
91(like the
92.BR --log-prefix " argument)."
Bart De Schuymer6622a012005-01-19 21:09:05 +000093.br
94Example usage:
95.br
96# ebtablesd&
97.br
98# ebtablesu open filter
99.br
100# ebtablesu -A FORWARD -j DROP
101.br
102# ebtablesu commit filter
103.br
104# ebtablesu quit
105.br
106Alternatively, the commands can be echo'ed directly to the pipe used by ebtablesd,
107which has default location /tmp/ebtables-vx.y.z/ebtablesd_pipe, where
108x.y.z is the ebtables version (e.g. 2.0.7). Using echo instead of ebtablesu is
109much faster because echo is a bash built-in command. Commands like cat can be used
110too, of course.
111.br
112Example usage:
113.br
114# (./ebtablesd&) ; PIPE=/tmp/ebtables-v2.0.7/ebtablesd_pipe ; sleep 1
115.br
116# echo "ebtablesu open filter" >> $PIPE
117.br
118# echo "ebtablesu -A FORWARD -j DROP" >> $PIPE
119.br
120# echo "ebtablesu commit filter" >> $PIPE
121.br
122# echo "ebtablesu quit" >> $PIPE
Bart De Schuymer7085d662003-02-25 22:33:28 +0000123.SS CHAINS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000124There are three ebtables tables with built-in chains in the
125Linux kernel. These tables are used to divide functionality into
Bart De Schuymer7085d662003-02-25 22:33:28 +0000126different sets of rules. Each set of rules is called a chain.
127Each chain is an ordered list of rules that can match Ethernet frames. If a
128rule matches an Ethernet frame, then a processing specification tells
129what to do with that matching frame. The processing specification is
130called a 'target'. However, if the frame does not match the current
131rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000132The user can create new (user-defined) chains that can be used as the 'target'
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000133of a rule. User-defined chains are very useful to get better performance
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000134over the linear traversal of the rules and are also essential for structuring
135the filtering rules into well-organized and maintainable sets of rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000136.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000137A firewall rule specifies criteria for an Ethernet frame and a frame
138processing specification called a target. When a frame matches a rule,
139then the next action performed by the kernel is specified by the target.
140The target can be one of these values:
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000141.BR ACCEPT ,
142.BR DROP ,
143.BR CONTINUE ,
144.BR RETURN ,
145an 'extension' (see below) or a jump to a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000146.PP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000147.B ACCEPT
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000148means to let the frame through.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000149.B DROP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000150means the frame has to be dropped.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000151.B CONTINUE
152means the next rule has to be checked. This can be handy, f.e., to know how many
153frames pass a certain point in the chain, to log those frames or to apply multiple
154targets on a frame.
155.B RETURN
Bart De Schuymer29749c62002-06-25 21:27:57 +0000156means stop traversing this chain and resume at the next rule in the
157previous (calling) chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000158For the extension targets please refer to the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000159.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000160section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000161.SS TABLES
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000162As stated earlier, there are three ebtables tables in the Linux
163kernel. The table names are
Bart De Schuymer7085d662003-02-25 22:33:28 +0000164.BR filter ", " nat " and " broute .
165Of these three tables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000166the filter table is the default table that the command operates on.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000167If you are working with the filter table, then you can drop the '-t filter'
168argument to the ebtables command. However, you will need to provide
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000169the -t argument for the other two tables. Moreover, the -t argument must be the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000170first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000171.TP
172.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000173.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000174.B filter
Bart De Schuymer7085d662003-02-25 22:33:28 +0000175is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000176.B INPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000177(for frames destined for the bridge itself, on the level of the MAC destination address),
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000178.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000179(for locally-generated or (b)routed frames) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000180.B FORWARD
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000181(for frames being forwarded by the bridge).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000182.br
183.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000184.B nat
185is mostly used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000186.B PREROUTING
187(for altering frames as soon as they come in),
188.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000189(for altering locally generated or (b)routed frames before they are bridged) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000190.B POSTROUTING
191(for altering frames as they are about to go out). A small note on the naming
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000192of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000193PREFORWARDING and POSTFORWARDING, but for all those who come from the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000194iptables world to ebtables it is easier to have the same names. Note that you
195can change the name
196.BR "" ( -E )
197if you don't like the default.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000198.br
199.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000200.B broute
Bart De Schuymer7085d662003-02-25 22:33:28 +0000201is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000202.BR BROUTING .
203The targets
204.BR DROP " and " ACCEPT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000205have a special meaning in the broute table (these names are used instead of
206more descriptive names to keep the implementation generic).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000207.B DROP
208actually means the frame has to be routed, while
209.B ACCEPT
210means the frame has to be bridged. The
211.B BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000212chain is traversed very early. However, it is only traversed by frames entering on
213a bridge port that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000214would be bridged, but you can decide otherwise here. The
215.B redirect
216target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000217.SH EBTABLES COMMAND LINE ARGUMENTS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000218After the initial ebtables '-t table' command line argument, the remaining
219arguments can be divided into several groups. These groups
220are commands, miscellaneous commands, rule specifications, match extensions,
221watcher extensions and target extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000222.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000223The ebtables command arguments specify the actions to perform on the table
224defined with the -t argument. If you do not use the -t argument to name
225a table, the commands apply to the default filter table.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000226Only one command may be used on the command line at a time, except when
227the commands
228.BR -L " and " -Z
229are combined, the commands
230.BR -N " and " -P
231are combined, or when
232.B --atomic-file
233is used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000234.TP
235.B "-A, --append"
236Append a rule to the end of the selected chain.
237.TP
238.B "-D, --delete"
Bart De Schuymerab611e22005-02-14 20:20:03 +0000239Delete the specified rule or rules from the selected chain. There are two ways to
Bart De Schuymerabc84172002-11-06 21:02:33 +0000240use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000241to delete (directly after
242.BR -D ).
243Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
244.B -L --Ln
Bart De Schuymerab611e22005-02-14 20:20:03 +0000245to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000246from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
247details about using negative numbers, see the
248.B -I
249command. The second usage is by
250specifying the complete rule as it would have been specified when it was added. Only
251the first encountered rule that is the same as this specified rule, in other
Bart De Schuymerab611e22005-02-14 20:20:03 +0000252words the matching rule with the lowest (positive) rule number, is deleted.
253.TP
254.B "-C, --change-counters"
255Change the counters of the specified rule or rules from the selected chain. There are two ways to
256use this command. The first is by specifying an interval of rule numbers
257to do the changes on (directly after
258.BR -C ).
259Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
260.B -L --Ln
261to list the rules with their rule number). The details are the same as for the
262.BR -D " command. The second usage is by"
263specifying the complete rule as it would have been specified when it was added. Only
264the counters of the first encountered rule that is the same as this specified rule, in other
265words the matching rule with the lowest (positive) rule number, are changed.
266In the first usage, the counters are specified directly after the interval specification,
267in the second usage directly after
268.BR -C .
269First the packet counter is specified, then the byte counter. If the specified counters start
270with a '+', the counter values are added to the respective current counter values.
271If the specified counters start with a '-', the counter values are decreased from the respective
272current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
Bart De Schuymer01581232005-07-24 09:46:09 +0000273the current counters are changed to the specified counters. In daemon mode, using '+' or '-' is not
274allowed (due to technical reasons).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000275.TP
276.B "-I, --insert"
Bart De Schuymer01581232005-07-24 09:46:09 +0000277Insert the specified rule into the selected chain at the specified rule number. If the
278rule number is not specified, the rule is added at the head of the chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000279If the current number of rules equals
280.IR N ,
281then the specified number can be
282between
283.IR -N " and " N+1 .
284For a positive number
285.IR i ,
286it holds that
287.IR i " and " i-N-1
288specify the same place in the chain where the rule should be inserted. The rule number
2890 specifies the place past the last rule in the chain and using this number is therefore
290equivalent to using the
291.BR -A " command."
292Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
293in a chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000294.TP
295.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000296Set the policy for the chain to the given target. The policy can be
297.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000298.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000299.B "-F, --flush"
300Flush the selected chain. If no chain is selected, then every chain will be
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000301flushed. Flushing a chain does not change the policy of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000302chain, however.
303.TP
304.B "-Z, --zero"
305Set the counters of the selected chain to zero. If no chain is selected, all the counters
306are set to zero. The
307.B "-Z"
308command can be used in conjunction with the
309.B "-L"
310command.
311When both the
312.B "-Z"
313and
314.B "-L"
315commands are used together in this way, the rule counters are printed on the screen
316before they are set to zero.
317.TP
318.B "-L, --list"
319List all rules in the selected chain. If no chain is selected, all chains
320are listed.
321.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000322The following options change the output of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000323.B "-L"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000324command.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000325.br
326.B "--Ln"
327.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000328Places the rule number in front of every rule. This option is incompatible with the
329.BR --Lx " option."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000330.br
331.B "--Lc"
332.br
333Shows the counters at the end of each rule displayed by the
334.B "-L"
335command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000336The frame counter shows how many frames have matched the specific rule, the byte
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000337counter shows the sum of the frame sizes of these matching frames. Using this option
338.BR "" "in combination with the " --Lx " option causes the counters to be written out"
339.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000340.br
341.B "--Lx"
342.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000343Changes the output so that it produces a set of ebtables commands that construct
344the contents of the chain, when specified.
345If no chain is specified, ebtables commands to construct the contents of the
346table are given, including commands for creating the user-defined chains (if any).
347You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000348script. For example the output could be used at system startup.
349The
350.B "--Lx"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000351option is incompatible with the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000352.B "--Ln"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000353listing option. Using the
354.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
355.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000356.br
357.B "--Lmac2"
358.br
359Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000360if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000361.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000362.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000363Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000364user-defined chains is limited only by the number of possible chain names.
365A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000366length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000367ACCEPT. The policy of the new chain can be initialized to a different standard
368target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000369.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000370command together with the
371.B -N
372command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000373.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000374command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000375.TP
376.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000377Delete the specified user-defined chain. There must be no remaining references (jumps)
378to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
379specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000380.TP
381.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000382Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000383chain, you can rename a standard chain to a name that suits your
384taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000385then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000386rename one of the standard ebtables chain names, please be sure to mention
387this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000388It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000389ebtables chain in this fashion has no effect on the structure or functioning
390of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000391.TP
392.B "--init-table"
393Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000394.TP
395.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000396Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000397file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000398to the file. The file can be specified using the
399.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000400command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000401.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000402.TP
403.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000404Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000405file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000406to the file. The file can be specified using the
407.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000408command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000409.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000410.TP
411.B "--atomic-commit"
412Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000413file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000414certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000415time and allowing atomic updates of the tables. The file which contains
416the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000417.B "--atomic-init"
418or the
419.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000420command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000421.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000422command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000423.IR EBTABLES_ATOMIC_FILE " environment variable"
424allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000425committing it to the kernel. This command can be very useful in boot scripts
426to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000427.SS MISCELLANOUS COMMANDS
428.TP
429.B "-V, --version"
430Show the version of the ebtables userspace program.
431.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000432.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000433Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000434names of extensions and ebtables will try to write help about those
435extensions. E.g.
436.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000437Specify
438.I list_extensions
439to list all extensions supported by the userspace
440utility.
441.TP
442.BR "-j, --jump " "\fItarget\fP"
443The target of the rule. This is one of the following values:
444.BR ACCEPT ,
445.BR DROP ,
446.BR CONTINUE ,
447.BR RETURN ,
448a target extension (see
449.BR "TARGET EXTENSIONS" ")"
450or a user-defined chain name.
451.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000452.B --atomic-file "\fIfile\fP"
453Let the command operate on the specified
454.IR file .
455The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000456operate on will be extracted from the file and the result of the operation
457will be saved back into the file. If specified, this option should come
458before the command specification. An alternative that should be preferred,
459is setting the
460.IR EBTABLES_ATOMIC_FILE " environment variable."
461.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000462.B -M, --modprobe "\fIprogram\fP"
463When talking to the kernel, use this
464.I program
465to try to automatically load missing kernel modules.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000466
Bart De Schuymer29749c62002-06-25 21:27:57 +0000467.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000468RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000469The following command line arguments make up a rule specification (as used
470in the add and delete commands). A "!" option before the specification
471inverts the test for that specification. Apart from these standard rule
472specifications there are some other command line arguments of interest.
473See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000474.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000475and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000476.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000477below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000478.TP
479.BR "-p, --protocol " "[!] \fIprotocol\fP"
480The protocol that was responsible for creating the frame. This can be a
481hexadecimal number, above
482.IR 0x0600 ,
483a name (e.g.
484.I ARP
485) or
486.BR LENGTH .
487The protocol field of the Ethernet frame can be used to denote the
488length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000489below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000490.IR 0x0600 ,
491the value equals the size of the header and shouldn't be used as a
492protocol number. Instead, all frames where the protocol field is used as
493the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000494name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000495.BR LENGTH .
496.br
497The file
498.B /etc/ethertypes
499can be used to show readable
500characters instead of hexadecimal numbers for the protocols. For example,
501.I 0x0800
502will be represented by
503.IR IPV4 .
504The use of this file is not case sensitive.
505See that file for more information. The flag
506.B --proto
507is an alias for this option.
508.TP
509.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000510The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000511.BR INPUT ,
512.BR FORWARD ,
513.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000514chains). If the interface name ends with '+', then
515any interface name that begins with this name (disregarding '+') will match.
516The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000517.B --in-if
518is an alias for this option.
519.TP
520.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000521The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000522.BR INPUT ,
523.BR FORWARD ,
524.BR PREROUTING " and " BROUTING
525chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000526If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000527any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000528.TP
529.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000530The 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 +0000531.BR OUTPUT ,
532.B FORWARD
533and
534.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000535chains). If the interface name ends with '+', then
536any interface name that begins with this name (disregarding '+') will match.
537The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000538.B --out-if
539is an alias for this option.
540.TP
541.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000542The (logical) bridge interface via which a frame is going to be sent (this option
543is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000544.BR OUTPUT ,
545.B FORWARD
546and
547.B POSTROUTING
548chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000549If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000550any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000551.TP
552.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000553The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000554numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000555Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000556.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000557.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
558.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
559.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
560.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000561Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000562address will also match the multicast specification. The flag
563.B --src
564is an alias for this option.
565.TP
566.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000567The destination MAC address. See
568.B -s
569(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000570.B --dst
571is an alias for this option.
Bart De Schuymerab611e22005-02-14 20:20:03 +0000572.TP
573.BR "-c, --set-counter " "\fIpcnt bcnt\fP"
574If used with
575.BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
576.IR pcnt ", resp. " bcnt ".
577If used with the
578.BR -C " or " -D " commands, only rules with a packet and byte count equal to"
579.IR pcnt ", resp. " bcnt " will match."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000580
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000581.SS MATCH EXTENSIONS
582Ebtables extensions are dynamically loaded into the userspace tool,
583there is therefore no need to explicitly load them with a
584-m option like is done in iptables.
585These extensions deal with functionality supported by kernel modules supplemental to
586the core ebtables code.
587.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000588Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000589.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000590.TP
591.BR "--802_3-sap " "[!] \fIsap\fP"
592DSAP and SSAP are two one byte 802.3 fields. The bytes are always
593equal, so only one byte (hexadecimal) is needed as an argument.
594.TP
595.BR "--802_3-type " "[!] \fItype\fP"
596If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
597be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000598(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000599checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000600.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000601Match a MAC address or MAC/IP address pair versus a list of MAC addresses
602and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000603A list entry has the following format:
604.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000605list entries are separated by a comma, specifying an IP address corresponding to
606the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
607but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000608match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000609.TP
610.BR "--among-dst " "[!] \fIlist\fP"
611Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000612.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000613then comparison with MAC/IP destination address pairs from the
614list is possible.
615.TP
616.BR "--among-src " "[!] \fIlist\fP"
617Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000618.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000619then comparison with MAC/IP source address pairs from the list
620is possible.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000621.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000622Specify (R)ARP fields. The protocol must be specified as
623.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000624.TP
625.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000626The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000627.BR "ebtables -h arp" ).
628.TP
629.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000630The hardware type, this can be a decimal or the string
631.I Ethernet
632(which sets
633.I type
634to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000635.TP
636.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000637The protocol type for which the (r)arp is used (hexadecimal or the string
638.IR IPv4 ,
639denoting 0x0800).
640Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000641.TP
642.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000643The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000644.TP
645.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000646The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000647.TP
648.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000649The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000650.TP
651.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000652The (R)ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000653.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000654Specify IPv4 fields. The protocol must be specified as
655.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000656.TP
657.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000658The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000659The flag
660.B --ip-src
661is an alias for this option.
662.TP
663.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000664The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000665The flag
666.B --ip-dst
667is an alias for this option.
668.TP
669.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000670The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000671.BR IPv4 .
672.TP
673.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000674The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000675The flag
676.B --ip-proto
677is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000678.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000679.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
680The source port or port range for the IP protocols 6 (TCP) and 17
681(UDP). The
682.B --ip-protocol
683option must be specified as
684.IR TCP " or " UDP .
685If
686.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
687The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000688.B --ip-sport
689is an alias for this option.
690.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000691.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000692The destination port or port range for ip protocols 6 (TCP) and
Bart De Schuymer00bbac82004-12-21 20:29:12 +000069317 (UDP). The
694.B --ip-protocol
695option must be specified as
696.IR TCP " or " UDP .
697If
698.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
699The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000700.B --ip-dport
701is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000702.SS limit
703This module matches at a limited rate using a token bucket filter.
704A rule using this extension will match until this limit is reached.
705It can be used with the
706.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000707watcher to give limited logging, for example. Its use is the same
708as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000709.TP
710.BR "--limit " "[\fIvalue\fP]"
711Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000712.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000713.TP
714.BR "--limit-burst " "[\fInumber\fP]"
715Maximum initial number of packets to match: this number gets recharged by
716one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000717number; the default is
718.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000719.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000720.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000721.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000722Matches frames with the given unsigned mark value. If a
723.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
724the user-specified
725.IR mask " is taken before comparing it with the"
726user-specified mark
727.IR value ". When only a mark "
728.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000729only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000730mark
731.IR value .
732If only a
733.IR mask " is specified, the logical"
734AND of the mark value of the frame and the user-specified
735.IR mask " is taken and the frame matches when the result of this logical AND is"
736non-zero. Only specifying a
737.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000738.SS pkttype
739.TP
740.BR "--pkttype-type " "[!] \fItype\fP"
741Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000742generic networking code. Possible values:
743.IR broadcast " (MAC destination is the broadcast address),"
744.IR multicast " (MAC destination is a multicast address),"
745.IR host " (MAC destination is the receiving network device), or "
746.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000747.SS stp
748Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000749address
750.BR "" ( -d ") must be specified as the bridge group address"
751.IR "" ( BGA ).
752For all options for which a range of values can be specified, it holds that
753if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
754for that option is used, while if the upper bound is omitted (but the colon again is not), the
755highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000756.TP
757.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000758The BPDU type (0-255), recognized non-numerical types are
759.IR config ", denoting a configuration BPDU (=0), and"
760.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000761.TP
762.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000763The BPDU flag (0-255), recognized non-numerical flags are
764.IR topology-change ", denoting the topology change flag (=1), and"
765.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000766.TP
767.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
768The root priority (0-65535) range.
769.TP
770.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
771The root mac address, see the option
772.BR -s " for more details."
773.TP
774.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
775The root path cost (0-4294967295) range.
776.TP
777.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
778The BPDU's sender priority (0-65535) range.
779.TP
780.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
781The BPDU's sender mac address, see the option
782.BR -s " for more details."
783.TP
784.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
785The port identifier (0-65535) range.
786.TP
787.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
788The message age timer (0-65535) range.
789.TP
790.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
791The max age timer (0-65535) range.
792.TP
793.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
794The hello time timer (0-65535) range.
795.TP
796.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
797The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000798.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000799Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000800The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000801.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000802.TP
803.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000804The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000805.TP
806.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000807The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000808The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000809(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000810.TP
fnm3ed7e9012002-06-25 16:43:23 +0000811.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000812The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000813Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000814number from 0x0000 to 0xFFFF or as a symbolic name
815from
816.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000817
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000818.SS WATCHER EXTENSIONS
819Watchers only look at frames passing by, they don't modify them nor decide
820to accept the frames or not. These watchers only
821see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000822target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000823.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000824The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000825.TP
826.B "--log"
827.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000828Log with the default loggin options: log-level=
829.IR info ,
830log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000831.TP
832.B --log-level "\fIlevel\fP"
833.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000834Defines the logging level. For the possible values, see
835.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000836The default level is
837.IR info .
838.TP
839.BR --log-prefix " \fItext\fP"
840.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000841Defines the prefix
842.I text
843to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000844.TP
845.B --log-ip
846.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000847Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000848the rule. The default is no ip information logging.
849.TP
850.B --log-arp
851.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000852Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000853matches the rule. The default is no (r)arp information logging.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000854.SS ulog
855The ulog watcher passes the packet to a userspace
856logging daemon using netlink multicast sockets. This differs
857from the log watcher in the sense that the complete packet is
858sent to userspace instead of a descriptive text and that
859netlink multicast sockets are used instead of the syslog.
860This watcher enables parsing of packets with userspace programs, the
861physical bridge in and out ports are also included in the netlink messages.
862The ulog watcher module accepts 2 parameters when the module is loaded
863into the kernel (e.g. with modprobe):
864.B nlbufsiz
865specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000866group is. If you say
867.IR nlbufsiz=8192 ,
868for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000869get accumulated in the kernel until they are sent to userspace. It is
870not possible to allocate more than 128kB. Please also keep in mind that
871this buffer size is allocated for each nlgroup you are using, so the
872total kernel memory usage increases by that factor. The default is 4096.
873.B flushtimeout
874specifies after how many hundredths of a second the queue should be
875flushed, even if it is not full yet. The default is 10 (one tenth of
876a second).
877.TP
878.B "--ulog"
879.br
880Use the default settings: ulog-prefix="", ulog-nlgroup=1,
881ulog-cprange=4096, ulog-qthreshold=1.
882.TP
883.B --ulog-prefix "\fItext\fP"
884.br
885Defines the prefix included with the packets sent to userspace.
886.TP
887.BR --ulog-nlgroup " \fIgroup\fP"
888.br
889Defines which netlink group number to use (a number from 1 to 32).
890Make sure the netlink group numbers used for the iptables ULOG
891target differ from those used for the ebtables ulog watcher.
892The default group number is 1.
893.TP
894.BR --ulog-cprange " \fIrange\fP"
895.br
896Defines the maximum copy range to userspace, for packets matching the
897rule. The default range is 0, which means the maximum copy range is
898given by
899.BR nlbufsiz .
900A maximum copy range larger than
901128*1024 is meaningless as the packets sent to userspace have an upper
902size limit of 128*1024.
903.TP
904.BR --ulog-qthreshold " \fIthreshold\fP"
905.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000906Queue at most
907.I threshold
908number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000909userspace with a netlink socket. Note that packets can be sent to
910userspace before the queue is full, this happens when the ulog
911kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000912.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000913.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000914.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000915.B arpreply
916The
917.B arpreply
918target can be used in the
919.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000920If this target sees an ARP request it will automatically reply
921with an ARP reply. The used MAC address for the reply can be specified.
922The protocol must be specified as
923.IR ARP .
924When the ARP message is not an ARP request or when the ARP request isn't
925for an IP address on an Ethernet network, it is ignored by this target
926.BR "" ( CONTINUE ).
927When the ARP request is malformed, it is dropped
928.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000929.TP
930.BR "--arpreply-mac " "\fIaddress\fP"
931Specifies the MAC address to reply with: the Ethernet source MAC and the
932ARP payload source MAC will be filled in with this address.
933.TP
934.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000935Specifies the standard target. After sending the ARP reply, the rule still
936has to give a standard target so ebtables knows what to do with the ARP request.
937The default target
938.BR "" "is " DROP .
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000939.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000940.B dnat
941The
942.B dnat
943target can only be used in the
944.BR BROUTING " chain of the " broute " table and the "
945.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000946It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000947.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000948.BR "--to-destination " "\fIaddress\fP"
949.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000950Change the destination MAC address to the specified
951.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000952The flag
953.B --to-dst
954is an alias for this option.
955.TP
956.BR "--dnat-target " "\fItarget\fP"
957.br
958Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000959give a standard target so ebtables knows what to do with the dnated frame.
960The default target is
961.BR ACCEPT .
962Making it
963.BR CONTINUE " could let you use"
964multiple target extensions on the same frame. Making it
965.BR DROP " only makes"
966sense in the
967.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
968in a base chain is not allowed (for obvious reasons).
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000969.SS
970.B mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000971.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000972to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000973if the bridge-nf code is compiled into the kernel. Both put the marking at the
974same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000975.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000976.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000977.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000978Mark the frame with the specified non-negative
979.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000980.TP
981.BR "--mark-target " "\fItarget\fP"
982.br
983Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000984still has to give a standard target so ebtables knows what to do.
985The default target is
986.BR ACCEPT ". Making it " CONTINUE " can let you do other"
987things with the frame in subsequent rules of the chain.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000988.SS
989.B redirect
990The
991.B redirect
992target will change the MAC target address to that of the bridge device the
993frame arrived on. This target can only be used in the
994.BR BROUTING " chain of the " broute " table and the "
995.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000996In the
997.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
998.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000999.TP
1000.BR "--redirect-target " "\fItarget\fP"
1001.br
1002Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001003still has to give a standard target so ebtables knows what to do.
1004The default target is
1005.BR ACCEPT ". Making it " CONTINUE " could let you use"
1006multiple target extensions on the same frame. Making it
1007.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
1008.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001009.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001010.B snat
1011The
1012.B snat
1013target can only be used in the
1014.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001015It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001016.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001017.BR "--to-source " "\fIaddress\fP"
1018.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001019Changes the source MAC address to the specified
1020.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001021.B --to-src
1022is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001023.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001024.BR "--snat-target " "\fItarget\fP"
1025.br
1026Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001027to give a standard target so ebtables knows what to do.
1028.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
1029.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
1030.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
1031.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +00001032.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001033.SH FILES
1034.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +00001035.SH ENVIRONMENT VARIABLES
1036.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001037.SH MAILINGLISTS
1038.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +00001039.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001040.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001041.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001042.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)