blob: 465d63583e38b67aa24e0977a4d297e241423279 [file] [log] [blame]
Bart De Schuymer3006c8c2003-03-15 17:07:44 +00001.TH EBTABLES 8 "15 March 2003"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00002.\"
Bart De Schuymereecff422002-12-03 20:50:30 +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 Schuymer7085d662003-02-25 22:33:28 +00006.\" The man page was edited by
7.\" 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 Schuymer21aa50f2003-05-03 21:07:39 +000039.BR "ebtables " [ "-t table" ] " -" [ NX ] " chain"
Bart De Schuymera02773a2002-07-15 19:42:11 +000040.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000041.BR "ebtables " [ "-t table" ] " -E old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000042.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000043.BR "ebtables " [ "-t table" ] " --init-table"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000045.BR "ebtables " [ "-t table" "] [" "--atomic-file file" ] " --atomic-commit"
Bart De Schuymer7085d662003-02-25 22:33:28 +000046.br
Bart De Schuymer21aa50f2003-05-03 21:07:39 +000047.BR "ebtables " [ "-t table" "] [" "--atomic-file file" ] " --atomic-init"
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-save"
Bart De Schuymer234bce92002-07-14 21:25:08 +000050.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000051.SH DESCRIPTION
52.B ebtables
Bart De Schuymer7085d662003-02-25 22:33:28 +000053is a user space tool, it is used to set up and maintain the
54tables of Ethernet frame rules in the Linux kernel. These rules inspect
55the Ethernet frames which they see.
56.B ebtables
57is analogous to the
58.B iptables
59user space tool, but
60.B ebtables
61is less complicated.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000062
Bart De Schuymer7085d662003-02-25 22:33:28 +000063.SS CHAINS
64There are three Ethernet frame tables with built-in chains in the
65Linux kernel. The kernel tables are used to divide functionality into
66different sets of rules. Each set of rules is called a chain.
67Each chain is an ordered list of rules that can match Ethernet frames. If a
68rule matches an Ethernet frame, then a processing specification tells
69what to do with that matching frame. The processing specification is
70called a 'target'. However, if the frame does not match the current
71rule in the chain, then the next rule in the chain is examined and so forth.
72The 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 +000073
74.SS TARGETS
Bart De Schuymer7085d662003-02-25 22:33:28 +000075A firewall rule specifies criteria for an Ethernet frame and a frame
76processing specification called a target. When a frame matches a rule,
77then the next action performed by the kernel is specified by the target.
78The target can be one of these values:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000079.IR ACCEPT ,
80.IR DROP ,
81.IR CONTINUE ,
Bart De Schuymer29749c62002-06-25 21:27:57 +000082.IR RETURN ,
Bart De Schuymer7085d662003-02-25 22:33:28 +000083an 'extension' (see below) or a user-defined chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000084.PP
85.I ACCEPT
86means to let the frame through.
87.I DROP
88means the frame has to be dropped.
89.I CONTINUE
90means the next rule has to be checked. This can be handy to know how many
Bart De Schuymer29749c62002-06-25 21:27:57 +000091frames pass a certain point in the chain or to log those frames.
92.I RETURN
93means stop traversing this chain and resume at the next rule in the
94previous (calling) chain.
Bart De Schuymer7085d662003-02-25 22:33:28 +000095For the extension targets please see the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000096.B "TARGET EXTENSIONS"
Bart De Schuymer7085d662003-02-25 22:33:28 +000097section of this man page.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000098.SS TABLES
Bart De Schuymer7085d662003-02-25 22:33:28 +000099As stated earlier, there are three Ethernet frame tables in the Linux
100kernel. The tables are
101.BR filter ", " nat " and " broute .
102Of these three tables,
103the filter table is the default table that the
104.B ebtables
105command operates on.
106If you are working with the filter table, then you can drop the '-t filter'
107argument to the ebtables command. However, you will need to provide
108the -t argument for the other two tables. The -t argument must be the
109first argument on the ebtables command line, if used.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000110.TP
111.B "-t, --table"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000112.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000113.BR filter ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000114is the default table and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000115.B INPUT
116(for frames destined for the bridge itself),
117.B OUTPUT
118(for locally-generated frames) and
119.B FORWARD
120(for frames being bridged).
Bart De Schuymer7085d662003-02-25 22:33:28 +0000121.br
122.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000123.BR nat ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000124is used to change the mac addresses and contains three built-in chains:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000125.B PREROUTING
126(for altering frames as soon as they come in),
127.B OUTPUT
128(for altering locally generated frames before they are bridged) and
129.B POSTROUTING
130(for altering frames as they are about to go out). A small note on the naming
131of chains POSTROUTING and PREROUTING: it would be more accurate to call them
132PREFORWARDING and POSTFORWARDING, but for all those who come from the
133.BR iptables " world to " ebtables
134it is easier to have the same names.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000135.br
136.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000137.BR broute ,
Bart De Schuymer7085d662003-02-25 22:33:28 +0000138is used to make a brouter, it has one built-in chain:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000139.BR BROUTING .
140The targets
141.BR DROP " and " ACCEPT
Bart De Schuymer7085d662003-02-25 22:33:28 +0000142have special meaning in the broute table.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000143.B DROP
144actually means the frame has to be routed, while
145.B ACCEPT
146means the frame has to be bridged. The
147.B BROUTING
148chain is traversed very early. It is only traversed by frames entering on
Bart De Schuymer7085d662003-02-25 22:33:28 +0000149a bridge enslaved NIC that is in forwarding state. Normally those frames
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000150would be bridged, but you can decide otherwise here. The
151.B redirect
152target is very handy here.
Bart De Schuymer7085d662003-02-25 22:33:28 +0000153.SH EBTABLES COMMAND LINE ARGUMENTS
154After the initial ebtables -t, table command line argument, the remaining
155arguments can be divided into several different groups. These groups
156are commands, miscellaneous commands, rule-specifications, match-extensions,
157and watcher-extensions.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000158.SS COMMANDS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000159The ebtables command arguments specify the actions to perform on the table
160defined with the -t argument. If you do not use the -t argument to name
161a table, the commands apply to the default filter table.
162With the exception of both the
163.B "-Z"
164and
165.B "--atomic-file"
166commands, only one command may be used on the command line at a time.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000167.TP
168.B "-A, --append"
169Append a rule to the end of the selected chain.
170.TP
171.B "-D, --delete"
Bart De Schuymerabc84172002-11-06 21:02:33 +0000172Delete the specified rule from the selected chain. There are two ways to
173use this command. The first is by specifying an interval of rule numbers
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000174to delete, syntax: start_nr[:end_nr]. Using negative numbers is allowed, for more
175details about using negative numbers, see the -I command. The second usage is by
176specifying the complete rule as it would have been specified when it was added.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000177.TP
178.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000179Insert the specified rule into the selected chain at the specified rule number.
Bart De Schuymer6a3af1d2003-04-17 17:16:58 +0000180If the current number of rules equals N, then the specified number can be
181between -N and N+1. For a positive number i, it holds that i and i-N-1 specify the
182same place in the chain where the rule should be inserted. The number 0 specifies
183the place past the last rule in the chain and using this number is therefore
184equivalent with using the -A command.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000185.TP
186.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000187Set the policy for the chain to the given target. The policy can be
188.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000189.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000190.B "-F, --flush"
191Flush the selected chain. If no chain is selected, then every chain will be
192flushed. Flushing the chain does not change the policy of the
193chain, however.
194.TP
195.B "-Z, --zero"
196Set the counters of the selected chain to zero. If no chain is selected, all the counters
197are set to zero. The
198.B "-Z"
199command can be used in conjunction with the
200.B "-L"
201command.
202When both the
203.B "-Z"
204and
205.B "-L"
206commands are used together in this way, the rule counters are printed on the screen
207before they are set to zero.
208.TP
209.B "-L, --list"
210List all rules in the selected chain. If no chain is selected, all chains
211are listed.
212.br
213The following three options change the output of the
214.B "-L"
215list command:
216.br
217.B "--Ln"
218.br
219Places the rule number in front of every rule.
220.br
221.B "--Lc"
222.br
223Shows the counters at the end of each rule displayed by the
224.B "-L"
225command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
226.br
227.B "--Lx"
228.br
229The output of the
230.B "--Lx"
231option may be used to create a set of
232.B ebtables
233commands. You may use this set of commands in an
234.B ebtables
235boot or reload
236script. For example the output could be used at system startup.
237The
238.B "--Lx"
239option is incompatible with both of the other
240.B "--Ln"
241and
242.B "--Lc"
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000243chain listing options.
244.br
245.B "--Lmac2"
246.br
247Shows all MAC addresses with the same length, adding leading zeroes
248if necessary. The default representation omits zeroes in the addresses
249when they are not needed.
250.br
Bart De Schuymer7085d662003-02-25 22:33:28 +0000251All necessary
252.B ebtables
253commands for making the current list of
254user-defined chains in the kernel and any commands issued by the user to
255rename the standard
256.B ebtables
257chains will be listed, when no chain name is
258supplied for the
259.B "-L"
260command while using the
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000261.B "--Lx"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000262option.
263.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000264.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000265Create a new user-defined chain with the given name. The number of
266user-defined chains is unlimited. A user-defined chain name has maximum
267length of 31 characters.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000268.TP
269.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000270Delete the specified user-defined chain. There must be no remaining references
271to the to be deleted chain. Otherwise,
Bart De Schuymer29749c62002-06-25 21:27:57 +0000272.B ebtables
273will complain if there are.
274.TP
275.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000276Rename the specified chain to a new name. Besides renaming a user-defined
277chain, you may rename a standard chain name to a name that suits your
278taste. For example, if you like PREBRIDGING more than PREROUTING,
279then you can use the -E command to rename the PREROUTING chain. If you do
280rename one of the standard
281.B ebtables
282chain names, please be sure to mention
283this fact should you post a question on the
284.B ebtables
285mailing lists.
286It would be wise to use the standard name in your post. Renaming a standard
287.B ebtables
288chain in this fashion has no effect on the structure or function
289of the
290.B ebtables
291kernel table.
292.TP
293.B "--init-table"
294Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000295.TP
296.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000297Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000298file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000299to the file. The file can be specified using the
300.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000301command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000302.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000303.TP
304.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000305Copy the kernel's current 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-commit"
313Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000314file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000315certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000316time and allowing atomic updates of the tables. The file which contains
317the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000318.B "--atomic-init"
319or the
320.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000321command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000322.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000323command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000324.IR EBTABLES_ATOMIC_FILE " environment variable"
325allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000326committing it to the kernel.
327.TP
328.B "--atomic-file -Z"
329The counters stored in a file with, say,
330.B "--atomic-init"
331can be optionally zeroed by supplying the
332.B "-Z"
333command. You may also zero the counters by setting the
334.IR EBTABLES_ATOMIC_FILE " environment variable."
335
336.SS MISCELLANOUS COMMANDS
337.TP
338.B "-V, --version"
339Show the version of the ebtables userspace program.
340.TP
341.B "-h, --help"
342Give a brief description of the command syntax. Here you can also specify
343names of extensions and
344.B ebtables
345will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
346Specify
347.I list_extensions
348to list all extensions supported by the userspace
349utility.
350.TP
351.BR "-j, --jump " "\fItarget\fP"
352The target of the rule. This is one of the following values:
353.BR ACCEPT ,
354.BR DROP ,
355.BR CONTINUE ,
356.BR RETURN ,
357a target extension (see
358.BR "TARGET EXTENSIONS" ")"
359or a user-defined chain name.
360.TP
361.B --atomic-file file
362Let the command operate on the specified file. The data of the table to
363operate on will be extracted from the file and the result of the operation
364will be saved back into the file. If specified, this option should come
365before the command specification. An alternative that should be preferred,
366is setting the
367.IR EBTABLES_ATOMIC_FILE " environment variable."
368.TP
369.B -M, --modprobe program
370When talking to the kernel, use this program to try to automatically load
371missing kernel modules.
372
Bart De Schuymer29749c62002-06-25 21:27:57 +0000373.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000374RULE-SPECIFICATIONS
375The following command line arguments make up a rule specification (as used
376in the add and delete commands). A "!" option before the specification
377inverts the test for that specification. Apart from these standard rule
378specifications there are some other command line arguments of interest.
379See both the
380.BR "MATCH-EXTENSIONS"
381and the
382.BR "WATCHER-EXTENSION(S)"
383below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000384.TP
385.BR "-p, --protocol " "[!] \fIprotocol\fP"
386The protocol that was responsible for creating the frame. This can be a
387hexadecimal number, above
388.IR 0x0600 ,
389a name (e.g.
390.I ARP
391) or
392.BR LENGTH .
393The protocol field of the Ethernet frame can be used to denote the
394length of the header (802.2/802.3 networks). When the value of that field is
395below (or equals)
396.IR 0x0600 ,
397the value equals the size of the header and shouldn't be used as a
398protocol number. Instead, all frames where the protocol field is used as
399the length field are assumed to be of the same 'protocol'. The protocol
400name used in
401.B ebtables
402for these frames is
403.BR LENGTH .
404.br
405The file
406.B /etc/ethertypes
407can be used to show readable
408characters instead of hexadecimal numbers for the protocols. For example,
409.I 0x0800
410will be represented by
411.IR IPV4 .
412The use of this file is not case sensitive.
413See that file for more information. The flag
414.B --proto
415is an alias for this option.
416.TP
417.BR "-i, --in-interface " "[!] \fIname\fP"
418The interface via which a frame is received (for the
419.BR INPUT ,
420.BR FORWARD ,
421.BR PREROUTING " and " BROUTING
422chains). The flag
423.B --in-if
424is an alias for this option.
425.TP
426.BR "--logical-in " "[!] \fIname\fP"
427The (logical) bridge interface via which a frame is received (for the
428.BR INPUT ,
429.BR FORWARD ,
430.BR PREROUTING " and " BROUTING
431chains).
432.TP
433.BR "-o, --out-interface " "[!] \fIname\fP"
434The interface via which a frame is going to be sent (for the
435.BR OUTPUT ,
436.B FORWARD
437and
438.B POSTROUTING
439chains). The flag
440.B --out-if
441is an alias for this option.
442.TP
443.BR "--logical-out " "[!] \fIname\fP"
444The (logical) bridge interface via which a frame is going to be sent (for
445the
446.BR OUTPUT ,
447.B FORWARD
448and
449.B POSTROUTING
450chains).
451.TP
452.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
453The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000454numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000455Multicast or Broadcast.
456.br
457Unicast=00:00:00:00:00:00/01:00:00:00:00:00,
458Multicast=01:00:00:00:00:00/01:00:00:00:00:00 and
459Broadcast=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff. Note that a broadcast
460address will also match the multicast specification. The flag
461.B --src
462is an alias for this option.
463.TP
464.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
465The destination mac address. See -s (above) for more details. The flag
466.B --dst
467is an alias for this option.
468
Bart De Schuymer7085d662003-02-25 22:33:28 +0000469.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000470.B ebtables
471extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000472to explicitly load them with a -m option like in
473.BR iptables .
474However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000475extensions deal with functionality supported by supplemental kernel modules.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000476.SS arp
477Specify arp fields. These will only work if the protocol equals
478.BR ARP " or " RARP .
479.TP
480.BR "--arp-opcode " "[!] \fIopcode\fP"
481The (r)arp opcode (decimal or a string, for more details see
482.BR "ebtables -h arp" ).
483.TP
484.BR "--arp-htype " "[!] \fIhardware type\fP"
485The hardware type, this can be a decimal or the string "Ethernet". This
486is normally Ethernet (value 1).
487.TP
488.BR "--arp-ptype " "[!] \fIprotocol type\fP"
489The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
490This is normally IPv4 (0x0800).
491.TP
492.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
493The ARP IP source address specification.
494.TP
495.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
496The ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000497.TP
498.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
499The ARP MAC source address specification.
500.TP
501.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
502The ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000503.SS ip
Bart De Schuymer7085d662003-02-25 22:33:28 +0000504Specify ip fields. These will only work if the protocol equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000505.BR IPv4 .
506.TP
507.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
508The source ip address.
509The flag
510.B --ip-src
511is an alias for this option.
512.TP
513.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
514The destination ip address.
515The flag
516.B --ip-dst
517is an alias for this option.
518.TP
519.BR "--ip-tos " "[!] \fItos\fP"
520The ip type of service, in hexadecimal numbers.
521.BR IPv4 .
522.TP
523.BR "--ip-protocol " "[!] \fIprotocol\fP"
524The ip protocol.
525The flag
526.B --ip-proto
527is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000528.TP
529.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
530The source port or port range for the ip protocols 6 (TCP) and 17
531(UDP). If the first port is omitted, "0" is assumed; if the last
532is omitted, "65535" is assumed. The flag
533.B --ip-sport
534is an alias for this option.
535.TP
536.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
537The destination port or port range for ip protocols 6 (TCP) and
53817 (UDP). The flag
539.B --ip-dport
540is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000541.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000542.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000543.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
544Matches frames with the given unsigned mark value. If a mark value and
545mask is specified, the logical AND of the mark value of the frame and
546the user-specified mask is taken before comparing it with the user-specified
547mark value. If only a mask is specified (start with '/') the logical AND
548of the mark value of the frame and the user-specified mark is taken and
549the result is compared with zero.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000550.SS pkttype
551.TP
552.BR "--pkttype-type " "[!] \fItype\fP"
553Matches on the Ethernet "class" of the frame, which is determined by the
554generic networking code. Possible values: broadcast (MAC destination is
555broadcast address), multicast (MAC destination is multicast address),
556host (MAC destination is the receiving network device) or otherhost
557(none of the above).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000558.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000559Specify 802.1Q Tag Control Information fields.
560The protocol rule specification (frame type) should be set to
561.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000562.TP
563.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000564The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000565.TP
566.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000567The user_priority field. Decimal number from 0 to 7.
568The VID should be set to 0 ("null VID") or unspecified
569(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000570.TP
fnm3ed7e9012002-06-25 16:43:23 +0000571.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000572The encapsulated Ethernet frame type/length.
573Specified as hexadecimal
574number from 0x0000 to 0xFFFF or as a symbolic name
575from
576.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000577
Bart De Schuymer7085d662003-02-25 22:33:28 +0000578.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000579Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000580see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000581.SS log
582The fact that the log module is a watcher lets us log stuff while giving a target
583by choice. Note that the log module therefore is not a target.
584.TP
585.B "--log"
586.br
587Use this if you won't specify any other log options, so if you want to use the default
588settings: log-prefix="", no arp logging, no ip logging, log-level=info.
589.TP
590.B --log-level "\fIlevel\fP"
591.br
592defines the logging level. For the possible values: ebtables -h log.
593The default level is
594.IR info .
595.TP
596.BR --log-prefix " \fItext\fP"
597.br
598defines the prefix to be printed before the logging information.
599.TP
600.B --log-ip
601.br
602will log the ip information when a frame made by the ip protocol matches
603the rule. The default is no ip information logging.
604.TP
605.B --log-arp
606.br
607will log the (r)arp information when a frame made by the (r)arp protocols
608matches the rule. The default is no (r)arp information logging.
609.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000610.SS
611.B dnat
612The
613.B dnat
614target can only be used in the
615.BR BROUTING " chain of the " broute " table and the "
616.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
617It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000618.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000619.BR "--to-destination " "\fIaddress\fP"
620.br
621The flag
622.B --to-dst
623is an alias for this option.
624.TP
625.BR "--dnat-target " "\fItarget\fP"
626.br
627Specifies the standard target. After doing the dnat, the rule still has to
628give a standard target so
629.B ebtables
630knows what to do.
631The default target is ACCEPT. Making it CONTINUE could let you use
632multiple target extensions on the same frame. Making it DROP only makes
633sense in the BROUTING chain but using the redirect target is more logical
634there. RETURN is also allowed. Note
635that using RETURN in a base chain is not allowed.
636.SS
637.B mark
638The mark target can be used in every chain of every table. It is possible
639to use the marking of a frame/packet in both ebtables and iptables,
640if the br-nf code is compiled into the kernel. Both put the marking at the
641same place. So, you can consider this fact as a feature, or as something to
642watch out for.
643.TP
644.BR "--set-mark " "\fIvalue\fP"
645.br
646Mark the frame with the specified unsigned value.
647.TP
648.BR "--mark-target " "\fItarget\fP"
649.br
650Specifies the standard target. After marking the frame, the rule
651still has to give a standard target so
652.B ebtables
653knows what to do.
654The default target is ACCEPT. Making it CONTINUE can let you do other
655things with the frame in other rules of the chain.
656.SS
657.B redirect
658The
659.B redirect
660target will change the MAC target address to that of the bridge device the
661frame arrived on. This target can only be used in the
662.BR BROUTING " chain of the " broute " table and the "
663.BR PREROUTING " chain of the " nat " table."
664.TP
665.BR "--redirect-target " "\fItarget\fP"
666.br
667Specifies the standard target. After doing the MAC redirect, the rule
668still has to give a standard target so
669.B ebtables
670knows what to do.
671The default target is ACCEPT. Making it CONTINUE could let you use
672multiple target extensions on the same frame. Making it DROP in the
673BROUTING chain will let the frames be routed. RETURN is also allowed. Note
674that using RETURN in a base chain is not allowed.
675.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000676.B snat
677The
678.B snat
679target can only be used in the
680.BR POSTROUTING " chain of the " nat " table."
681It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000682.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000683.BR "--to-source " "\fIaddress\fP"
684.br
685The flag
686.B --to-src
687is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000688.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000689.BR "--snat-target " "\fItarget\fP"
690.br
691Specifies the standard target. After doing the snat, the rule still has
692to give a standard target so
693.B ebtables
694knows what to do.
695The default target is ACCEPT. Making it CONTINUE could let you use
696multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000697make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000698that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000699.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000700.SH FILES
701.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000702.SH ENVIRONMENT VARIABLES
703.I EBTABLES_ATOMIC_FILE
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000704.SH BUGS
705This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000706.SH MAILINGLISTS
707.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000708.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000709.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000710.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000711.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)