blob: 44c12e3785638090a000354b380c6bdbdccf7f0e [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 .
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 Schuymerab611e22005-02-14 20:20:03 +0000120
Bart De Schuymer7085d662003-02-25 22:33:28 +0000121.SS CHAINS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000122There are three ebtables tables with built-in chains in the
123Linux kernel. These tables are used to divide functionality into
Bart De Schuymer7085d662003-02-25 22:33:28 +0000124different sets of rules. Each set of rules is called a chain.
125Each chain is an ordered list of rules that can match Ethernet frames. If a
126rule matches an Ethernet frame, then a processing specification tells
127what to do with that matching frame. The processing specification is
128called a 'target'. However, if the frame does not match the current
129rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000130The user can create new (user-defined) chains that can be used as the 'target'
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000131of a rule. User-defined chains are very useful to get better performance
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000132over the linear traversal of the rules and are also essential for structuring
133the filtering rules into well-organized and maintainable sets of rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000134.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000135A firewall rule specifies criteria for an Ethernet frame and a frame
136processing specification called a target. When a frame matches a rule,
137then the next action performed by the kernel is specified by the target.
138The target can be one of these values:
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000139.BR ACCEPT ,
140.BR DROP ,
141.BR CONTINUE ,
142.BR RETURN ,
143an 'extension' (see below) or a jump to a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000144.PP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000145.B ACCEPT
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000146means to let the frame through.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000147.B DROP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000148means the frame has to be dropped.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000149.B CONTINUE
150means the next rule has to be checked. This can be handy, f.e., to know how many
151frames pass a certain point in the chain, to log those frames or to apply multiple
152targets on a frame.
153.B RETURN
Bart De Schuymer29749c62002-06-25 21:27:57 +0000154means stop traversing this chain and resume at the next rule in the
155previous (calling) chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000156For the extension targets please refer to the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000157.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000158section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000159.SS TABLES
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000160As stated earlier, there are three ebtables tables in the Linux
161kernel. The table names are
Bart De Schuymer7085d662003-02-25 22:33:28 +0000162.BR filter ", " nat " and " broute .
163Of these three tables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000164the filter table is the default table that the command operates on.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000165If you are working with the filter table, then you can drop the '-t filter'
166argument to the ebtables command. However, you will need to provide
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000167the -t argument for the other two tables. Moreover, the -t argument must be the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000168first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000169.TP
170.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000171.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000172.B filter
Bart De Schuymer7085d662003-02-25 22:33:28 +0000173is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000174.B INPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000175(for frames destined for the bridge itself, on the level of the MAC destination address),
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000176.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000177(for locally-generated or (b)routed frames) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000178.B FORWARD
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000179(for frames being forwarded by the bridge).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000180.br
181.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000182.B nat
183is mostly used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000184.B PREROUTING
185(for altering frames as soon as they come in),
186.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000187(for altering locally generated or (b)routed frames before they are bridged) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000188.B POSTROUTING
189(for altering frames as they are about to go out). A small note on the naming
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000190of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000191PREFORWARDING and POSTFORWARDING, but for all those who come from the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000192iptables world to ebtables it is easier to have the same names. Note that you
193can change the name
194.BR "" ( -E )
195if you don't like the default.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000196.br
197.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000198.B broute
Bart De Schuymer7085d662003-02-25 22:33:28 +0000199is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000200.BR BROUTING .
201The targets
202.BR DROP " and " ACCEPT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000203have a special meaning in the broute table (these names are used instead of
204more descriptive names to keep the implementation generic).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000205.B DROP
206actually means the frame has to be routed, while
207.B ACCEPT
208means the frame has to be bridged. The
209.B BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000210chain is traversed very early. However, it is only traversed by frames entering on
211a bridge port that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000212would be bridged, but you can decide otherwise here. The
213.B redirect
214target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000215.SH EBTABLES COMMAND LINE ARGUMENTS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000216After the initial ebtables '-t table' command line argument, the remaining
217arguments can be divided into several groups. These groups
218are commands, miscellaneous commands, rule specifications, match extensions,
219watcher extensions and target extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000220.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000221The ebtables command arguments specify the actions to perform on the table
222defined with the -t argument. If you do not use the -t argument to name
223a table, the commands apply to the default filter table.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000224Only one command may be used on the command line at a time, except when
225the commands
226.BR -L " and " -Z
227are combined, the commands
228.BR -N " and " -P
229are combined, or when
230.B --atomic-file
231is used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000232.TP
233.B "-A, --append"
234Append a rule to the end of the selected chain.
235.TP
236.B "-D, --delete"
Bart De Schuymerab611e22005-02-14 20:20:03 +0000237Delete the specified rule or rules from the selected chain. There are two ways to
Bart De Schuymerabc84172002-11-06 21:02:33 +0000238use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000239to delete (directly after
240.BR -D ).
241Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
242.B -L --Ln
Bart De Schuymerab611e22005-02-14 20:20:03 +0000243to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000244from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
245details about using negative numbers, see the
246.B -I
247command. The second usage is by
248specifying the complete rule as it would have been specified when it was added. Only
249the first encountered rule that is the same as this specified rule, in other
Bart De Schuymerab611e22005-02-14 20:20:03 +0000250words the matching rule with the lowest (positive) rule number, is deleted.
251.TP
252.B "-C, --change-counters"
253Change the counters of the specified rule or rules from the selected chain. There are two ways to
254use this command. The first is by specifying an interval of rule numbers
255to do the changes on (directly after
256.BR -C ).
257Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
258.B -L --Ln
259to list the rules with their rule number). The details are the same as for the
260.BR -D " command. The second usage is by"
261specifying the complete rule as it would have been specified when it was added. Only
262the counters of the first encountered rule that is the same as this specified rule, in other
263words the matching rule with the lowest (positive) rule number, are changed.
264In the first usage, the counters are specified directly after the interval specification,
265in the second usage directly after
266.BR -C .
267First the packet counter is specified, then the byte counter. If the specified counters start
268with a '+', the counter values are added to the respective current counter values.
269If the specified counters start with a '-', the counter values are decreased from the respective
270current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
271the current counters are changed to the specified counters.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000272.TP
273.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000274Insert the specified rule into the selected chain at the specified rule number.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000275If the current number of rules equals
276.IR N ,
277then the specified number can be
278between
279.IR -N " and " N+1 .
280For a positive number
281.IR i ,
282it holds that
283.IR i " and " i-N-1
284specify the same place in the chain where the rule should be inserted. The rule number
2850 specifies the place past the last rule in the chain and using this number is therefore
286equivalent to using the
287.BR -A " command."
288Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
289in a chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000290.TP
291.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000292Set the policy for the chain to the given target. The policy can be
293.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000294.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000295.B "-F, --flush"
296Flush the selected chain. If no chain is selected, then every chain will be
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000297flushed. Flushing a chain does not change the policy of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000298chain, however.
299.TP
300.B "-Z, --zero"
301Set the counters of the selected chain to zero. If no chain is selected, all the counters
302are set to zero. The
303.B "-Z"
304command can be used in conjunction with the
305.B "-L"
306command.
307When both the
308.B "-Z"
309and
310.B "-L"
311commands are used together in this way, the rule counters are printed on the screen
312before they are set to zero.
313.TP
314.B "-L, --list"
315List all rules in the selected chain. If no chain is selected, all chains
316are listed.
317.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000318The following options change the output of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000319.B "-L"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000320command.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000321.br
322.B "--Ln"
323.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000324Places the rule number in front of every rule. This option is incompatible with the
325.BR --Lx " option."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326.br
327.B "--Lc"
328.br
329Shows the counters at the end of each rule displayed by the
330.B "-L"
331command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000332The frame counter shows how many frames have matched the specific rule, the byte
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000333counter shows the sum of the frame sizes of these matching frames. Using this option
334.BR "" "in combination with the " --Lx " option causes the counters to be written out"
335.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000336.br
337.B "--Lx"
338.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000339Changes the output so that it produces a set of ebtables commands that construct
340the contents of the chain, when specified.
341If no chain is specified, ebtables commands to construct the contents of the
342table are given, including commands for creating the user-defined chains (if any).
343You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000344script. For example the output could be used at system startup.
345The
346.B "--Lx"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000347option is incompatible with the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000348.B "--Ln"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000349listing option. Using the
350.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
351.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000352.br
353.B "--Lmac2"
354.br
355Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000356if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000357.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000358.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000359Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000360user-defined chains is limited only by the number of possible chain names.
361A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000362length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000363ACCEPT. The policy of the new chain can be initialized to a different standard
364target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000365.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000366command together with the
367.B -N
368command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000369.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000370command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000371.TP
372.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000373Delete the specified user-defined chain. There must be no remaining references (jumps)
374to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
375specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000376.TP
377.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000378Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000379chain, you can rename a standard chain to a name that suits your
380taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000381then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000382rename one of the standard ebtables chain names, please be sure to mention
383this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000384It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000385ebtables chain in this fashion has no effect on the structure or functioning
386of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000387.TP
388.B "--init-table"
389Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000390.TP
391.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000392Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000393file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000394to the file. The file can be specified using the
395.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000396command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000397.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000398.TP
399.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000400Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000401file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000402to the file. The file can be specified using the
403.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000404command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000405.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000406.TP
407.B "--atomic-commit"
408Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000409file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000410certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000411time and allowing atomic updates of the tables. The file which contains
412the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000413.B "--atomic-init"
414or the
415.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000416command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000417.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000418command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000419.IR EBTABLES_ATOMIC_FILE " environment variable"
420allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000421committing it to the kernel. This command can be very useful in boot scripts
422to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000423.SS MISCELLANOUS COMMANDS
424.TP
425.B "-V, --version"
426Show the version of the ebtables userspace program.
427.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000428.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000429Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000430names of extensions and ebtables will try to write help about those
431extensions. E.g.
432.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000433Specify
434.I list_extensions
435to list all extensions supported by the userspace
436utility.
437.TP
438.BR "-j, --jump " "\fItarget\fP"
439The target of the rule. This is one of the following values:
440.BR ACCEPT ,
441.BR DROP ,
442.BR CONTINUE ,
443.BR RETURN ,
444a target extension (see
445.BR "TARGET EXTENSIONS" ")"
446or a user-defined chain name.
447.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000448.B --atomic-file "\fIfile\fP"
449Let the command operate on the specified
450.IR file .
451The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000452operate on will be extracted from the file and the result of the operation
453will be saved back into the file. If specified, this option should come
454before the command specification. An alternative that should be preferred,
455is setting the
456.IR EBTABLES_ATOMIC_FILE " environment variable."
457.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000458.B -M, --modprobe "\fIprogram\fP"
459When talking to the kernel, use this
460.I program
461to try to automatically load missing kernel modules.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000462
Bart De Schuymer29749c62002-06-25 21:27:57 +0000463.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000464RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000465The following command line arguments make up a rule specification (as used
466in the add and delete commands). A "!" option before the specification
467inverts the test for that specification. Apart from these standard rule
468specifications there are some other command line arguments of interest.
469See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000470.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000471and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000472.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000473below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000474.TP
475.BR "-p, --protocol " "[!] \fIprotocol\fP"
476The protocol that was responsible for creating the frame. This can be a
477hexadecimal number, above
478.IR 0x0600 ,
479a name (e.g.
480.I ARP
481) or
482.BR LENGTH .
483The protocol field of the Ethernet frame can be used to denote the
484length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000485below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000486.IR 0x0600 ,
487the value equals the size of the header and shouldn't be used as a
488protocol number. Instead, all frames where the protocol field is used as
489the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000490name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000491.BR LENGTH .
492.br
493The file
494.B /etc/ethertypes
495can be used to show readable
496characters instead of hexadecimal numbers for the protocols. For example,
497.I 0x0800
498will be represented by
499.IR IPV4 .
500The use of this file is not case sensitive.
501See that file for more information. The flag
502.B --proto
503is an alias for this option.
504.TP
505.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000506The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000507.BR INPUT ,
508.BR FORWARD ,
509.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000510chains). If the interface name ends with '+', then
511any interface name that begins with this name (disregarding '+') will match.
512The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000513.B --in-if
514is an alias for this option.
515.TP
516.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000517The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000518.BR INPUT ,
519.BR FORWARD ,
520.BR PREROUTING " and " BROUTING
521chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000522If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000523any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000524.TP
525.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000526The 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 +0000527.BR OUTPUT ,
528.B FORWARD
529and
530.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000531chains). If the interface name ends with '+', then
532any interface name that begins with this name (disregarding '+') will match.
533The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000534.B --out-if
535is an alias for this option.
536.TP
537.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000538The (logical) bridge interface via which a frame is going to be sent (this option
539is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000540.BR OUTPUT ,
541.B FORWARD
542and
543.B POSTROUTING
544chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000545If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000546any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000547.TP
548.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000549The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000550numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000551Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000552.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000553.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
554.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
555.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
556.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000557Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000558address will also match the multicast specification. The flag
559.B --src
560is an alias for this option.
561.TP
562.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000563The destination MAC address. See
564.B -s
565(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000566.B --dst
567is an alias for this option.
Bart De Schuymerab611e22005-02-14 20:20:03 +0000568.TP
569.BR "-c, --set-counter " "\fIpcnt bcnt\fP"
570If used with
571.BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
572.IR pcnt ", resp. " bcnt ".
573If used with the
574.BR -C " or " -D " commands, only rules with a packet and byte count equal to"
575.IR pcnt ", resp. " bcnt " will match."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000576
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000577.SS MATCH EXTENSIONS
578Ebtables extensions are dynamically loaded into the userspace tool,
579there is therefore no need to explicitly load them with a
580-m option like is done in iptables.
581These extensions deal with functionality supported by kernel modules supplemental to
582the core ebtables code.
583.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000584Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000585.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000586.TP
587.BR "--802_3-sap " "[!] \fIsap\fP"
588DSAP and SSAP are two one byte 802.3 fields. The bytes are always
589equal, so only one byte (hexadecimal) is needed as an argument.
590.TP
591.BR "--802_3-type " "[!] \fItype\fP"
592If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
593be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000594(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000595checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000596.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000597Match a MAC address or MAC/IP address pair versus a list of MAC addresses
598and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000599A list entry has the following format:
600.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000601list entries are separated by a comma, specifying an IP address corresponding to
602the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
603but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000604match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000605.TP
606.BR "--among-dst " "[!] \fIlist\fP"
607Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000608.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000609then comparison with MAC/IP destination address pairs from the
610list is possible.
611.TP
612.BR "--among-src " "[!] \fIlist\fP"
613Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000614.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000615then comparison with MAC/IP source address pairs from the list
616is possible.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000617.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000618Specify (R)ARP fields. The protocol must be specified as
619.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000620.TP
621.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000622The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000623.BR "ebtables -h arp" ).
624.TP
625.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000626The hardware type, this can be a decimal or the string
627.I Ethernet
628(which sets
629.I type
630to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000631.TP
632.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000633The protocol type for which the (r)arp is used (hexadecimal or the string
634.IR IPv4 ,
635denoting 0x0800).
636Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000637.TP
638.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000639The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000640.TP
641.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000642The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000643.TP
644.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000645The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000646.TP
647.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000648The (R)ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000649.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000650Specify IPv4 fields. The protocol must be specified as
651.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000652.TP
653.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000654The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000655The flag
656.B --ip-src
657is an alias for this option.
658.TP
659.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000660The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000661The flag
662.B --ip-dst
663is an alias for this option.
664.TP
665.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000666The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000667.BR IPv4 .
668.TP
669.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000670The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000671The flag
672.B --ip-proto
673is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000674.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000675.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
676The source port or port range for the IP protocols 6 (TCP) and 17
677(UDP). The
678.B --ip-protocol
679option must be specified as
680.IR TCP " or " UDP .
681If
682.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
683The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000684.B --ip-sport
685is an alias for this option.
686.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000687.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000688The destination port or port range for ip protocols 6 (TCP) and
Bart De Schuymer00bbac82004-12-21 20:29:12 +000068917 (UDP). The
690.B --ip-protocol
691option must be specified as
692.IR TCP " or " UDP .
693If
694.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
695The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000696.B --ip-dport
697is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000698.SS limit
699This module matches at a limited rate using a token bucket filter.
700A rule using this extension will match until this limit is reached.
701It can be used with the
702.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000703watcher to give limited logging, for example. Its use is the same
704as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000705.TP
706.BR "--limit " "[\fIvalue\fP]"
707Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000708.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000709.TP
710.BR "--limit-burst " "[\fInumber\fP]"
711Maximum initial number of packets to match: this number gets recharged by
712one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000713number; the default is
714.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000715.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000716.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000717.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000718Matches frames with the given unsigned mark value. If a
719.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
720the user-specified
721.IR mask " is taken before comparing it with the"
722user-specified mark
723.IR value ". When only a mark "
724.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000725only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000726mark
727.IR value .
728If only a
729.IR mask " is specified, the logical"
730AND of the mark value of the frame and the user-specified
731.IR mask " is taken and the frame matches when the result of this logical AND is"
732non-zero. Only specifying a
733.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000734.SS pkttype
735.TP
736.BR "--pkttype-type " "[!] \fItype\fP"
737Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000738generic networking code. Possible values:
739.IR broadcast " (MAC destination is the broadcast address),"
740.IR multicast " (MAC destination is a multicast address),"
741.IR host " (MAC destination is the receiving network device), or "
742.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000743.SS stp
744Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000745address
746.BR "" ( -d ") must be specified as the bridge group address"
747.IR "" ( BGA ).
748For all options for which a range of values can be specified, it holds that
749if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
750for that option is used, while if the upper bound is omitted (but the colon again is not), the
751highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000752.TP
753.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000754The BPDU type (0-255), recognized non-numerical types are
755.IR config ", denoting a configuration BPDU (=0), and"
756.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000757.TP
758.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000759The BPDU flag (0-255), recognized non-numerical flags are
760.IR topology-change ", denoting the topology change flag (=1), and"
761.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000762.TP
763.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
764The root priority (0-65535) range.
765.TP
766.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
767The root mac address, see the option
768.BR -s " for more details."
769.TP
770.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
771The root path cost (0-4294967295) range.
772.TP
773.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
774The BPDU's sender priority (0-65535) range.
775.TP
776.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
777The BPDU's sender mac address, see the option
778.BR -s " for more details."
779.TP
780.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
781The port identifier (0-65535) range.
782.TP
783.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
784The message age timer (0-65535) range.
785.TP
786.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
787The max age timer (0-65535) range.
788.TP
789.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
790The hello time timer (0-65535) range.
791.TP
792.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
793The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000794.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000795Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000796The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000797.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000798.TP
799.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000800The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000801.TP
802.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000803The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000804The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000805(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000806.TP
fnm3ed7e9012002-06-25 16:43:23 +0000807.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000808The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000809Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000810number from 0x0000 to 0xFFFF or as a symbolic name
811from
812.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000813
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000814.SS WATCHER EXTENSIONS
815Watchers only look at frames passing by, they don't modify them nor decide
816to accept the frames or not. These watchers only
817see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000818target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000819.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000820The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000821.TP
822.B "--log"
823.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000824Log with the default loggin options: log-level=
825.IR info ,
826log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000827.TP
828.B --log-level "\fIlevel\fP"
829.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000830Defines the logging level. For the possible values, see
831.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000832The default level is
833.IR info .
834.TP
835.BR --log-prefix " \fItext\fP"
836.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000837Defines the prefix
838.I text
839to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000840.TP
841.B --log-ip
842.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000843Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000844the rule. The default is no ip information logging.
845.TP
846.B --log-arp
847.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000848Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000849matches the rule. The default is no (r)arp information logging.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000850.SS ulog
851The ulog watcher passes the packet to a userspace
852logging daemon using netlink multicast sockets. This differs
853from the log watcher in the sense that the complete packet is
854sent to userspace instead of a descriptive text and that
855netlink multicast sockets are used instead of the syslog.
856This watcher enables parsing of packets with userspace programs, the
857physical bridge in and out ports are also included in the netlink messages.
858The ulog watcher module accepts 2 parameters when the module is loaded
859into the kernel (e.g. with modprobe):
860.B nlbufsiz
861specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000862group is. If you say
863.IR nlbufsiz=8192 ,
864for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000865get accumulated in the kernel until they are sent to userspace. It is
866not possible to allocate more than 128kB. Please also keep in mind that
867this buffer size is allocated for each nlgroup you are using, so the
868total kernel memory usage increases by that factor. The default is 4096.
869.B flushtimeout
870specifies after how many hundredths of a second the queue should be
871flushed, even if it is not full yet. The default is 10 (one tenth of
872a second).
873.TP
874.B "--ulog"
875.br
876Use the default settings: ulog-prefix="", ulog-nlgroup=1,
877ulog-cprange=4096, ulog-qthreshold=1.
878.TP
879.B --ulog-prefix "\fItext\fP"
880.br
881Defines the prefix included with the packets sent to userspace.
882.TP
883.BR --ulog-nlgroup " \fIgroup\fP"
884.br
885Defines which netlink group number to use (a number from 1 to 32).
886Make sure the netlink group numbers used for the iptables ULOG
887target differ from those used for the ebtables ulog watcher.
888The default group number is 1.
889.TP
890.BR --ulog-cprange " \fIrange\fP"
891.br
892Defines the maximum copy range to userspace, for packets matching the
893rule. The default range is 0, which means the maximum copy range is
894given by
895.BR nlbufsiz .
896A maximum copy range larger than
897128*1024 is meaningless as the packets sent to userspace have an upper
898size limit of 128*1024.
899.TP
900.BR --ulog-qthreshold " \fIthreshold\fP"
901.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000902Queue at most
903.I threshold
904number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000905userspace with a netlink socket. Note that packets can be sent to
906userspace before the queue is full, this happens when the ulog
907kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000908.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000909.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000910.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000911.B arpreply
912The
913.B arpreply
914target can be used in the
915.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000916If this target sees an ARP request it will automatically reply
917with an ARP reply. The used MAC address for the reply can be specified.
918The protocol must be specified as
919.IR ARP .
920When the ARP message is not an ARP request or when the ARP request isn't
921for an IP address on an Ethernet network, it is ignored by this target
922.BR "" ( CONTINUE ).
923When the ARP request is malformed, it is dropped
924.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000925.TP
926.BR "--arpreply-mac " "\fIaddress\fP"
927Specifies the MAC address to reply with: the Ethernet source MAC and the
928ARP payload source MAC will be filled in with this address.
929.TP
930.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000931Specifies the standard target. After sending the ARP reply, the rule still
932has to give a standard target so ebtables knows what to do with the ARP request.
933The default target
934.BR "" "is " DROP .
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000935.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000936.B dnat
937The
938.B dnat
939target can only be used in the
940.BR BROUTING " chain of the " broute " table and the "
941.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000942It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000943.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000944.BR "--to-destination " "\fIaddress\fP"
945.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000946Change the destination MAC address to the specified
947.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000948The flag
949.B --to-dst
950is an alias for this option.
951.TP
952.BR "--dnat-target " "\fItarget\fP"
953.br
954Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000955give a standard target so ebtables knows what to do with the dnated frame.
956The default target is
957.BR ACCEPT .
958Making it
959.BR CONTINUE " could let you use"
960multiple target extensions on the same frame. Making it
961.BR DROP " only makes"
962sense in the
963.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
964in a base chain is not allowed (for obvious reasons).
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000965.SS
966.B mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000967.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000968to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000969if the bridge-nf code is compiled into the kernel. Both put the marking at the
970same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000971.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000972.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000973.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000974Mark the frame with the specified non-negative
975.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000976.TP
977.BR "--mark-target " "\fItarget\fP"
978.br
979Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000980still has to give a standard target so ebtables knows what to do.
981The default target is
982.BR ACCEPT ". Making it " CONTINUE " can let you do other"
983things with the frame in subsequent rules of the chain.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000984.SS
985.B redirect
986The
987.B redirect
988target will change the MAC target address to that of the bridge device the
989frame arrived on. This target can only be used in the
990.BR BROUTING " chain of the " broute " table and the "
991.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000992In the
993.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
994.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000995.TP
996.BR "--redirect-target " "\fItarget\fP"
997.br
998Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000999still has to give a standard target so ebtables knows what to do.
1000The default target is
1001.BR ACCEPT ". Making it " CONTINUE " could let you use"
1002multiple target extensions on the same frame. Making it
1003.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
1004.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001005.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001006.B snat
1007The
1008.B snat
1009target can only be used in the
1010.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001011It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001012.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001013.BR "--to-source " "\fIaddress\fP"
1014.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001015Changes the source MAC address to the specified
1016.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001017.B --to-src
1018is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +00001019.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001020.BR "--snat-target " "\fItarget\fP"
1021.br
1022Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +00001023to give a standard target so ebtables knows what to do.
1024.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
1025.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
1026.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
1027.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +00001028.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001029.SH FILES
1030.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +00001031.SH ENVIRONMENT VARIABLES
1032.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001033.SH MAILINGLISTS
1034.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +00001035.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001036.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00001037.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001038.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)