blob: 7ddddb9ddde4106b3d9e6bff5ddc6086bfbd1f2f [file] [log] [blame]
Bart De Schuymer1e9aca92003-11-09 21:18:26 +00001.TH EBTABLES 8 "09 November 2003"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00002.\"
Bart De Schuymer03aa2d62003-11-09 21:16:50 +00003.\" Man page written and maintained 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 Schuymer637ecd22003-07-13 18:53:50 +000039.BR "ebtables " [ "-t table" ] " -N chain"
40.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
269length of 31 characters.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000270.TP
271.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000272Delete the specified user-defined chain. There must be no remaining references
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000273to the specified chain, otherwise
Bart De Schuymer29749c62002-06-25 21:27:57 +0000274.B ebtables
Bart De Schuymer637ecd22003-07-13 18:53:50 +0000275will refuse to delete it. If no chain is specified, all user-defined
276chains that aren't referenced will be removed.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000277.TP
278.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000279Rename the specified chain to a new name. Besides renaming a user-defined
280chain, you may rename a standard chain name to a name that suits your
281taste. For example, if you like PREBRIDGING more than PREROUTING,
282then you can use the -E command to rename the PREROUTING chain. If you do
283rename one of the standard
284.B ebtables
285chain names, please be sure to mention
286this fact should you post a question on the
287.B ebtables
288mailing lists.
289It would be wise to use the standard name in your post. Renaming a standard
290.B ebtables
291chain in this fashion has no effect on the structure or function
292of the
293.B ebtables
294kernel table.
295.TP
296.B "--init-table"
297Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000298.TP
299.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000300Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000301file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000302to the file. The file can be specified using the
303.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000304command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000305.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000306.TP
307.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000308Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000309file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000310to the file. The file can be specified using the
311.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000312command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000313.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000314.TP
315.B "--atomic-commit"
316Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000317file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000318certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000319time and allowing atomic updates of the tables. The file which contains
320the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000321.B "--atomic-init"
322or the
323.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000324command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000325.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000327.IR EBTABLES_ATOMIC_FILE " environment variable"
328allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000329committing it to the kernel.
330.TP
331.B "--atomic-file -Z"
332The counters stored in a file with, say,
333.B "--atomic-init"
334can be optionally zeroed by supplying the
335.B "-Z"
336command. You may also zero the counters by setting the
337.IR EBTABLES_ATOMIC_FILE " environment variable."
338
339.SS MISCELLANOUS COMMANDS
340.TP
341.B "-V, --version"
342Show the version of the ebtables userspace program.
343.TP
344.B "-h, --help"
345Give a brief description of the command syntax. Here you can also specify
346names of extensions and
347.B ebtables
348will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
349Specify
350.I list_extensions
351to list all extensions supported by the userspace
352utility.
353.TP
354.BR "-j, --jump " "\fItarget\fP"
355The target of the rule. This is one of the following values:
356.BR ACCEPT ,
357.BR DROP ,
358.BR CONTINUE ,
359.BR RETURN ,
360a target extension (see
361.BR "TARGET EXTENSIONS" ")"
362or a user-defined chain name.
363.TP
364.B --atomic-file file
365Let the command operate on the specified file. The data of the table to
366operate on will be extracted from the file and the result of the operation
367will be saved back into the file. If specified, this option should come
368before the command specification. An alternative that should be preferred,
369is setting the
370.IR EBTABLES_ATOMIC_FILE " environment variable."
371.TP
372.B -M, --modprobe program
373When talking to the kernel, use this program to try to automatically load
374missing kernel modules.
375
Bart De Schuymer29749c62002-06-25 21:27:57 +0000376.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000377RULE-SPECIFICATIONS
378The following command line arguments make up a rule specification (as used
379in the add and delete commands). A "!" option before the specification
380inverts the test for that specification. Apart from these standard rule
381specifications there are some other command line arguments of interest.
382See both the
383.BR "MATCH-EXTENSIONS"
384and the
385.BR "WATCHER-EXTENSION(S)"
386below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000387.TP
388.BR "-p, --protocol " "[!] \fIprotocol\fP"
389The protocol that was responsible for creating the frame. This can be a
390hexadecimal number, above
391.IR 0x0600 ,
392a name (e.g.
393.I ARP
394) or
395.BR LENGTH .
396The protocol field of the Ethernet frame can be used to denote the
397length of the header (802.2/802.3 networks). When the value of that field is
398below (or equals)
399.IR 0x0600 ,
400the value equals the size of the header and shouldn't be used as a
401protocol number. Instead, all frames where the protocol field is used as
402the length field are assumed to be of the same 'protocol'. The protocol
403name used in
404.B ebtables
405for these frames is
406.BR LENGTH .
407.br
408The file
409.B /etc/ethertypes
410can be used to show readable
411characters instead of hexadecimal numbers for the protocols. For example,
412.I 0x0800
413will be represented by
414.IR IPV4 .
415The use of this file is not case sensitive.
416See that file for more information. The flag
417.B --proto
418is an alias for this option.
419.TP
420.BR "-i, --in-interface " "[!] \fIname\fP"
421The interface via which a frame is received (for the
422.BR INPUT ,
423.BR FORWARD ,
424.BR PREROUTING " and " BROUTING
425chains). The flag
426.B --in-if
427is an alias for this option.
428.TP
429.BR "--logical-in " "[!] \fIname\fP"
430The (logical) bridge interface via which a frame is received (for the
431.BR INPUT ,
432.BR FORWARD ,
433.BR PREROUTING " and " BROUTING
434chains).
435.TP
436.BR "-o, --out-interface " "[!] \fIname\fP"
437The interface via which a frame is going to be sent (for the
438.BR OUTPUT ,
439.B FORWARD
440and
441.B POSTROUTING
442chains). The flag
443.B --out-if
444is an alias for this option.
445.TP
446.BR "--logical-out " "[!] \fIname\fP"
447The (logical) bridge interface via which a frame is going to be sent (for
448the
449.BR OUTPUT ,
450.B FORWARD
451and
452.B POSTROUTING
453chains).
454.TP
455.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
456The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000457numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000458Multicast, Broadcast or BGA (Bridge Group Address).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000459.br
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000460.BR "Unicast " "= 00:00:00:00:00:00/01:00:00:00:00:00,"
461.BR "Multicast " "= 01:00:00:00:00:00/01:00:00:00:00:00,"
462.BR "Broadcast " "= ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
463.BR "BGA " "= 01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
464Note that a broadcast
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000465address will also match the multicast specification. The flag
466.B --src
467is an alias for this option.
468.TP
469.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
470The destination mac address. See -s (above) for more details. The flag
471.B --dst
472is an alias for this option.
473
Bart De Schuymer7085d662003-02-25 22:33:28 +0000474.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000475.B ebtables
476extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000477to explicitly load them with a -m option like in
478.BR iptables .
479However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000480extensions deal with functionality supported by supplemental kernel modules.
Bart De Schuymer7350b042003-06-24 19:53:19 +0000481.SS 802.3
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000482Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
Bart De Schuymer7350b042003-06-24 19:53:19 +0000483.BR "LENGTH " (see " protocol " above).
484.TP
485.BR "--802_3-sap " "[!] \fIsap\fP"
486DSAP and SSAP are two one byte 802.3 fields. The bytes are always
487equal, so only one byte (hexadecimal) is needed as an argument.
488.TP
489.BR "--802_3-type " "[!] \fItype\fP"
490If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
491be consulted to determine the payload protocol. This is a two byte
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000492(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
Bart De Schuymer7350b042003-06-24 19:53:19 +0000493checked for type.
Bart De Schuymera87790b2003-10-12 14:59:29 +0000494.SS among
495Match a MAC address or MAC/IP address pair versus a list of MAC addresses
496and MAC/IP address pairs.
497A list entry has the following format: xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,]. Multiple
498list entries are separated by a comma, specifying an IP address corresponding to
499the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
500but different IP address (and vice versa) can be specified. If the MAC address doesn't
501match any entry from the list, the frame doesn't match the rule (unless '!' was used).
502.TP
503.BR "--among-dst " "[!] \fIlist\fP"
504Compare the MAC destination to the given list. If the Ethernet frame has type
505.BR IPv4 " or " ARP ,
506then comparison with MAC/IP destination address pairs from the
507list is possible.
508
509.TP
510.BR "--among-src " "[!] \fIlist\fP"
511Compare the MAC source to the given list. If the Ethernet frame has type
512.BR IPv4 " or " ARP ,
513then comparison with MAC/IP source address pairs from the list
514is possible.
515
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000516.SS arp
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000517Specify arp fields. The protocol must be specified as
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000518.BR ARP " or " RARP .
519.TP
520.BR "--arp-opcode " "[!] \fIopcode\fP"
521The (r)arp opcode (decimal or a string, for more details see
522.BR "ebtables -h arp" ).
523.TP
524.BR "--arp-htype " "[!] \fIhardware type\fP"
525The hardware type, this can be a decimal or the string "Ethernet". This
526is normally Ethernet (value 1).
527.TP
528.BR "--arp-ptype " "[!] \fIprotocol type\fP"
529The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
530This is normally IPv4 (0x0800).
531.TP
532.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
533The ARP IP source address specification.
534.TP
535.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
536The ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000537.TP
538.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
539The ARP MAC source address specification.
540.TP
541.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
542The ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000543.SS ip
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000544Specify ip fields. The protocol must be specified as
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000545.BR IPv4 .
546.TP
547.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
548The source ip address.
549The flag
550.B --ip-src
551is an alias for this option.
552.TP
553.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
554The destination ip address.
555The flag
556.B --ip-dst
557is an alias for this option.
558.TP
559.BR "--ip-tos " "[!] \fItos\fP"
560The ip type of service, in hexadecimal numbers.
561.BR IPv4 .
562.TP
563.BR "--ip-protocol " "[!] \fIprotocol\fP"
564The ip protocol.
565The flag
566.B --ip-proto
567is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000568.TP
569.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
570The source port or port range for the ip protocols 6 (TCP) and 17
571(UDP). If the first port is omitted, "0" is assumed; if the last
572is omitted, "65535" is assumed. The flag
573.B --ip-sport
574is an alias for this option.
575.TP
576.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
577The destination port or port range for ip protocols 6 (TCP) and
57817 (UDP). The flag
579.B --ip-dport
580is an alias for this option.
Bart De Schuymerebf98862003-09-27 19:55:15 +0000581.SS limit
582Matches at a limited rate using a token bucket filter. A rule using
583this extension will match until this limit is reached (unless the '!'
584flag is used). It can be used in combination with the log watcher to
585give limited logging, for example. The usage/implementation is completely
586similar to that of the iptables limit match.
587.TP
588.BR --limit " \fIrate"
589Maximum average matching rate: specified as a number, with an optional
590'/second', '/minute', '/hour', or '/day' suffix; the default is 3/hour.
591.TP
592.BR --limit-burst " \fInumber"
593Maximum initial number of packets to match: this number gets recharged by
594one every time the limit specified above is not reached, up to this number;
595the default is 5.
596
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000597.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000598.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000599.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
600Matches frames with the given unsigned mark value. If a mark value and
601mask is specified, the logical AND of the mark value of the frame and
602the user-specified mask is taken before comparing it with the user-specified
603mark value. If only a mask is specified (start with '/') the logical AND
604of the mark value of the frame and the user-specified mark is taken and
605the result is compared with zero.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000606.SS pkttype
607.TP
608.BR "--pkttype-type " "[!] \fItype\fP"
609Matches on the Ethernet "class" of the frame, which is determined by the
610generic networking code. Possible values: broadcast (MAC destination is
611broadcast address), multicast (MAC destination is multicast address),
612host (MAC destination is the receiving network device) or otherhost
613(none of the above).
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000614.SS stp
615Specify stp BPDU (bridge protocol data unit) fields. The destination
616address must be specified as the bridge group address (BGA).
617.TP
618.BR "--stp-type " "[!] \fItype\fP"
619The BPDU type (0-255), special recognized types:
620.BR config ": configuration BPDU (=0) and"
621.BR tcn ": topology change notification BPDU (=128)."
622.TP
623.BR "--stp-flags " "[!] \fIflag\fP"
624The BPDU flag (0-255), special recognized flags:
625.BR topology-change ": the topology change flag (=1)"
626.BR topology-change-ack ": the topology change acknowledgement flag (=128)."
627.TP
628.BR "--stp-root-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
629The root priority (0-65535) range.
630.TP
631.BR "--stp-root-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
632The root mac address, see the option
633.BR -s " for more details."
634.TP
635.BR "--stp-root-cost " "[!] [\fIcost\fP][:\fIcost\fP]"
636The root path cost (0-4294967295) range.
637.TP
638.BR "--stp-sender-prio " "[!] [\fIprio\fP][:\fIprio\fP]"
639The BPDU's sender priority (0-65535) range.
640.TP
641.BR "--stp-sender-addr " "[!] [\fIaddress\fP][/\fImask\fP]"
642The BPDU's sender mac address, see the option
643.BR -s " for more details."
644.TP
645.BR "--stp-port " "[!] [\fIport\fP][:\fIport\fP]"
646The port identifier (0-65535) range.
647.TP
648.BR "--stp-msg-age " "[!] [\fIage\fP][:\fIage\fP]"
649The message age timer (0-65535) range.
650.TP
651.BR "--stp-max-age " "[!] [\fIage\fP][:\fIage\fP]"
652The max age timer (0-65535) range.
653.TP
654.BR "--stp-hello-time " "[!] [\fItime\fP][:\fItime\fP]"
655The hello time timer (0-65535) range.
656.TP
657.BR "--stp-forward-delay " "[!] [\fIdelay\fP][:\fIdelay\fP]"
658The forward delay timer (0-65535) range.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000659.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000660Specify 802.1Q Tag Control Information fields.
Bart De Schuymer38cd75e2003-07-25 17:44:30 +0000661The protocol must be specified as
Bart De Schuymer7085d662003-02-25 22:33:28 +0000662.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000663.TP
664.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000665The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000666.TP
667.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000668The user_priority field. Decimal number from 0 to 7.
669The VID should be set to 0 ("null VID") or unspecified
670(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000671.TP
fnm3ed7e9012002-06-25 16:43:23 +0000672.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000673The encapsulated Ethernet frame type/length.
674Specified as hexadecimal
675number from 0x0000 to 0xFFFF or as a symbolic name
676from
677.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000678
Bart De Schuymer7085d662003-02-25 22:33:28 +0000679.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000680Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000681see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000682.SS log
683The fact that the log module is a watcher lets us log stuff while giving a target
684by choice. Note that the log module therefore is not a target.
685.TP
686.B "--log"
687.br
688Use this if you won't specify any other log options, so if you want to use the default
689settings: log-prefix="", no arp logging, no ip logging, log-level=info.
690.TP
691.B --log-level "\fIlevel\fP"
692.br
693defines the logging level. For the possible values: ebtables -h log.
694The default level is
695.IR info .
696.TP
697.BR --log-prefix " \fItext\fP"
698.br
699defines the prefix to be printed before the logging information.
700.TP
701.B --log-ip
702.br
703will log the ip information when a frame made by the ip protocol matches
704the rule. The default is no ip information logging.
705.TP
706.B --log-arp
707.br
708will log the (r)arp information when a frame made by the (r)arp protocols
709matches the rule. The default is no (r)arp information logging.
710.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000711.SS
Bart De Schuymer3a339f22003-08-14 19:33:11 +0000712.B arpreply
713The
714.B arpreply
715target can be used in the
716.BR PREROUTING " chain of the " nat " table."
717If this target sees an arp request it will automatically reply
718with an arp reply. The used MAC address for the reply can be specified.
719When the arp message is not an arp request, it is ignored by this target.
720.TP
721.BR "--arpreply-mac " "\fIaddress\fP"
722Specifies the MAC address to reply with: the Ethernet source MAC and the
723ARP payload source MAC will be filled in with this address.
724.TP
725.BR "--arpreply-target " "\fItarget\fP"
726Specifies the standard target. After sending the arp reply, the rule still
727has to give a standard target so
728.B ebtables
729knows what to do. The default target is DROP.
730.SS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000731.B dnat
732The
733.B dnat
734target can only be used in the
735.BR BROUTING " chain of the " broute " table and the "
736.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
737It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000738.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000739.BR "--to-destination " "\fIaddress\fP"
740.br
741The flag
742.B --to-dst
743is an alias for this option.
744.TP
745.BR "--dnat-target " "\fItarget\fP"
746.br
747Specifies the standard target. After doing the dnat, the rule still has to
748give a standard target so
749.B ebtables
750knows what to do.
751The default target is ACCEPT. Making it CONTINUE could let you use
752multiple target extensions on the same frame. Making it DROP only makes
753sense in the BROUTING chain but using the redirect target is more logical
754there. RETURN is also allowed. Note
755that using RETURN in a base chain is not allowed.
756.SS
757.B mark
758The mark target can be used in every chain of every table. It is possible
759to use the marking of a frame/packet in both ebtables and iptables,
760if the br-nf code is compiled into the kernel. Both put the marking at the
761same place. So, you can consider this fact as a feature, or as something to
762watch out for.
763.TP
764.BR "--set-mark " "\fIvalue\fP"
765.br
766Mark the frame with the specified unsigned value.
767.TP
768.BR "--mark-target " "\fItarget\fP"
769.br
770Specifies the standard target. After marking the frame, the rule
771still has to give a standard target so
772.B ebtables
773knows what to do.
774The default target is ACCEPT. Making it CONTINUE can let you do other
775things with the frame in other rules of the chain.
776.SS
777.B redirect
778The
779.B redirect
780target will change the MAC target address to that of the bridge device the
781frame arrived on. This target can only be used in the
782.BR BROUTING " chain of the " broute " table and the "
783.BR PREROUTING " chain of the " nat " table."
784.TP
785.BR "--redirect-target " "\fItarget\fP"
786.br
787Specifies the standard target. After doing the MAC redirect, the rule
788still has to give a standard target so
789.B ebtables
790knows what to do.
791The default target is ACCEPT. Making it CONTINUE could let you use
792multiple target extensions on the same frame. Making it DROP in the
793BROUTING chain will let the frames be routed. RETURN is also allowed. Note
794that using RETURN in a base chain is not allowed.
795.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000796.B snat
797The
798.B snat
799target can only be used in the
800.BR POSTROUTING " chain of the " nat " table."
801It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000802.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000803.BR "--to-source " "\fIaddress\fP"
804.br
805The flag
806.B --to-src
807is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000808.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000809.BR "--snat-target " "\fItarget\fP"
810.br
811Specifies the standard target. After doing the snat, the rule still has
812to give a standard target so
813.B ebtables
814knows what to do.
815The default target is ACCEPT. Making it CONTINUE could let you use
816multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000817make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000818that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000819.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000820.SH FILES
821.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000822.SH ENVIRONMENT VARIABLES
823.I EBTABLES_ATOMIC_FILE
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000824.SH MAILINGLISTS
825.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000826.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000827.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000828.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000829.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)