blob: 998449d8cc28da325025d0f7ddf97bb01bf85623 [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 Schuymer7350b042003-06-24 19:53:19 +0000476.SS 802.3
477Specify 802.3 DSAP/SSAP fields or SNAP type. These only work if the protocol equals
478.BR "LENGTH " (see " protocol " above).
479.TP
480.BR "--802_3-sap " "[!] \fIsap\fP"
481DSAP and SSAP are two one byte 802.3 fields. The bytes are always
482equal, so only one byte (hexadecimal) is needed as an argument.
483.TP
484.BR "--802_3-type " "[!] \fItype\fP"
485If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
486be consulted to determine the payload protocol. This is a two byte
487(hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
488checked for type.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000489.SS arp
490Specify arp fields. These will only work if the protocol equals
491.BR ARP " or " RARP .
492.TP
493.BR "--arp-opcode " "[!] \fIopcode\fP"
494The (r)arp opcode (decimal or a string, for more details see
495.BR "ebtables -h arp" ).
496.TP
497.BR "--arp-htype " "[!] \fIhardware type\fP"
498The hardware type, this can be a decimal or the string "Ethernet". This
499is normally Ethernet (value 1).
500.TP
501.BR "--arp-ptype " "[!] \fIprotocol type\fP"
502The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
503This is normally IPv4 (0x0800).
504.TP
505.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
506The ARP IP source address specification.
507.TP
508.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
509The ARP IP destination address specification.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000510.TP
511.BR "--arp-mac-src " "[!] \fIaddress\fP[/\fImask\fP]"
512The ARP MAC source address specification.
513.TP
514.BR "--arp-mac-dst " "[!] \fIaddress\fP[/\fImask\fP]"
515The ARP MAC destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000516.SS ip
Bart De Schuymer7085d662003-02-25 22:33:28 +0000517Specify ip fields. These will only work if the protocol equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000518.BR IPv4 .
519.TP
520.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
521The source ip address.
522The flag
523.B --ip-src
524is an alias for this option.
525.TP
526.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
527The destination ip address.
528The flag
529.B --ip-dst
530is an alias for this option.
531.TP
532.BR "--ip-tos " "[!] \fItos\fP"
533The ip type of service, in hexadecimal numbers.
534.BR IPv4 .
535.TP
536.BR "--ip-protocol " "[!] \fIprotocol\fP"
537The ip protocol.
538The flag
539.B --ip-proto
540is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000541.TP
542.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
543The source port or port range for the ip protocols 6 (TCP) and 17
544(UDP). If the first port is omitted, "0" is assumed; if the last
545is omitted, "65535" is assumed. The flag
546.B --ip-sport
547is an alias for this option.
548.TP
549.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
550The destination port or port range for ip protocols 6 (TCP) and
55117 (UDP). The flag
552.B --ip-dport
553is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000554.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000555.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000556.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
557Matches frames with the given unsigned mark value. If a mark value and
558mask is specified, the logical AND of the mark value of the frame and
559the user-specified mask is taken before comparing it with the user-specified
560mark value. If only a mask is specified (start with '/') the logical AND
561of the mark value of the frame and the user-specified mark is taken and
562the result is compared with zero.
Bart De Schuymer21aa50f2003-05-03 21:07:39 +0000563.SS pkttype
564.TP
565.BR "--pkttype-type " "[!] \fItype\fP"
566Matches on the Ethernet "class" of the frame, which is determined by the
567generic networking code. Possible values: broadcast (MAC destination is
568broadcast address), multicast (MAC destination is multicast address),
569host (MAC destination is the receiving network device) or otherhost
570(none of the above).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000571.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000572Specify 802.1Q Tag Control Information fields.
573The protocol rule specification (frame type) should be set to
574.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000575.TP
576.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000577The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000578.TP
579.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000580The user_priority field. Decimal number from 0 to 7.
581The VID should be set to 0 ("null VID") or unspecified
582(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000583.TP
fnm3ed7e9012002-06-25 16:43:23 +0000584.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000585The encapsulated Ethernet frame type/length.
586Specified as hexadecimal
587number from 0x0000 to 0xFFFF or as a symbolic name
588from
589.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000590
Bart De Schuymer7085d662003-02-25 22:33:28 +0000591.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000592Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000593see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000594.SS log
595The fact that the log module is a watcher lets us log stuff while giving a target
596by choice. Note that the log module therefore is not a target.
597.TP
598.B "--log"
599.br
600Use this if you won't specify any other log options, so if you want to use the default
601settings: log-prefix="", no arp logging, no ip logging, log-level=info.
602.TP
603.B --log-level "\fIlevel\fP"
604.br
605defines the logging level. For the possible values: ebtables -h log.
606The default level is
607.IR info .
608.TP
609.BR --log-prefix " \fItext\fP"
610.br
611defines the prefix to be printed before the logging information.
612.TP
613.B --log-ip
614.br
615will log the ip information when a frame made by the ip protocol matches
616the rule. The default is no ip information logging.
617.TP
618.B --log-arp
619.br
620will log the (r)arp information when a frame made by the (r)arp protocols
621matches the rule. The default is no (r)arp information logging.
622.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000623.SS
624.B dnat
625The
626.B dnat
627target can only be used in the
628.BR BROUTING " chain of the " broute " table and the "
629.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
630It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000631.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000632.BR "--to-destination " "\fIaddress\fP"
633.br
634The flag
635.B --to-dst
636is an alias for this option.
637.TP
638.BR "--dnat-target " "\fItarget\fP"
639.br
640Specifies the standard target. After doing the dnat, the rule still has to
641give a standard target so
642.B ebtables
643knows what to do.
644The default target is ACCEPT. Making it CONTINUE could let you use
645multiple target extensions on the same frame. Making it DROP only makes
646sense in the BROUTING chain but using the redirect target is more logical
647there. RETURN is also allowed. Note
648that using RETURN in a base chain is not allowed.
649.SS
650.B mark
651The mark target can be used in every chain of every table. It is possible
652to use the marking of a frame/packet in both ebtables and iptables,
653if the br-nf code is compiled into the kernel. Both put the marking at the
654same place. So, you can consider this fact as a feature, or as something to
655watch out for.
656.TP
657.BR "--set-mark " "\fIvalue\fP"
658.br
659Mark the frame with the specified unsigned value.
660.TP
661.BR "--mark-target " "\fItarget\fP"
662.br
663Specifies the standard target. After marking the frame, the rule
664still has to give a standard target so
665.B ebtables
666knows what to do.
667The default target is ACCEPT. Making it CONTINUE can let you do other
668things with the frame in other rules of the chain.
669.SS
670.B redirect
671The
672.B redirect
673target will change the MAC target address to that of the bridge device the
674frame arrived on. This target can only be used in the
675.BR BROUTING " chain of the " broute " table and the "
676.BR PREROUTING " chain of the " nat " table."
677.TP
678.BR "--redirect-target " "\fItarget\fP"
679.br
680Specifies the standard target. After doing the MAC redirect, the rule
681still has to give a standard target so
682.B ebtables
683knows what to do.
684The default target is ACCEPT. Making it CONTINUE could let you use
685multiple target extensions on the same frame. Making it DROP in the
686BROUTING chain will let the frames be routed. RETURN is also allowed. Note
687that using RETURN in a base chain is not allowed.
688.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000689.B snat
690The
691.B snat
692target can only be used in the
693.BR POSTROUTING " chain of the " nat " table."
694It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000695.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000696.BR "--to-source " "\fIaddress\fP"
697.br
698The flag
699.B --to-src
700is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000701.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000702.BR "--snat-target " "\fItarget\fP"
703.br
704Specifies the standard target. After doing the snat, the rule still has
705to give a standard target so
706.B ebtables
707knows what to do.
708The default target is ACCEPT. Making it CONTINUE could let you use
709multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000710make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000711that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000712.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000713.SH FILES
714.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000715.SH ENVIRONMENT VARIABLES
716.I EBTABLES_ATOMIC_FILE
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000717.SH BUGS
718This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000719.SH MAILINGLISTS
720.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000721.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000722.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000723.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000724.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)