blob: dc7e3f316c03dcfd923537d3b559767c3e517688 [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 Schuymere61505f2005-09-28 19:41:01 +000027ebtables (v.2.0.7) \- Ethernet bridge frame table administration
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028.SH SYNOPSIS
Bart De Schuymerab611e22005-02-14 20:20:03 +000029.BR "ebtables " [ -t " table ] " - [ ACDI "] chain rule specification [match extensions] [watcher extensions] target"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000030.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000031.BR "ebtables " [ -t " table ] " -P " chain " ACCEPT " | " DROP " | " RETURN
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000033.BR "ebtables " [ -t " table ] " -F " [chain]"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000035.BR "ebtables " [ -t " table ] " -Z " [chain]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000036.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +000037.BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [" --Ln "] | [" --Lx "] ] [" --Lc "] [" --Lmac2 ]
Bart De Schuymer29749c62002-06-25 21:27:57 +000038.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000039.BR "ebtables " [ -t " table ] " -N " chain [" "-P ACCEPT " | " DROP " | " RETURN" ]
Bart De Schuymer637ecd22003-07-13 18:53:50 +000040.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000041.BR "ebtables " [ -t " table ] " -X " [chain]"
Bart De Schuymera02773a2002-07-15 19:42:11 +000042.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000043.BR "ebtables " [ -t " table ] " -E " old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000045.BR "ebtables " [ -t " table ] " --init-table
Bart De Schuymer234bce92002-07-14 21:25:08 +000046.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000047.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-commit
Bart De Schuymer7085d662003-02-25 22:33:28 +000048.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000049.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-init
Bart De Schuymer7085d662003-02-25 22:33:28 +000050.br
Bart De Schuymer6622a012005-01-19 21:09:05 +000051.BR "ebtables " [ -t " table ] [" --atomic-file " file] " --atomic-save
52.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000053.SH DESCRIPTION
54.B ebtables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000055is an application program used to set up and maintain the
56tables of rules (inside the Linux kernel) that inspect
57Ethernet frames.
58It is analogous to the
Bart De Schuymer7085d662003-02-25 22:33:28 +000059.B iptables
Bart De Schuymer00bbac82004-12-21 20:29:12 +000060application, but less complicated, due to the fact that the Ethernet protocol
61is much simpler than the IP protocol.
Bart De Schuymer7085d662003-02-25 22:33:28 +000062.SS CHAINS
Bart De Schuymer00bbac82004-12-21 20:29:12 +000063There are three ebtables tables with built-in chains in the
64Linux kernel. These tables are used to divide functionality into
Bart De Schuymer7085d662003-02-25 22:33:28 +000065different sets of rules. Each set of rules is called a chain.
66Each chain is an ordered list of rules that can match Ethernet frames. If a
67rule matches an Ethernet frame, then a processing specification tells
68what to do with that matching frame. The processing specification is
69called a 'target'. However, if the frame does not match the current
70rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000071The user can create new (user-defined) chains that can be used as the 'target'
Bart De Schuymer37d520d2004-10-24 07:36:15 +000072of a rule. User-defined chains are very useful to get better performance
Bart De Schuymer00bbac82004-12-21 20:29:12 +000073over the linear traversal of the rules and are also essential for structuring
74the filtering rules into well-organized and maintainable sets of rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000075.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +000076A firewall rule specifies criteria for an Ethernet frame and a frame
77processing specification called a target. When a frame matches a rule,
78then the next action performed by the kernel is specified by the target.
79The target can be one of these values:
Bart De Schuymer00bbac82004-12-21 20:29:12 +000080.BR ACCEPT ,
81.BR DROP ,
82.BR CONTINUE ,
83.BR RETURN ,
84an 'extension' (see below) or a jump to a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000085.PP
Bart De Schuymer00bbac82004-12-21 20:29:12 +000086.B ACCEPT
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000087means to let the frame through.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000088.B DROP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000089means the frame has to be dropped.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000090.B CONTINUE
91means the next rule has to be checked. This can be handy, f.e., to know how many
92frames pass a certain point in the chain, to log those frames or to apply multiple
93targets on a frame.
94.B RETURN
Bart De Schuymer29749c62002-06-25 21:27:57 +000095means stop traversing this chain and resume at the next rule in the
96previous (calling) chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +000097For the extension targets please refer to the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000098.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +000099section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000100.SS TABLES
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000101As stated earlier, there are three ebtables tables in the Linux
102kernel. The table names are
Bart De Schuymer7085d662003-02-25 22:33:28 +0000103.BR filter ", " nat " and " broute .
104Of these three tables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000105the filter table is the default table that the command operates on.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000106If you are working with the filter table, then you can drop the '-t filter'
107argument to the ebtables command. However, you will need to provide
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000108the -t argument for the other two tables. Moreover, the -t argument must be the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000109first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000110.TP
111.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000112.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000113.B filter
Bart De Schuymer7085d662003-02-25 22:33:28 +0000114is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000115.B INPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000116(for frames destined for the bridge itself, on the level of the MAC destination address),
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000117.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000118(for locally-generated or (b)routed frames) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000119.B FORWARD
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000120(for frames being forwarded by the bridge).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000121.br
122.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000123.B nat
124is mostly used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000125.B PREROUTING
126(for altering frames as soon as they come in),
127.B OUTPUT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000128(for altering locally generated or (b)routed frames before they are bridged) and
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000129.B POSTROUTING
130(for altering frames as they are about to go out). A small note on the naming
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000131of chains PREROUTING and POSTROUTING: it would be more accurate to call them
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000132PREFORWARDING and POSTFORWARDING, but for all those who come from the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000133iptables world to ebtables it is easier to have the same names. Note that you
134can change the name
135.BR "" ( -E )
136if you don't like the default.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000137.br
138.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000139.B broute
Bart De Schuymer7085d662003-02-25 22:33:28 +0000140is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000141.BR BROUTING .
142The targets
143.BR DROP " and " ACCEPT
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000144have a special meaning in the broute table (these names are used instead of
145more descriptive names to keep the implementation generic).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000146.B DROP
147actually means the frame has to be routed, while
148.B ACCEPT
149means the frame has to be bridged. The
150.B BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000151chain is traversed very early. However, it is only traversed by frames entering on
152a bridge port that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000153would be bridged, but you can decide otherwise here. The
154.B redirect
155target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000156.SH EBTABLES COMMAND LINE ARGUMENTS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000157After the initial ebtables '-t table' command line argument, the remaining
158arguments can be divided into several groups. These groups
159are commands, miscellaneous commands, rule specifications, match extensions,
160watcher extensions and target extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000161.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000162The ebtables command arguments specify the actions to perform on the table
163defined with the -t argument. If you do not use the -t argument to name
164a table, the commands apply to the default filter table.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000165Only one command may be used on the command line at a time, except when
166the commands
167.BR -L " and " -Z
168are combined, the commands
169.BR -N " and " -P
170are combined, or when
171.B --atomic-file
172is used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000173.TP
174.B "-A, --append"
175Append a rule to the end of the selected chain.
176.TP
177.B "-D, --delete"
Bart De Schuymerab611e22005-02-14 20:20:03 +0000178Delete the specified rule or rules from the selected chain. There are two ways to
Bart De Schuymerabc84172002-11-06 21:02:33 +0000179use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000180to delete (directly after
181.BR -D ).
182Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
183.B -L --Ln
Bart De Schuymerab611e22005-02-14 20:20:03 +0000184to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000185from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
186details about using negative numbers, see the
187.B -I
188command. The second usage is by
189specifying the complete rule as it would have been specified when it was added. Only
190the first encountered rule that is the same as this specified rule, in other
Bart De Schuymerab611e22005-02-14 20:20:03 +0000191words the matching rule with the lowest (positive) rule number, is deleted.
192.TP
193.B "-C, --change-counters"
194Change the counters of the specified rule or rules from the selected chain. There are two ways to
195use this command. The first is by specifying an interval of rule numbers
196to do the changes on (directly after
197.BR -C ).
198Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
199.B -L --Ln
200to list the rules with their rule number). The details are the same as for the
201.BR -D " command. The second usage is by"
202specifying the complete rule as it would have been specified when it was added. Only
203the counters of the first encountered rule that is the same as this specified rule, in other
204words the matching rule with the lowest (positive) rule number, are changed.
205In the first usage, the counters are specified directly after the interval specification,
206in the second usage directly after
207.BR -C .
208First the packet counter is specified, then the byte counter. If the specified counters start
209with a '+', the counter values are added to the respective current counter values.
210If the specified counters start with a '-', the counter values are decreased from the respective
211current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
Bart De Schuymerc900a012005-09-29 20:12:22 +0000212the current counters are changed to the specified counters.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000213.TP
214.B "-I, --insert"
Bart De Schuymer01581232005-07-24 09:46:09 +0000215Insert the specified rule into the selected chain at the specified rule number. If the
216rule number is not specified, the rule is added at the head of the chain.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000217If the current number of rules equals
218.IR N ,
219then the specified number can be
220between
221.IR -N " and " N+1 .
222For a positive number
223.IR i ,
224it holds that
225.IR i " and " i-N-1
226specify the same place in the chain where the rule should be inserted. The rule number
2270 specifies the place past the last rule in the chain and using this number is therefore
228equivalent to using the
229.BR -A " command."
230Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
231in a chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000232.TP
233.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000234Set the policy for the chain to the given target. The policy can be
235.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000236.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000237.B "-F, --flush"
238Flush the selected chain. If no chain is selected, then every chain will be
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000239flushed. Flushing a chain does not change the policy of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000240chain, however.
241.TP
242.B "-Z, --zero"
243Set the counters of the selected chain to zero. If no chain is selected, all the counters
244are set to zero. The
245.B "-Z"
246command can be used in conjunction with the
247.B "-L"
248command.
249When both the
250.B "-Z"
251and
252.B "-L"
253commands are used together in this way, the rule counters are printed on the screen
254before they are set to zero.
255.TP
256.B "-L, --list"
257List all rules in the selected chain. If no chain is selected, all chains
258are listed.
259.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000260The following options change the output of the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000261.B "-L"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000262command.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000263.br
264.B "--Ln"
265.br
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000266Places the rule number in front of every rule. This option is incompatible with the
267.BR --Lx " option."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000268.br
269.B "--Lc"
270.br
271Shows the counters at the end of each rule displayed by the
272.B "-L"
273command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000274The frame counter shows how many frames have matched the specific rule, the byte
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000275counter shows the sum of the frame sizes of these matching frames. Using this option
276.BR "" "in combination with the " --Lx " option causes the counters to be written out"
277.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer7085d662003-02-25 22:33:28 +0000278.br
279.B "--Lx"
280.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000281Changes the output so that it produces a set of ebtables commands that construct
282the contents of the chain, when specified.
283If no chain is specified, ebtables commands to construct the contents of the
284table are given, including commands for creating the user-defined chains (if any).
285You can use this set of commands in an ebtables boot or reload
Bart De Schuymer7085d662003-02-25 22:33:28 +0000286script. For example the output could be used at system startup.
287The
288.B "--Lx"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000289option is incompatible with the
Bart De Schuymer7085d662003-02-25 22:33:28 +0000290.B "--Ln"
Bart De Schuymerb5917d82005-01-25 21:15:59 +0000291listing option. Using the
292.BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
293.BR "" "in the '" -c " <pcnt> <bcnt>' option format."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000294.br
295.B "--Lmac2"
296.br
297Shows all MAC addresses with the same length, adding leading zeroes
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000298if necessary. The default representation omits leading zeroes in the addresses.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000299.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000300.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000301Create a new user-defined chain with the given name. The number of
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000302user-defined chains is limited only by the number of possible chain names.
303A user-defined chain name has a maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000304length of 31 characters. The standard policy of the user-defined chain is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000305ACCEPT. The policy of the new chain can be initialized to a different standard
306target by using the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000307.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000308command together with the
309.B -N
310command. In this case, the chain name does not have to be specified for the
Bart De Schuymer64182a32004-01-21 20:39:54 +0000311.B -P
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000312command.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000313.TP
314.B "-X, --delete-chain"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000315Delete the specified user-defined chain. There must be no remaining references (jumps)
316to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
317specified, all user-defined chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000318.TP
319.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000320Rename the specified chain to a new name. Besides renaming a user-defined
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000321chain, you can rename a standard chain to a name that suits your
322taste. For example, if you like PREFORWARDING more than PREROUTING,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000323then you can use the -E command to rename the PREROUTING chain. If you do
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000324rename one of the standard ebtables chain names, please be sure to mention
325this fact should you post a question on the ebtables mailing lists.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326It would be wise to use the standard name in your post. Renaming a standard
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000327ebtables chain in this fashion has no effect on the structure or functioning
328of the ebtables kernel table.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000329.TP
330.B "--init-table"
331Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000332.TP
333.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000334Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000335file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000336to the file. The file can be specified using the
337.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000338command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000339.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000340.TP
341.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000342Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000343file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000344to the file. The file can be specified using the
345.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000346command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000347.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000348.TP
349.B "--atomic-commit"
350Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000351file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000352certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000353time and allowing atomic updates of the tables. The file which contains
354the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000355.B "--atomic-init"
356or the
357.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000358command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000359.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000360command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000361.IR EBTABLES_ATOMIC_FILE " environment variable"
362allows you to extend the file and build the complete table before
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000363committing it to the kernel. This command can be very useful in boot scripts
364to populate the ebtables tables in a fast way.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000365.SS MISCELLANOUS COMMANDS
366.TP
367.B "-V, --version"
368Show the version of the ebtables userspace program.
369.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000370.BR "-h, --help " "[\fIlist of module names\fP]"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000371Give a brief description of the command syntax. Here you can also specify
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000372names of extensions and ebtables will try to write help about those
373extensions. E.g.
374.IR "ebtables -h snat log ip arp" .
Bart De Schuymer7085d662003-02-25 22:33:28 +0000375Specify
376.I list_extensions
377to list all extensions supported by the userspace
378utility.
379.TP
380.BR "-j, --jump " "\fItarget\fP"
381The target of the rule. This is one of the following values:
382.BR ACCEPT ,
383.BR DROP ,
384.BR CONTINUE ,
385.BR RETURN ,
386a target extension (see
387.BR "TARGET EXTENSIONS" ")"
388or a user-defined chain name.
389.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000390.B --atomic-file "\fIfile\fP"
391Let the command operate on the specified
392.IR file .
393The data of the table to
Bart De Schuymer7085d662003-02-25 22:33:28 +0000394operate on will be extracted from the file and the result of the operation
395will be saved back into the file. If specified, this option should come
396before the command specification. An alternative that should be preferred,
397is setting the
398.IR EBTABLES_ATOMIC_FILE " environment variable."
399.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000400.B -M, --modprobe "\fIprogram\fP"
401When talking to the kernel, use this
402.I program
403to try to automatically load missing kernel modules.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000404
Bart De Schuymer29749c62002-06-25 21:27:57 +0000405.SS
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000406RULE SPECIFICATIONS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000407The following command line arguments make up a rule specification (as used
408in the add and delete commands). A "!" option before the specification
409inverts the test for that specification. Apart from these standard rule
410specifications there are some other command line arguments of interest.
411See both the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000412.BR "MATCH EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000413and the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000414.BR "WATCHER EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000415below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000416.TP
417.BR "-p, --protocol " "[!] \fIprotocol\fP"
418The protocol that was responsible for creating the frame. This can be a
419hexadecimal number, above
420.IR 0x0600 ,
421a name (e.g.
422.I ARP
423) or
424.BR LENGTH .
425The protocol field of the Ethernet frame can be used to denote the
426length of the header (802.2/802.3 networks). When the value of that field is
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000427below or equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000428.IR 0x0600 ,
429the value equals the size of the header and shouldn't be used as a
430protocol number. Instead, all frames where the protocol field is used as
431the length field are assumed to be of the same 'protocol'. The protocol
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000432name used in ebtables for these frames is
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000433.BR LENGTH .
434.br
435The file
436.B /etc/ethertypes
437can be used to show readable
438characters instead of hexadecimal numbers for the protocols. For example,
439.I 0x0800
440will be represented by
441.IR IPV4 .
442The use of this file is not case sensitive.
443See that file for more information. The flag
444.B --proto
445is an alias for this option.
446.TP
447.BR "-i, --in-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000448The interface (bridge port) via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000449.BR INPUT ,
450.BR FORWARD ,
451.BR PREROUTING " and " BROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000452chains). If the interface name ends with '+', then
453any interface name that begins with this name (disregarding '+') will match.
454The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000455.B --in-if
456is an alias for this option.
457.TP
458.BR "--logical-in " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000459The (logical) bridge interface via which a frame is received (this option is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000460.BR INPUT ,
461.BR FORWARD ,
462.BR PREROUTING " and " BROUTING
463chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000464If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000465any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000466.TP
467.BR "-o, --out-interface " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000468The 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 +0000469.BR OUTPUT ,
470.B FORWARD
471and
472.B POSTROUTING
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000473chains). If the interface name ends with '+', then
474any interface name that begins with this name (disregarding '+') will match.
475The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000476.B --out-if
477is an alias for this option.
478.TP
479.BR "--logical-out " "[!] \fIname\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000480The (logical) bridge interface via which a frame is going to be sent (this option
481is useful in the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000482.BR OUTPUT ,
483.B FORWARD
484and
485.B POSTROUTING
486chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000487If the interface name ends with '+', then
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000488any interface name that begins with this name (disregarding '+') will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000489.TP
490.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000491The source MAC address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000492numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000493Multicast, Broadcast or BGA (Bridge Group Address):
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000494.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000495.IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
496.IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
497.IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
498.IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000499Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000500address will also match the multicast specification. The flag
501.B --src
502is an alias for this option.
503.TP
504.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000505The destination MAC address. See
506.B -s
507(above) for more details on MAC addresses. The flag
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000508.B --dst
509is an alias for this option.
Bart De Schuymerab611e22005-02-14 20:20:03 +0000510.TP
511.BR "-c, --set-counter " "\fIpcnt bcnt\fP"
512If used with
513.BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
514.IR pcnt ", resp. " bcnt ".
515If used with the
516.BR -C " or " -D " commands, only rules with a packet and byte count equal to"
517.IR pcnt ", resp. " bcnt " will match."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000518
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000519.SS MATCH EXTENSIONS
520Ebtables extensions are dynamically loaded into the userspace tool,
521there is therefore no need to explicitly load them with a
522-m option like is done in iptables.
523These extensions deal with functionality supported by kernel modules supplemental to
524the core ebtables code.
525.SS 802_3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000526Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000527.IR "LENGTH " "(see the option " " -p " above).
Bart De Schuymer7350b042003-06-24 19:53:19 +0000528.TP
529.BR "--802_3-sap " "[!] \fIsap\fP"
530DSAP and SSAP are two one byte 802.3 fields. The bytes are always
531equal, so only one byte (hexadecimal) is needed as an argument.
532.TP
533.BR "--802_3-type " "[!] \fItype\fP"
534If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
535be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000536(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000537checked for type.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000538.SS among
Bart De Schuymer538f8802004-12-05 14:46:55 +0000539Match a MAC address or MAC/IP address pair versus a list of MAC addresses
540and MAC/IP address pairs.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000541A list entry has the following format:
542.IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
Bart De Schuymer538f8802004-12-05 14:46:55 +0000543list entries are separated by a comma, specifying an IP address corresponding to
544the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
545but different IP address (and vice versa) can be specified. If the MAC address doesn't
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000546match any entry from the list, the frame doesn't match the rule (unless "!" was used).
Bart De Schuymer538f8802004-12-05 14:46:55 +0000547.TP
548.BR "--among-dst " "[!] \fIlist\fP"
549Compare the MAC destination to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000550.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000551then comparison with MAC/IP destination address pairs from the
552list is possible.
553.TP
554.BR "--among-src " "[!] \fIlist\fP"
555Compare the MAC source to the given list. If the Ethernet frame has type
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000556.IR IPv4 " or " ARP ,
Bart De Schuymer538f8802004-12-05 14:46:55 +0000557then comparison with MAC/IP source address pairs from the list
558is possible.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000559.SS arp
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000560Specify (R)ARP fields. The protocol must be specified as
561.IR ARP " or " RARP .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000562.TP
563.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000564The (R)ARP opcode (decimal or a string, for more details see
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000565.BR "ebtables -h arp" ).
566.TP
567.BR "--arp-htype " "[!] \fIhardware type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000568The hardware type, this can be a decimal or the string
569.I Ethernet
570(which sets
571.I type
572to 1). Most (R)ARP packets have Eternet as hardware type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000573.TP
574.BR "--arp-ptype " "[!] \fIprotocol type\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000575The protocol type for which the (r)arp is used (hexadecimal or the string
576.IR IPv4 ,
577denoting 0x0800).
578Most (R)ARP packets have protocol type IPv4.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000579.TP
580.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000581The (R)ARP IP source address specification.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000582.TP
583.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000584The (R)ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000585.TP
586.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000587The (R)ARP MAC source address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000588.TP
589.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000590The (R)ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000591.SS ip
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000592Specify IPv4 fields. The protocol must be specified as
593.IR IPv4 .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000594.TP
595.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000596The source IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000597The flag
598.B --ip-src
599is an alias for this option.
600.TP
601.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000602The destination IP address.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000603The flag
604.B --ip-dst
605is an alias for this option.
606.TP
607.BR "--ip-tos " "[!] \fItos\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000608The IP type of service, in hexadecimal numbers.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000609.BR IPv4 .
610.TP
611.BR "--ip-protocol " "[!] \fIprotocol\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000612The IP protocol.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000613The flag
614.B --ip-proto
615is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000616.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000617.BR "--ip-source-port " "[!] \fIport1\fP[:\fIport2\fP]"
618The source port or port range for the IP protocols 6 (TCP) and 17
619(UDP). The
620.B --ip-protocol
621option must be specified as
622.IR TCP " or " UDP .
623If
624.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
625The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000626.B --ip-sport
627is an alias for this option.
628.TP
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000629.BR "--ip-destination-port " "[!] \fIport1\fP[:\fIport2\fP]"
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000630The destination port or port range for ip protocols 6 (TCP) and
Bart De Schuymer00bbac82004-12-21 20:29:12 +000063117 (UDP). The
632.B --ip-protocol
633option must be specified as
634.IR TCP " or " UDP .
635If
636.IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
637The flag
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000638.B --ip-dport
639is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000640.SS limit
641This module matches at a limited rate using a token bucket filter.
642A rule using this extension will match until this limit is reached.
643It can be used with the
644.B --log
Bart De Schuymer538f8802004-12-05 14:46:55 +0000645watcher to give limited logging, for example. Its use is the same
646as the limit match of iptables.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000647.TP
648.BR "--limit " "[\fIvalue\fP]"
649Maximum average matching rate: specified as a number, with an optional
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000650.IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000651.TP
652.BR "--limit-burst " "[\fInumber\fP]"
653Maximum initial number of packets to match: this number gets recharged by
654one every time the limit specified above is not reached, up to this
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000655number; the default is
656.IR 5 .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000657.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000658.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000659.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000660Matches frames with the given unsigned mark value. If a
661.IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
662the user-specified
663.IR mask " is taken before comparing it with the"
664user-specified mark
665.IR value ". When only a mark "
666.IR value " is specified, the packet"
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000667only matches when the mark value of the frame equals the user-specified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000668mark
669.IR value .
670If only a
671.IR mask " is specified, the logical"
672AND of the mark value of the frame and the user-specified
673.IR mask " is taken and the frame matches when the result of this logical AND is"
674non-zero. Only specifying a
675.IR mask " is useful to match multiple mark values."
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000676.SS pkttype
677.TP
678.BR "--pkttype-type " "[!] \fItype\fP"
679Matches on the Ethernet "class" of the frame, which is determined by the
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000680generic networking code. Possible values:
681.IR broadcast " (MAC destination is the broadcast address),"
682.IR multicast " (MAC destination is a multicast address),"
683.IR host " (MAC destination is the receiving network device), or "
684.IR otherhost " (none of the above)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000685.SS stp
686Specify stp BPDU (bridge protocol data unit) fields. The destination
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000687address
688.BR "" ( -d ") must be specified as the bridge group address"
689.IR "" ( BGA ).
690For all options for which a range of values can be specified, it holds that
691if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
692for that option is used, while if the upper bound is omitted (but the colon again is not), the
693highest possible upper bound for that option is used.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000694.TP
695.BR "--stp-type " "[!] \fItype\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000696The BPDU type (0-255), recognized non-numerical types are
697.IR config ", denoting a configuration BPDU (=0), and"
698.IR tcn ", denothing a topology change notification BPDU (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000699.TP
700.BR "--stp-flags " "[!] \fIflag\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000701The BPDU flag (0-255), recognized non-numerical flags are
702.IR topology-change ", denoting the topology change flag (=1), and"
703.IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000704.TP
705.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
706The root priority (0-65535) range.
707.TP
708.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
709The root mac address, see the option
710.BR -s " for more details."
711.TP
712.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
713The root path cost (0-4294967295) range.
714.TP
715.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
716The BPDU's sender priority (0-65535) range.
717.TP
718.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
719The BPDU's sender mac address, see the option
720.BR -s " for more details."
721.TP
722.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
723The port identifier (0-65535) range.
724.TP
725.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
726The message age timer (0-65535) range.
727.TP
728.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
729The max age timer (0-65535) range.
730.TP
731.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
732The hello time timer (0-65535) range.
733.TP
734.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
735The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000736.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000737Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000738The protocol must be specified as
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000739.IR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000740.TP
741.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000742The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000743.TP
744.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000745The user priority field, a decimal number from 0 to 7.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000746The VID should be set to 0 ("null VID") or unspecified
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000747(in the latter case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000748.TP
fnm3ed7e9012002-06-25 16:43:23 +0000749.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000750The encapsulated Ethernet frame type/length.
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000751Specified as a hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000752number from 0x0000 to 0xFFFF or as a symbolic name
753from
754.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000755
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000756.SS WATCHER EXTENSIONS
757Watchers only look at frames passing by, they don't modify them nor decide
758to accept the frames or not. These watchers only
759see the frame if the frame matches the rule, and they see it before the
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000760target is executed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000761.SS log
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000762The log watcher writes descriptive data about a frame to the syslog.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000763.TP
764.B "--log"
765.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000766Log with the default loggin options: log-level=
767.IR info ,
768log-prefix="", no ip logging, no arp logging.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000769.TP
770.B --log-level "\fIlevel\fP"
771.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000772Defines the logging level. For the possible values, see
773.BR "ebtables -h log" .
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000774The default level is
775.IR info .
776.TP
777.BR --log-prefix " \fItext\fP"
778.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000779Defines the prefix
780.I text
781to be printed at the beginning of the line with the logging information.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000782.TP
783.B --log-ip
784.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000785Will log the ip information when a frame made by the ip protocol matches
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000786the rule. The default is no ip information logging.
787.TP
788.B --log-arp
789.br
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000790Will log the (r)arp information when a frame made by the (r)arp protocols
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000791matches the rule. The default is no (r)arp information logging.
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000792.SS ulog
793The ulog watcher passes the packet to a userspace
794logging daemon using netlink multicast sockets. This differs
795from the log watcher in the sense that the complete packet is
796sent to userspace instead of a descriptive text and that
797netlink multicast sockets are used instead of the syslog.
798This watcher enables parsing of packets with userspace programs, the
799physical bridge in and out ports are also included in the netlink messages.
800The ulog watcher module accepts 2 parameters when the module is loaded
801into the kernel (e.g. with modprobe):
802.B nlbufsiz
803specifies how big the buffer for each netlink multicast
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000804group is. If you say
805.IR nlbufsiz=8192 ,
806for example, up to eight kB of packets will
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000807get accumulated in the kernel until they are sent to userspace. It is
808not possible to allocate more than 128kB. Please also keep in mind that
809this buffer size is allocated for each nlgroup you are using, so the
810total kernel memory usage increases by that factor. The default is 4096.
811.B flushtimeout
812specifies after how many hundredths of a second the queue should be
813flushed, even if it is not full yet. The default is 10 (one tenth of
814a second).
815.TP
816.B "--ulog"
817.br
818Use the default settings: ulog-prefix="", ulog-nlgroup=1,
819ulog-cprange=4096, ulog-qthreshold=1.
820.TP
821.B --ulog-prefix "\fItext\fP"
822.br
823Defines the prefix included with the packets sent to userspace.
824.TP
825.BR --ulog-nlgroup " \fIgroup\fP"
826.br
827Defines which netlink group number to use (a number from 1 to 32).
828Make sure the netlink group numbers used for the iptables ULOG
829target differ from those used for the ebtables ulog watcher.
830The default group number is 1.
831.TP
832.BR --ulog-cprange " \fIrange\fP"
833.br
834Defines the maximum copy range to userspace, for packets matching the
835rule. The default range is 0, which means the maximum copy range is
836given by
837.BR nlbufsiz .
838A maximum copy range larger than
839128*1024 is meaningless as the packets sent to userspace have an upper
840size limit of 128*1024.
841.TP
842.BR --ulog-qthreshold " \fIthreshold\fP"
843.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000844Queue at most
845.I threshold
846number of packets before sending them to
Bart De Schuymer61b4d722004-11-21 23:08:19 +0000847userspace with a netlink socket. Note that packets can be sent to
848userspace before the queue is full, this happens when the ulog
849kernel timer goes off (the frequency of this timer depends on
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000850.BR flushtimeout ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000851.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000852.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000853.B arpreply
854The
855.B arpreply
856target can be used in the
857.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000858If this target sees an ARP request it will automatically reply
859with an ARP reply. The used MAC address for the reply can be specified.
860The protocol must be specified as
861.IR ARP .
862When the ARP message is not an ARP request or when the ARP request isn't
863for an IP address on an Ethernet network, it is ignored by this target
864.BR "" ( CONTINUE ).
865When the ARP request is malformed, it is dropped
866.BR "" ( DROP ).
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000867.TP
868.BR "--arpreply-mac " "\fIaddress\fP"
869Specifies the MAC address to reply with: the Ethernet source MAC and the
870ARP payload source MAC will be filled in with this address.
871.TP
872.BR "--arpreply-target " "\fItarget\fP"
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000873Specifies the standard target. After sending the ARP reply, the rule still
874has to give a standard target so ebtables knows what to do with the ARP request.
875The default target
876.BR "" "is " DROP .
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000877.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000878.B dnat
879The
880.B dnat
881target can only be used in the
882.BR BROUTING " chain of the " broute " table and the "
883.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000884It specifies that the destination MAC address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000885.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000886.BR "--to-destination " "\fIaddress\fP"
887.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000888Change the destination MAC address to the specified
889.IR address .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000890The flag
891.B --to-dst
892is an alias for this option.
893.TP
894.BR "--dnat-target " "\fItarget\fP"
895.br
896Specifies the standard target. After doing the dnat, the rule still has to
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000897give a standard target so ebtables knows what to do with the dnated frame.
898The default target is
899.BR ACCEPT .
900Making it
901.BR CONTINUE " could let you use"
902multiple target extensions on the same frame. Making it
903.BR DROP " only makes"
904sense in the
905.BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
906in a base chain is not allowed (for obvious reasons).
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000907.SS
908.B mark
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000909.BR "" "The " mark " target can be used in every chain of every table. It is possible"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000910to use the marking of a frame/packet in both ebtables and iptables,
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000911if the bridge-nf code is compiled into the kernel. Both put the marking at the
912same place. This allows for a form of communication between ebtables and iptables.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000913.TP
Bart De Schuymer8b0c58a2004-12-05 21:54:45 +0000914.BR "--mark-set " "\fIvalue\fP"
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000915.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000916Mark the frame with the specified non-negative
917.IR value .
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000918.TP
919.BR "--mark-target " "\fItarget\fP"
920.br
921Specifies the standard target. After marking the frame, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000922still has to give a standard target so ebtables knows what to do.
923The default target is
924.BR ACCEPT ". Making it " CONTINUE " can let you do other"
925things with the frame in subsequent rules of the chain.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000926.SS
927.B redirect
928The
929.B redirect
930target will change the MAC target address to that of the bridge device the
931frame arrived on. This target can only be used in the
932.BR BROUTING " chain of the " broute " table and the "
933.BR PREROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000934In the
935.BR BROUTING " chain, the MAC address of the bridge port is used as destination address,"
936.BR "" "in the " PREROUTING " chain, the MAC address of the bridge is used."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000937.TP
938.BR "--redirect-target " "\fItarget\fP"
939.br
940Specifies the standard target. After doing the MAC redirect, the rule
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000941still has to give a standard target so ebtables knows what to do.
942The default target is
943.BR ACCEPT ". Making it " CONTINUE " could let you use"
944multiple target extensions on the same frame. Making it
945.BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
946.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000947.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000948.B snat
949The
950.B snat
951target can only be used in the
952.BR POSTROUTING " chain of the " nat " table."
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000953It specifies that the source MAC address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000954.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000955.BR "--to-source " "\fIaddress\fP"
956.br
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000957Changes the source MAC address to the specified
958.IR address ". The flag"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000959.B --to-src
960is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000961.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000962.BR "--snat-target " "\fItarget\fP"
963.br
964Specifies the standard target. After doing the snat, the rule still has
Bart De Schuymer00bbac82004-12-21 20:29:12 +0000965to give a standard target so ebtables knows what to do.
966.BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
967.BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
968.BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
969.BR "" "that using " RETURN " in a base chain is not allowed."
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000970.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000971.SH FILES
972.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000973.SH ENVIRONMENT VARIABLES
974.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000975.SH MAILINGLISTS
976.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000977.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000978.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000979.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000980.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)