blob: 79014b6c24268c43ade32a86f28e1b920d7cae17 [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.
74The user can create new (user-defined) chains which can be used as the 'target' of a rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000075
76.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +000077A firewall rule specifies criteria for an Ethernet frame and a frame
78processing specification called a target. When a frame matches a rule,
79then the next action performed by the kernel is specified by the target.
80The target can be one of these values:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000081.IR ACCEPT ,
82.IR DROP ,
83.IR CONTINUE ,
Bart De Schuymer29749c62002-06-25 21:27:57 +000084.IR RETURN ,
Bart De Schuymer7085d662003-02-25 22:33:28 +000085an 'extension' (see below) or a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000086.PP
87.I ACCEPT
88means to let the frame through.
89.I DROP
90means the frame has to be dropped.
91.I CONTINUE
92means the next rule has to be checked. This can be handy to know how many
Bart De Schuymer29749c62002-06-25 21:27:57 +000093frames pass a certain point in the chain or to log those frames.
94.I RETURN
95means stop traversing this chain and resume at the next rule in the
96previous (calling) chain.
Bart De Schuymer7085d662003-02-25 22:33:28 +000097For the extension targets please see 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 Schuymer7085d662003-02-25 22:33:28 +0000101As stated earlier, there are three Ethernet frame tables in the Linux
102kernel. The tables are
103.BR filter ", " nat " and " broute .
104Of these three tables,
105the filter table is the default table that the
106.B ebtables
107command operates on.
108If you are working with the filter table, then you can drop the '-t filter'
109argument to the ebtables command. However, you will need to provide
110the -t argument for the other two tables. The -t argument must be the
111first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000112.TP
113.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000114.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000115.BR filter ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000116is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000117.B INPUT
118(for frames destined for the bridge itself),
119.B OUTPUT
120(for locally-generated frames) and
121.B FORWARD
122(for frames being bridged).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000123.br
124.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000125.BR nat ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000126is used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000127.B PREROUTING
128(for altering frames as soon as they come in),
129.B OUTPUT
130(for altering locally generated frames before they are bridged) and
131.B POSTROUTING
132(for altering frames as they are about to go out). A small note on the naming
133of chains POSTROUTING and PREROUTING: it would be more accurate to call them
134PREFORWARDING and POSTFORWARDING, but for all those who come from the
135.BR iptables " world to " ebtables
136it is easier to have the same names.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000137.br
138.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000139.BR 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 Schuymer7085d662003-02-25 22:33:28 +0000144have special meaning in the broute table.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000145.B DROP
146actually means the frame has to be routed, while
147.B ACCEPT
148means the frame has to be bridged. The
149.B BROUTING
150chain is traversed very early. It is only traversed by frames entering on
Bart De Schuymer7085d662003-02-25 22:33:28 +0000151a bridge enslaved NIC that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000152would be bridged, but you can decide otherwise here. The
153.B redirect
154target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000155.SH EBTABLES COMMAND LINE ARGUMENTS
156After the initial ebtables -t, table command line argument, the remaining
157arguments can be divided into several different groups. These groups
158are commands, miscellaneous commands, rule-specifications, match-extensions,
159and watcher-extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000160.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000161The ebtables command arguments specify the actions to perform on the table
162defined with the -t argument. If you do not use the -t argument to name
163a table, the commands apply to the default filter table.
164With the exception of both the
165.B "-Z"
166and
167.B "--atomic-file"
168commands, only one command may be used on the command line at a time.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000169.TP
170.B "-A, --append"
171Append a rule to the end of the selected chain.
172.TP
173.B "-D, --delete"
Bart De Schuymerabc84172002-11-06 21:02:33 +0000174Delete the specified rule from the selected chain. There are two ways to
175use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000176to delete, syntax: start_nr[:end_nr]. Using negative numbers is allowed, for more
177details about using negative numbers, see the -I command. The second usage is by
178specifying the complete rule as it would have been specified when it was added.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000179.TP
180.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000181Insert the specified rule into the selected chain at the specified rule number.
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000182If the current number of rules equals N, then the specified number can be
183between -N and N+1. For a positive number i, it holds that i and i-N-1 specify the
184same place in the chain where the rule should be inserted. The number 0 specifies
185the place past the last rule in the chain and using this number is therefore
186equivalent with using the -A command.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000187.TP
188.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000189Set the policy for the chain to the given target. The policy can be
190.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000191.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000192.B "-F, --flush"
193Flush the selected chain. If no chain is selected, then every chain will be
194flushed. Flushing the chain does not change the policy of the
195chain, however.
196.TP
197.B "-Z, --zero"
198Set the counters of the selected chain to zero. If no chain is selected, all the counters
199are set to zero. The
200.B "-Z"
201command can be used in conjunction with the
202.B "-L"
203command.
204When both the
205.B "-Z"
206and
207.B "-L"
208commands are used together in this way, the rule counters are printed on the screen
209before they are set to zero.
210.TP
211.B "-L, --list"
212List all rules in the selected chain. If no chain is selected, all chains
213are listed.
214.br
215The following three options change the output of the
216.B "-L"
217list command:
218.br
219.B "--Ln"
220.br
221Places the rule number in front of every rule.
222.br
223.B "--Lc"
224.br
225Shows the counters at the end of each rule displayed by the
226.B "-L"
227command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
228.br
229.B "--Lx"
230.br
231The output of the
232.B "--Lx"
233option may be used to create a set of
234.B ebtables
235commands. You may use this set of commands in an
236.B ebtables
237boot or reload
238script. For example the output could be used at system startup.
239The
240.B "--Lx"
241option is incompatible with both of the other
242.B "--Ln"
243and
244.B "--Lc"
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000245chain listing options.
246.br
247.B "--Lmac2"
248.br
249Shows all MAC addresses with the same length, adding leading zeroes
250if necessary. The default representation omits zeroes in the addresses
251when they are not needed.
252.br
Bart De Schuymer7085d662003-02-25 22:33:28 +0000253All necessary
254.B ebtables
255commands for making the current list of
256user-defined chains in the kernel and any commands issued by the user to
257rename the standard
258.B ebtables
259chains will be listed, when no chain name is
260supplied for the
261.B "-L"
262command while using the
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000263.B "--Lx"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000264option.
265.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000266.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000267Create a new user-defined chain with the given name. The number of
268user-defined chains is unlimited. A user-defined chain name has maximum
Bart De Schuymer64182a32004-01-21 20:39:54 +0000269length of 31 characters. The standard policy of the user-defined chain is
270ACCEPT. You can initialize the new chain with another policy by using the
271.B -P
272option. Unlike the
273.B -P
274command, you only need to specify the policy, not the chain name.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000275.TP
276.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000277Delete the specified user-defined chain. There must be no remaining references
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000278to the specified chain, otherwise
Bart De Schuymer29749c62002-06-25 21:27:57 +0000279.B ebtables
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000280will refuse to delete it. If no chain is specified, all user-defined
281chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000282.TP
283.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000284Rename the specified chain to a new name. Besides renaming a user-defined
285chain, you may rename a standard chain name to a name that suits your
286taste. For example, if you like PREBRIDGING more than PREROUTING,
287then you can use the -E command to rename the PREROUTING chain. If you do
288rename one of the standard
289.B ebtables
290chain names, please be sure to mention
291this fact should you post a question on the
292.B ebtables
293mailing lists.
294It would be wise to use the standard name in your post. Renaming a standard
295.B ebtables
296chain in this fashion has no effect on the structure or function
297of the
298.B ebtables
299kernel table.
300.TP
301.B "--init-table"
302Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000303.TP
304.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000305Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000306file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000307to the file. The file can be specified using the
308.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000309command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000310.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000311.TP
312.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000313Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000314file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000315to the file. The file can be specified using the
316.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000317command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000318.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000319.TP
320.B "--atomic-commit"
321Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000322file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000323certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000324time and allowing atomic updates of the tables. The file which contains
325the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000326.B "--atomic-init"
327or the
328.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000329command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000330.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000331command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000332.IR EBTABLES_ATOMIC_FILE " environment variable"
333allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000334committing it to the kernel.
335.TP
336.B "--atomic-file -Z"
337The counters stored in a file with, say,
338.B "--atomic-init"
339can be optionally zeroed by supplying the
340.B "-Z"
341command. You may also zero the counters by setting the
342.IR EBTABLES_ATOMIC_FILE " environment variable."
343
344.SS MISCELLANOUS COMMANDS
345.TP
346.B "-V, --version"
347Show the version of the ebtables userspace program.
348.TP
349.B "-h, --help"
350Give a brief description of the command syntax. Here you can also specify
351names of extensions and
352.B ebtables
353will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
354Specify
355.I list_extensions
356to list all extensions supported by the userspace
357utility.
358.TP
359.BR "-j, --jump " "\fItarget\fP"
360The target of the rule. This is one of the following values:
361.BR ACCEPT ,
362.BR DROP ,
363.BR CONTINUE ,
364.BR RETURN ,
365a target extension (see
366.BR "TARGET EXTENSIONS" ")"
367or a user-defined chain name.
368.TP
369.B --atomic-file file
370Let the command operate on the specified file. The data of the table to
371operate on will be extracted from the file and the result of the operation
372will be saved back into the file. If specified, this option should come
373before the command specification. An alternative that should be preferred,
374is setting the
375.IR EBTABLES_ATOMIC_FILE " environment variable."
376.TP
377.B -M, --modprobe program
378When talking to the kernel, use this program to try to automatically load
379missing kernel modules.
380
Bart De Schuymer29749c62002-06-25 21:27:57 +0000381.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000382RULE-SPECIFICATIONS
383The following command line arguments make up a rule specification (as used
384in the add and delete commands). A "!" option before the specification
385inverts the test for that specification. Apart from these standard rule
386specifications there are some other command line arguments of interest.
387See both the
388.BR "MATCH-EXTENSIONS"
389and the
390.BR "WATCHER-EXTENSION(S)"
391below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000392.TP
393.BR "-p, --protocol " "[!] \fIprotocol\fP"
394The protocol that was responsible for creating the frame. This can be a
395hexadecimal number, above
396.IR 0x0600 ,
397a name (e.g.
398.I ARP
399) or
400.BR LENGTH .
401The protocol field of the Ethernet frame can be used to denote the
402length of the header (802.2/802.3 networks). When the value of that field is
403below (or equals)
404.IR 0x0600 ,
405the value equals the size of the header and shouldn't be used as a
406protocol number. Instead, all frames where the protocol field is used as
407the length field are assumed to be of the same 'protocol'. The protocol
408name used in
409.B ebtables
410for these frames is
411.BR LENGTH .
412.br
413The file
414.B /etc/ethertypes
415can be used to show readable
416characters instead of hexadecimal numbers for the protocols. For example,
417.I 0x0800
418will be represented by
419.IR IPV4 .
420The use of this file is not case sensitive.
421See that file for more information. The flag
422.B --proto
423is an alias for this option.
424.TP
425.BR "-i, --in-interface " "[!] \fIname\fP"
426The interface via which a frame is received (for the
427.BR INPUT ,
428.BR FORWARD ,
429.BR PREROUTING " and " BROUTING
430chains). The flag
431.B --in-if
432is an alias for this option.
433.TP
434.BR "--logical-in " "[!] \fIname\fP"
435The (logical) bridge interface via which a frame is received (for the
436.BR INPUT ,
437.BR FORWARD ,
438.BR PREROUTING " and " BROUTING
439chains).
440.TP
441.BR "-o, --out-interface " "[!] \fIname\fP"
442The interface via which a frame is going to be sent (for the
443.BR OUTPUT ,
444.B FORWARD
445and
446.B POSTROUTING
447chains). The flag
448.B --out-if
449is an alias for this option.
450.TP
451.BR "--logical-out " "[!] \fIname\fP"
452The (logical) bridge interface via which a frame is going to be sent (for
453the
454.BR OUTPUT ,
455.B FORWARD
456and
457.B POSTROUTING
458chains).
459.TP
460.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
461The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000462numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000463Multicast, Broadcast or BGA (Bridge Group Address).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000464.br
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000465.BR "Unicast " "= 00:00:00:00:00:00/01:00:00:00:00:00,"
466.BR "Multicast " "= 01:00:00:00:00:00/01:00:00:00:00:00,"
467.BR "Broadcast " "= ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
468.BR "BGA " "= 01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
469Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000470address will also match the multicast specification. The flag
471.B --src
472is an alias for this option.
473.TP
474.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
475The destination mac address. See -s (above) for more details. The flag
476.B --dst
477is an alias for this option.
478
Bart De Schuymer7085d662003-02-25 22:33:28 +0000479.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000480.B ebtables
481extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000482to explicitly load them with a -m option like in
483.BR iptables .
484However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000485extensions deal with functionality supported by supplemental kernel modules.
Bart De Schuymer7350b042003-06-24 19:53:19 +0000486.SS 802.3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000487Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer7350b042003-06-24 19:53:19 +0000488.BR "LENGTH " (see " protocol " above).
489.TP
490.BR "--802_3-sap " "[!] \fIsap\fP"
491DSAP and SSAP are two one byte 802.3 fields. The bytes are always
492equal, so only one byte (hexadecimal) is needed as an argument.
493.TP
494.BR "--802_3-type " "[!] \fItype\fP"
495If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
496be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000497(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000498checked for type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000499.SS arp
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000500Specify arp fields. The protocol must be specified as
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000501.BR ARP " or " RARP .
502.TP
503.BR "--arp-opcode " "[!] \fIopcode\fP"
504The (r)arp opcode (decimal or a string, for more details see
505.BR "ebtables -h arp" ).
506.TP
507.BR "--arp-htype " "[!] \fIhardware type\fP"
508The hardware type, this can be a decimal or the string "Ethernet". This
509is normally Ethernet (value 1).
510.TP
511.BR "--arp-ptype " "[!] \fIprotocol type\fP"
512The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
513This is normally IPv4 (0x0800).
514.TP
515.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
516The ARP IP source address specification.
517.TP
518.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
519The ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000520.TP
521.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
522The ARP MAC source address specification.
523.TP
524.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
525The ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000526.SS ip
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000527Specify ip fields. The protocol must be specified as
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000528.BR IPv4 .
529.TP
530.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
531The source ip address.
532The flag
533.B --ip-src
534is an alias for this option.
535.TP
536.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
537The destination ip address.
538The flag
539.B --ip-dst
540is an alias for this option.
541.TP
542.BR "--ip-tos " "[!] \fItos\fP"
543The ip type of service, in hexadecimal numbers.
544.BR IPv4 .
545.TP
546.BR "--ip-protocol " "[!] \fIprotocol\fP"
547The ip protocol.
548The flag
549.B --ip-proto
550is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000551.TP
552.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
553The source port or port range for the ip protocols 6 (TCP) and 17
554(UDP). If the first port is omitted, "0" is assumed; if the last
555is omitted, "65535" is assumed. The flag
556.B --ip-sport
557is an alias for this option.
558.TP
559.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
560The destination port or port range for ip protocols 6 (TCP) and
56117 (UDP). The flag
562.B --ip-dport
563is an alias for this option.
Bart De Schuymer1b4ccfa2004-10-23 11:20:34 +0000564.SS limit
565This module matches at a limited rate using a token bucket filter.
566A rule using this extension will match until this limit is reached.
567It can be used with the
568.B --log
569watcher
570to give limited logging, for example. Its use is the same as the limit
571match of iptables.
572.TP
573.BR "--limit " "[\fIvalue\fP]"
574Maximum average matching rate: specified as a number, with an optional
575`/second', `/minute', `/hour', or `/day' suffix; the default is 3/hour.
576.TP
577.BR "--limit-burst " "[\fInumber\fP]"
578Maximum initial number of packets to match: this number gets recharged by
579one every time the limit specified above is not reached, up to this
580number; the default is 5.
581.SS pkttype
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000582.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000583.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000584.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
585Matches frames with the given unsigned mark value. If a mark value and
586mask is specified, the logical AND of the mark value of the frame and
587the user-specified mask is taken before comparing it with the user-specified
588mark value. If only a mask is specified (start with '/') the logical AND
589of the mark value of the frame and the user-specified mark is taken and
590the result is compared with zero.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000591.SS pkttype
592.TP
593.BR "--pkttype-type " "[!] \fItype\fP"
594Matches on the Ethernet "class" of the frame, which is determined by the
595generic networking code. Possible values: broadcast (MAC destination is
596broadcast address), multicast (MAC destination is multicast address),
597host (MAC destination is the receiving network device) or otherhost
598(none of the above).
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000599.SS stp
600Specify stp BPDU (bridge protocol data unit) fields. The destination
601address must be specified as the bridge group address (BGA).
602.TP
603.BR "--stp-type " "[!] \fItype\fP"
604The BPDU type (0-255), special recognized types:
605.BR config ": configuration BPDU (=0) and"
606.BR tcn ": topology change notification BPDU (=128)."
607.TP
608.BR "--stp-flags " "[!] \fIflag\fP"
609The BPDU flag (0-255), special recognized flags:
610.BR topology-change ": the topology change flag (=1)"
611.BR topology-change-ack ": the topology change acknowledgement flag (=128)."
612.TP
613.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
614The root priority (0-65535) range.
615.TP
616.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
617The root mac address, see the option
618.BR -s " for more details."
619.TP
620.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
621The root path cost (0-4294967295) range.
622.TP
623.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
624The BPDU's sender priority (0-65535) range.
625.TP
626.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
627The BPDU's sender mac address, see the option
628.BR -s " for more details."
629.TP
630.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
631The port identifier (0-65535) range.
632.TP
633.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
634The message age timer (0-65535) range.
635.TP
636.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
637The max age timer (0-65535) range.
638.TP
639.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
640The hello time timer (0-65535) range.
641.TP
642.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
643The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000644.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000645Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000646The protocol must be specified as
Bart De Schuymer7085d662003-02-25 22:33:28 +0000647.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000648.TP
649.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000650The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000651.TP
652.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000653The user_priority field. Decimal number from 0 to 7.
654The VID should be set to 0 ("null VID") or unspecified
655(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000656.TP
fnm3ed7e9012002-06-25 16:43:23 +0000657.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000658The encapsulated Ethernet frame type/length.
659Specified as hexadecimal
660number from 0x0000 to 0xFFFF or as a symbolic name
661from
662.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000663
Bart De Schuymer7085d662003-02-25 22:33:28 +0000664.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000665Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000666see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000667.SS log
668The fact that the log module is a watcher lets us log stuff while giving a target
669by choice. Note that the log module therefore is not a target.
670.TP
671.B "--log"
672.br
673Use this if you won't specify any other log options, so if you want to use the default
674settings: log-prefix="", no arp logging, no ip logging, log-level=info.
675.TP
676.B --log-level "\fIlevel\fP"
677.br
678defines the logging level. For the possible values: ebtables -h log.
679The default level is
680.IR info .
681.TP
682.BR --log-prefix " \fItext\fP"
683.br
684defines the prefix to be printed before the logging information.
685.TP
686.B --log-ip
687.br
688will log the ip information when a frame made by the ip protocol matches
689the rule. The default is no ip information logging.
690.TP
691.B --log-arp
692.br
693will log the (r)arp information when a frame made by the (r)arp protocols
694matches the rule. The default is no (r)arp information logging.
695.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000696.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000697.B arpreply
698The
699.B arpreply
700target can be used in the
701.BR PREROUTING " chain of the " nat " table."
702If this target sees an arp request it will automatically reply
703with an arp reply. The used MAC address for the reply can be specified.
704When the arp message is not an arp request, it is ignored by this target.
705.TP
706.BR "--arpreply-mac " "\fIaddress\fP"
707Specifies the MAC address to reply with: the Ethernet source MAC and the
708ARP payload source MAC will be filled in with this address.
709.TP
710.BR "--arpreply-target " "\fItarget\fP"
711Specifies the standard target. After sending the arp reply, the rule still
712has to give a standard target so
713.B ebtables
714knows what to do. The default target is DROP.
715.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000716.B dnat
717The
718.B dnat
719target can only be used in the
720.BR BROUTING " chain of the " broute " table and the "
721.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
722It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000723.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000724.BR "--to-destination " "\fIaddress\fP"
725.br
726The flag
727.B --to-dst
728is an alias for this option.
729.TP
730.BR "--dnat-target " "\fItarget\fP"
731.br
732Specifies the standard target. After doing the dnat, the rule still has to
733give a standard target so
734.B ebtables
735knows what to do.
736The default target is ACCEPT. Making it CONTINUE could let you use
737multiple target extensions on the same frame. Making it DROP only makes
738sense in the BROUTING chain but using the redirect target is more logical
739there. RETURN is also allowed. Note
740that using RETURN in a base chain is not allowed.
741.SS
742.B mark
743The mark target can be used in every chain of every table. It is possible
744to use the marking of a frame/packet in both ebtables and iptables,
745if the br-nf code is compiled into the kernel. Both put the marking at the
746same place. So, you can consider this fact as a feature, or as something to
747watch out for.
748.TP
749.BR "--set-mark " "\fIvalue\fP"
750.br
751Mark the frame with the specified unsigned value.
752.TP
753.BR "--mark-target " "\fItarget\fP"
754.br
755Specifies the standard target. After marking the frame, the rule
756still has to give a standard target so
757.B ebtables
758knows what to do.
759The default target is ACCEPT. Making it CONTINUE can let you do other
760things with the frame in other rules of the chain.
761.SS
762.B redirect
763The
764.B redirect
765target will change the MAC target address to that of the bridge device the
766frame arrived on. This target can only be used in the
767.BR BROUTING " chain of the " broute " table and the "
768.BR PREROUTING " chain of the " nat " table."
769.TP
770.BR "--redirect-target " "\fItarget\fP"
771.br
772Specifies the standard target. After doing the MAC redirect, the rule
773still has to give a standard target so
774.B ebtables
775knows what to do.
776The default target is ACCEPT. Making it CONTINUE could let you use
777multiple target extensions on the same frame. Making it DROP in the
778BROUTING chain will let the frames be routed. RETURN is also allowed. Note
779that using RETURN in a base chain is not allowed.
780.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000781.B snat
782The
783.B snat
784target can only be used in the
785.BR POSTROUTING " chain of the " nat " table."
786It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000787.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000788.BR "--to-source " "\fIaddress\fP"
789.br
790The flag
791.B --to-src
792is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000793.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000794.BR "--snat-target " "\fItarget\fP"
795.br
796Specifies the standard target. After doing the snat, the rule still has
797to give a standard target so
798.B ebtables
799knows what to do.
800The default target is ACCEPT. Making it CONTINUE could let you use
801multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000802make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000803that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000804.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000805.SH FILES
806.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000807.SH ENVIRONMENT VARIABLES
808.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000809.SH MAILINGLISTS
810.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000811.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000812.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000813.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000814.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)