blob: b51e4c6e5d73679e4fc8b99ef8562a594a6369c6 [file] [log] [blame]
Bart De Schuymer64182a32004-01-21 20:39:54 +00001.TH EBTABLES 8 "18 January 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 Schuymer63e2c702002-08-01 15:30:15 +000027ebtables (v.2.0) \- Ethernet bridge frame table administration
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000028.SH SYNOPSIS
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000029.BR "ebtables " [ "-t table" ] " -" [ ADI ] " chain rule-specification " [ match-extensions "] [" watcher-extensions ] " TARGET"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000030.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000031.BR "ebtables " [ "-t table" ] " -P chain ACCEPT " | " DROP " | " RETURN"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000033.BR "ebtables " [ "-t table" ] " -F " [ chain ]
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000035.BR "ebtables " [ "-t table" ] " -Z " [ chain ]
Bart De Schuymer29749c62002-06-25 21:27:57 +000036.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000037.BR "ebtables " [ "-t table" ] " -L " [ -Z "] [" " chain" "] [ [ [" --Ln "] [" --Lc "] ] | [" --Lx "] ] [" --Lmac2 "]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000038.br
Bart De Schuymer64182a32004-01-21 20:39:54 +000039.BR "ebtables " [ "-t table" ] " -N chain " [ "-P ACCEPT " | " DROP " | " RETURN" ]
Bart De Schuymer637ecd22003-07-13 18:53:50 +000040.br
41.BR "ebtables " [ "-t table" ] " -X " [ chain ]
Bart De Schuymera02773a2002-07-15 19:42:11 +000042.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000043.BR "ebtables " [ "-t table" ] " -E old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000045.BR "ebtables " [ "-t table" ] " --init-table"
Bart De Schuymer234bce92002-07-14 21:25:08 +000046.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000047.BR "ebtables " [ "-t table" "] [" "--atomic-file file" ] " --atomic-commit"
Bart De Schuymer7085d662003-02-25 22:33:28 +000048.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000049.BR "ebtables " [ "-t table" "] [" "--atomic-file file" ] " --atomic-init"
Bart De Schuymer7085d662003-02-25 22:33:28 +000050.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000051.BR "ebtables " [ "-t table" "] [" "--atomic-file file" ] " --atomic-save"
Bart De Schuymer234bce92002-07-14 21:25:08 +000052.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000053.SH DESCRIPTION
54.B ebtables
Bart De Schuymer7085d662003-02-25 22:33:28 +000055is a user space tool, it is used to set up and maintain the
56tables of Ethernet frame rules in the Linux kernel. These rules inspect
57the Ethernet frames which they see.
58.B ebtables
59is analogous to the
60.B iptables
61user space tool, but
62.B ebtables
63is less complicated.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000064
Bart De Schuymer7085d662003-02-25 22:33:28 +000065.SS CHAINS
66There are three Ethernet frame tables with built-in chains in the
67Linux kernel. The kernel tables are used to divide functionality into
68different sets of rules. Each set of rules is called a chain.
69Each chain is an ordered list of rules that can match Ethernet frames. If a
70rule matches an Ethernet frame, then a processing specification tells
71what to do with that matching frame. The processing specification is
72called a 'target'. However, if the frame does not match the current
73rule in the chain, then the next rule in the chain is examined and so forth.
Bart De Schuymer37d520d2004-10-24 07:36:15 +000074The user can create new (user-defined) chains which can be used as the 'target'
75of a rule. User-defined chains are very useful to get better performance
76over the linear traversal of the rules.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000077
78.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +000079A firewall rule specifies criteria for an Ethernet frame and a frame
80processing specification called a target. When a frame matches a rule,
81then the next action performed by the kernel is specified by the target.
82The target can be one of these values:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000083.IR ACCEPT ,
84.IR DROP ,
85.IR CONTINUE ,
Bart De Schuymer29749c62002-06-25 21:27:57 +000086.IR RETURN ,
Bart De Schuymer7085d662003-02-25 22:33:28 +000087an 'extension' (see below) or a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000088.PP
89.I ACCEPT
90means to let the frame through.
91.I DROP
92means the frame has to be dropped.
93.I CONTINUE
94means the next rule has to be checked. This can be handy to know how many
Bart De Schuymer29749c62002-06-25 21:27:57 +000095frames pass a certain point in the chain or to log those frames.
96.I RETURN
97means stop traversing this chain and resume at the next rule in the
98previous (calling) chain.
Bart De Schuymer7085d662003-02-25 22:33:28 +000099For the extension targets please see the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000100.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000101section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000102.SS TABLES
Bart De Schuymer7085d662003-02-25 22:33:28 +0000103As stated earlier, there are three Ethernet frame tables in the Linux
104kernel. The tables are
105.BR filter ", " nat " and " broute .
106Of these three tables,
107the filter table is the default table that the
108.B ebtables
109command operates on.
110If you are working with the filter table, then you can drop the '-t filter'
111argument to the ebtables command. However, you will need to provide
112the -t argument for the other two tables. The -t argument must be the
113first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000114.TP
115.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000116.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000117.BR filter ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000118is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000119.B INPUT
120(for frames destined for the bridge itself),
121.B OUTPUT
122(for locally-generated frames) and
123.B FORWARD
124(for frames being bridged).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000125.br
126.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000127.BR nat ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000128is used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000129.B PREROUTING
130(for altering frames as soon as they come in),
131.B OUTPUT
132(for altering locally generated frames before they are bridged) and
133.B POSTROUTING
134(for altering frames as they are about to go out). A small note on the naming
135of chains POSTROUTING and PREROUTING: it would be more accurate to call them
136PREFORWARDING and POSTFORWARDING, but for all those who come from the
137.BR iptables " world to " ebtables
138it is easier to have the same names.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000139.br
140.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000141.BR broute ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000142is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000143.BR BROUTING .
144The targets
145.BR DROP " and " ACCEPT
Bart De Schuymer7085d662003-02-25 22:33:28 +0000146have special meaning in the broute table.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000147.B DROP
148actually means the frame has to be routed, while
149.B ACCEPT
150means the frame has to be bridged. The
151.B BROUTING
152chain is traversed very early. It is only traversed by frames entering on
Bart De Schuymer7085d662003-02-25 22:33:28 +0000153a bridge enslaved NIC that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000154would be bridged, but you can decide otherwise here. The
155.B redirect
156target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000157.SH EBTABLES COMMAND LINE ARGUMENTS
158After the initial ebtables -t, table command line argument, the remaining
159arguments can be divided into several different groups. These groups
160are commands, miscellaneous commands, rule-specifications, match-extensions,
161and watcher-extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000162.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000163The ebtables command arguments specify the actions to perform on the table
164defined with the -t argument. If you do not use the -t argument to name
165a table, the commands apply to the default filter table.
166With the exception of both the
167.B "-Z"
168and
169.B "--atomic-file"
170commands, only one command may be used on the command line at a time.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000171.TP
172.B "-A, --append"
173Append a rule to the end of the selected chain.
174.TP
175.B "-D, --delete"
Bart De Schuymerabc84172002-11-06 21:02:33 +0000176Delete the specified rule from the selected chain. There are two ways to
177use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000178to delete, syntax: start_nr[:end_nr]. Using negative numbers is allowed, for more
179details about using negative numbers, see the -I command. The second usage is by
180specifying the complete rule as it would have been specified when it was added.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000181.TP
182.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000183Insert the specified rule into the selected chain at the specified rule number.
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000184If the current number of rules equals N, then the specified number can be
185between -N and N+1. For a positive number i, it holds that i and i-N-1 specify the
186same place in the chain where the rule should be inserted. The number 0 specifies
187the place past the last rule in the chain and using this number is therefore
188equivalent with using the -A command.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000189.TP
190.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000191Set the policy for the chain to the given target. The policy can be
192.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000193.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000194.B "-F, --flush"
195Flush the selected chain. If no chain is selected, then every chain will be
196flushed. Flushing the chain does not change the policy of the
197chain, however.
198.TP
199.B "-Z, --zero"
200Set the counters of the selected chain to zero. If no chain is selected, all the counters
201are set to zero. The
202.B "-Z"
203command can be used in conjunction with the
204.B "-L"
205command.
206When both the
207.B "-Z"
208and
209.B "-L"
210commands are used together in this way, the rule counters are printed on the screen
211before they are set to zero.
212.TP
213.B "-L, --list"
214List all rules in the selected chain. If no chain is selected, all chains
215are listed.
216.br
217The following three options change the output of the
218.B "-L"
219list command:
220.br
221.B "--Ln"
222.br
223Places the rule number in front of every rule.
224.br
225.B "--Lc"
226.br
227Shows the counters at the end of each rule displayed by the
228.B "-L"
229command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
230.br
231.B "--Lx"
232.br
233The output of the
234.B "--Lx"
235option may be used to create a set of
236.B ebtables
237commands. You may use this set of commands in an
238.B ebtables
239boot or reload
240script. For example the output could be used at system startup.
241The
242.B "--Lx"
243option is incompatible with both of the other
244.B "--Ln"
245and
246.B "--Lc"
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000247chain listing options.
248.br
249.B "--Lmac2"
250.br
251Shows all MAC addresses with the same length, adding leading zeroes
252if necessary. The default representation omits zeroes in the addresses
253when they are not needed.
254.br
Bart De Schuymer7085d662003-02-25 22:33:28 +0000255All necessary
256.B ebtables
257commands for making the current list of
258user-defined chains in the kernel and any commands issued by the user to
259rename the standard
260.B ebtables
261chains will be listed, when no chain name is
262supplied for the
263.B "-L"
264command while using the
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000265.B "--Lx"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000266option.
267.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000268.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000269Create a new user-defined chain with the given name. The number of
270user-defined chains is unlimited. A user-defined chain name has maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000271length of 31 characters. The standard policy of the user-defined chain is
272ACCEPT. You can initialize the new chain with another policy by using the
273.B -P
274option. Unlike the
275.B -P
276command, you only need to specify the policy, not the chain name.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000277.TP
278.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000279Delete the specified user-defined chain. There must be no remaining references
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000280to the specified chain, otherwise
Bart De Schuymer29749c62002-06-25 21:27:57 +0000281.B ebtables
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000282will refuse to delete it. If no chain is specified, all user-defined
283chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000284.TP
285.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000286Rename the specified chain to a new name. Besides renaming a user-defined
287chain, you may rename a standard chain name to a name that suits your
288taste. For example, if you like PREBRIDGING more than PREROUTING,
289then you can use the -E command to rename the PREROUTING chain. If you do
290rename one of the standard
291.B ebtables
292chain names, please be sure to mention
293this fact should you post a question on the
294.B ebtables
295mailing lists.
296It would be wise to use the standard name in your post. Renaming a standard
297.B ebtables
298chain in this fashion has no effect on the structure or function
299of the
300.B ebtables
301kernel table.
302.TP
303.B "--init-table"
304Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000305.TP
306.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000307Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000308file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000309to the file. The file can be specified using the
310.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000311command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000312.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000313.TP
314.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000315Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000316file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000317to the file. The file can be specified using the
318.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000319command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000320.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000321.TP
322.B "--atomic-commit"
323Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000324file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000325certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000326time and allowing atomic updates of the tables. The file which contains
327the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000328.B "--atomic-init"
329or the
330.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000331command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000332.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000333command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000334.IR EBTABLES_ATOMIC_FILE " environment variable"
335allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000336committing it to the kernel.
337.TP
338.B "--atomic-file -Z"
339The counters stored in a file with, say,
340.B "--atomic-init"
341can be optionally zeroed by supplying the
342.B "-Z"
343command. You may also zero the counters by setting the
344.IR EBTABLES_ATOMIC_FILE " environment variable."
345
346.SS MISCELLANOUS COMMANDS
347.TP
348.B "-V, --version"
349Show the version of the ebtables userspace program.
350.TP
351.B "-h, --help"
352Give a brief description of the command syntax. Here you can also specify
353names of extensions and
354.B ebtables
355will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
356Specify
357.I list_extensions
358to list all extensions supported by the userspace
359utility.
360.TP
361.BR "-j, --jump " "\fItarget\fP"
362The target of the rule. This is one of the following values:
363.BR ACCEPT ,
364.BR DROP ,
365.BR CONTINUE ,
366.BR RETURN ,
367a target extension (see
368.BR "TARGET EXTENSIONS" ")"
369or a user-defined chain name.
370.TP
371.B --atomic-file file
372Let the command operate on the specified file. The data of the table to
373operate on will be extracted from the file and the result of the operation
374will be saved back into the file. If specified, this option should come
375before the command specification. An alternative that should be preferred,
376is setting the
377.IR EBTABLES_ATOMIC_FILE " environment variable."
378.TP
379.B -M, --modprobe program
380When talking to the kernel, use this program to try to automatically load
381missing kernel modules.
382
Bart De Schuymer29749c62002-06-25 21:27:57 +0000383.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000384RULE-SPECIFICATIONS
385The following command line arguments make up a rule specification (as used
386in the add and delete commands). A "!" option before the specification
387inverts the test for that specification. Apart from these standard rule
388specifications there are some other command line arguments of interest.
389See both the
390.BR "MATCH-EXTENSIONS"
391and the
392.BR "WATCHER-EXTENSION(S)"
393below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000394.TP
395.BR "-p, --protocol " "[!] \fIprotocol\fP"
396The protocol that was responsible for creating the frame. This can be a
397hexadecimal number, above
398.IR 0x0600 ,
399a name (e.g.
400.I ARP
401) or
402.BR LENGTH .
403The protocol field of the Ethernet frame can be used to denote the
404length of the header (802.2/802.3 networks). When the value of that field is
405below (or equals)
406.IR 0x0600 ,
407the value equals the size of the header and shouldn't be used as a
408protocol number. Instead, all frames where the protocol field is used as
409the length field are assumed to be of the same 'protocol'. The protocol
410name used in
411.B ebtables
412for these frames is
413.BR LENGTH .
414.br
415The file
416.B /etc/ethertypes
417can be used to show readable
418characters instead of hexadecimal numbers for the protocols. For example,
419.I 0x0800
420will be represented by
421.IR IPV4 .
422The use of this file is not case sensitive.
423See that file for more information. The flag
424.B --proto
425is an alias for this option.
426.TP
427.BR "-i, --in-interface " "[!] \fIname\fP"
428The interface via which a frame is received (for the
429.BR INPUT ,
430.BR FORWARD ,
431.BR PREROUTING " and " BROUTING
432chains). The flag
433.B --in-if
434is an alias for this option.
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000435If the interface name ends with '+', then
436any interface name that begins with this name will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000437.TP
438.BR "--logical-in " "[!] \fIname\fP"
439The (logical) bridge interface via which a frame is received (for the
440.BR INPUT ,
441.BR FORWARD ,
442.BR PREROUTING " and " BROUTING
443chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000444If the interface name ends with '+', then
445any interface name that begins with this name will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000446.TP
447.BR "-o, --out-interface " "[!] \fIname\fP"
448The interface via which a frame is going to be sent (for the
449.BR OUTPUT ,
450.B FORWARD
451and
452.B POSTROUTING
453chains). The flag
454.B --out-if
455is an alias for this option.
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000456If the interface name ends with '+', then
457any interface name that begins with this name will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000458.TP
459.BR "--logical-out " "[!] \fIname\fP"
460The (logical) bridge interface via which a frame is going to be sent (for
461the
462.BR OUTPUT ,
463.B FORWARD
464and
465.B POSTROUTING
466chains).
Bart De Schuymer37d520d2004-10-24 07:36:15 +0000467If the interface name ends with '+', then
468any interface name that begins with this name will match.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000469.TP
470.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
471The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000472numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000473Multicast, Broadcast or BGA (Bridge Group Address).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000474.br
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000475.BR "Unicast " "= 00:00:00:00:00:00/01:00:00:00:00:00,"
476.BR "Multicast " "= 01:00:00:00:00:00/01:00:00:00:00:00,"
477.BR "Broadcast " "= ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
478.BR "BGA " "= 01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
479Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000480address will also match the multicast specification. The flag
481.B --src
482is an alias for this option.
483.TP
484.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
485The destination mac address. See -s (above) for more details. The flag
486.B --dst
487is an alias for this option.
488
Bart De Schuymer7085d662003-02-25 22:33:28 +0000489.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000490.B ebtables
491extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000492to explicitly load them with a -m option like in
493.BR iptables .
494However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000495extensions deal with functionality supported by supplemental kernel modules.
Bart De Schuymer7350b042003-06-24 19:53:19 +0000496.SS 802.3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000497Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer7350b042003-06-24 19:53:19 +0000498.BR "LENGTH " (see " protocol " above).
499.TP
500.BR "--802_3-sap " "[!] \fIsap\fP"
501DSAP and SSAP are two one byte 802.3 fields. The bytes are always
502equal, so only one byte (hexadecimal) is needed as an argument.
503.TP
504.BR "--802_3-type " "[!] \fItype\fP"
505If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
506be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000507(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000508checked for type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000509.SS arp
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000510Specify arp fields. The protocol must be specified as
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000511.BR ARP " or " RARP .
512.TP
513.BR "--arp-opcode " "[!] \fIopcode\fP"
514The (r)arp opcode (decimal or a string, for more details see
515.BR "ebtables -h arp" ).
516.TP
517.BR "--arp-htype " "[!] \fIhardware type\fP"
518The hardware type, this can be a decimal or the string "Ethernet". This
519is normally Ethernet (value 1).
520.TP
521.BR "--arp-ptype " "[!] \fIprotocol type\fP"
522The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
523This is normally IPv4 (0x0800).
524.TP
525.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
526The ARP IP source address specification.
527.TP
528.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
529The ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000530.TP
531.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
532The ARP MAC source address specification.
533.TP
534.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
535The ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000536.SS ip
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000537Specify ip fields. The protocol must be specified as
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000538.BR IPv4 .
539.TP
540.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
541The source ip address.
542The flag
543.B --ip-src
544is an alias for this option.
545.TP
546.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
547The destination ip address.
548The flag
549.B --ip-dst
550is an alias for this option.
551.TP
552.BR "--ip-tos " "[!] \fItos\fP"
553The ip type of service, in hexadecimal numbers.
554.BR IPv4 .
555.TP
556.BR "--ip-protocol " "[!] \fIprotocol\fP"
557The ip protocol.
558The flag
559.B --ip-proto
560is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000561.TP
562.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
563The source port or port range for the ip protocols 6 (TCP) and 17
564(UDP). If the first port is omitted, "0" is assumed; if the last
565is omitted, "65535" is assumed. The flag
566.B --ip-sport
567is an alias for this option.
568.TP
569.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
570The destination port or port range for ip protocols 6 (TCP) and
57117 (UDP). The flag
572.B --ip-dport
573is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000574.SS limit
575This module matches at a limited rate using a token bucket filter.
576A rule using this extension will match until this limit is reached.
577It can be used with the
578.B --log
579watcher
580to give limited logging, for example. Its use is the same as the limit
581match of iptables.
582.TP
583.BR "--limit " "[\fIvalue\fP]"
584Maximum average matching rate: specified as a number, with an optional
585`/second', `/minute', `/hour', or `/day' suffix; the default is 3/hour.
586.TP
587.BR "--limit-burst " "[\fInumber\fP]"
588Maximum initial number of packets to match: this number gets recharged by
589one every time the limit specified above is not reached, up to this
590number; the default is 5.
591.SS pkttype
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000592.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000593.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000594.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
595Matches frames with the given unsigned mark value. If a mark value and
596mask is specified, the logical AND of the mark value of the frame and
597the user-specified mask is taken before comparing it with the user-specified
598mark value. If only a mask is specified (start with '/') the logical AND
599of the mark value of the frame and the user-specified mark is taken and
600the result is compared with zero.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000601.SS pkttype
602.TP
603.BR "--pkttype-type " "[!] \fItype\fP"
604Matches on the Ethernet "class" of the frame, which is determined by the
605generic networking code. Possible values: broadcast (MAC destination is
606broadcast address), multicast (MAC destination is multicast address),
607host (MAC destination is the receiving network device) or otherhost
608(none of the above).
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000609.SS stp
610Specify stp BPDU (bridge protocol data unit) fields. The destination
611address must be specified as the bridge group address (BGA).
612.TP
613.BR "--stp-type " "[!] \fItype\fP"
614The BPDU type (0-255), special recognized types:
615.BR config ": configuration BPDU (=0) and"
616.BR tcn ": topology change notification BPDU (=128)."
617.TP
618.BR "--stp-flags " "[!] \fIflag\fP"
619The BPDU flag (0-255), special recognized flags:
620.BR topology-change ": the topology change flag (=1)"
621.BR topology-change-ack ": the topology change acknowledgement flag (=128)."
622.TP
623.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
624The root priority (0-65535) range.
625.TP
626.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
627The root mac address, see the option
628.BR -s " for more details."
629.TP
630.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
631The root path cost (0-4294967295) range.
632.TP
633.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
634The BPDU's sender priority (0-65535) range.
635.TP
636.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
637The BPDU's sender mac address, see the option
638.BR -s " for more details."
639.TP
640.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
641The port identifier (0-65535) range.
642.TP
643.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
644The message age timer (0-65535) range.
645.TP
646.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
647The max age timer (0-65535) range.
648.TP
649.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
650The hello time timer (0-65535) range.
651.TP
652.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
653The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000654.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000655Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000656The protocol must be specified as
Bart De Schuymer7085d662003-02-25 22:33:28 +0000657.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000658.TP
659.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000660The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000661.TP
662.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000663The user_priority field. Decimal number from 0 to 7.
664The VID should be set to 0 ("null VID") or unspecified
665(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000666.TP
fnm3ed7e9012002-06-25 16:43:23 +0000667.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000668The encapsulated Ethernet frame type/length.
669Specified as hexadecimal
670number from 0x0000 to 0xFFFF or as a symbolic name
671from
672.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000673
Bart De Schuymer7085d662003-02-25 22:33:28 +0000674.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000675Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000676see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000677.SS log
678The fact that the log module is a watcher lets us log stuff while giving a target
679by choice. Note that the log module therefore is not a target.
680.TP
681.B "--log"
682.br
683Use this if you won't specify any other log options, so if you want to use the default
684settings: log-prefix="", no arp logging, no ip logging, log-level=info.
685.TP
686.B --log-level "\fIlevel\fP"
687.br
688defines the logging level. For the possible values: ebtables -h log.
689The default level is
690.IR info .
691.TP
692.BR --log-prefix " \fItext\fP"
693.br
694defines the prefix to be printed before the logging information.
695.TP
696.B --log-ip
697.br
698will log the ip information when a frame made by the ip protocol matches
699the rule. The default is no ip information logging.
700.TP
701.B --log-arp
702.br
703will log the (r)arp information when a frame made by the (r)arp protocols
704matches the rule. The default is no (r)arp information logging.
705.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000706.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000707.B arpreply
708The
709.B arpreply
710target can be used in the
711.BR PREROUTING " chain of the " nat " table."
712If this target sees an arp request it will automatically reply
713with an arp reply. The used MAC address for the reply can be specified.
714When the arp message is not an arp request, it is ignored by this target.
715.TP
716.BR "--arpreply-mac " "\fIaddress\fP"
717Specifies the MAC address to reply with: the Ethernet source MAC and the
718ARP payload source MAC will be filled in with this address.
719.TP
720.BR "--arpreply-target " "\fItarget\fP"
721Specifies the standard target. After sending the arp reply, the rule still
722has to give a standard target so
723.B ebtables
724knows what to do. The default target is DROP.
725.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000726.B dnat
727The
728.B dnat
729target can only be used in the
730.BR BROUTING " chain of the " broute " table and the "
731.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
732It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000733.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000734.BR "--to-destination " "\fIaddress\fP"
735.br
736The flag
737.B --to-dst
738is an alias for this option.
739.TP
740.BR "--dnat-target " "\fItarget\fP"
741.br
742Specifies the standard target. After doing the dnat, the rule still has to
743give a standard target so
744.B ebtables
745knows what to do.
746The default target is ACCEPT. Making it CONTINUE could let you use
747multiple target extensions on the same frame. Making it DROP only makes
748sense in the BROUTING chain but using the redirect target is more logical
749there. RETURN is also allowed. Note
750that using RETURN in a base chain is not allowed.
751.SS
752.B mark
753The mark target can be used in every chain of every table. It is possible
754to use the marking of a frame/packet in both ebtables and iptables,
755if the br-nf code is compiled into the kernel. Both put the marking at the
756same place. So, you can consider this fact as a feature, or as something to
757watch out for.
758.TP
759.BR "--set-mark " "\fIvalue\fP"
760.br
761Mark the frame with the specified unsigned value.
762.TP
763.BR "--mark-target " "\fItarget\fP"
764.br
765Specifies the standard target. After marking the frame, the rule
766still has to give a standard target so
767.B ebtables
768knows what to do.
769The default target is ACCEPT. Making it CONTINUE can let you do other
770things with the frame in other rules of the chain.
771.SS
772.B redirect
773The
774.B redirect
775target will change the MAC target address to that of the bridge device the
776frame arrived on. This target can only be used in the
777.BR BROUTING " chain of the " broute " table and the "
778.BR PREROUTING " chain of the " nat " table."
779.TP
780.BR "--redirect-target " "\fItarget\fP"
781.br
782Specifies the standard target. After doing the MAC redirect, the rule
783still has to give a standard target so
784.B ebtables
785knows what to do.
786The default target is ACCEPT. Making it CONTINUE could let you use
787multiple target extensions on the same frame. Making it DROP in the
788BROUTING chain will let the frames be routed. RETURN is also allowed. Note
789that using RETURN in a base chain is not allowed.
790.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000791.B snat
792The
793.B snat
794target can only be used in the
795.BR POSTROUTING " chain of the " nat " table."
796It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000797.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000798.BR "--to-source " "\fIaddress\fP"
799.br
800The flag
801.B --to-src
802is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000803.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000804.BR "--snat-target " "\fItarget\fP"
805.br
806Specifies the standard target. After doing the snat, the rule still has
807to give a standard target so
808.B ebtables
809knows what to do.
810The default target is ACCEPT. Making it CONTINUE could let you use
811multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000812make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000813that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000814.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000815.SH FILES
816.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000817.SH ENVIRONMENT VARIABLES
818.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000819.SH MAILINGLISTS
820.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000821.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000822.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000823.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000824.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)