blob: 3211f89158c0e0b62f3914cd286df1cb7acb8988 [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 Schuymer7085d662003-02-25 22:33:28 +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 Schuymer7085d662003-02-25 22:33:28 +000031.BR "ebtables [-t table] -P " "chain " "ACCEPT | DROP | RETURN"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000032.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000033.BR "ebtables [-t table] -F [" "chain" "]"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000034.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000035.BR "ebtables [-t table] -Z [" "chain" "]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000036.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000037.BR "ebtables [-t table] -L [-Z] [" chain "] [ [" --Ln "] [" --Lc "] ] " | " [" --Lx "]"
Bart De Schuymer29749c62002-06-25 21:27:57 +000038.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000039.BR "ebtables [-t table] -[NX] " chain
Bart De Schuymera02773a2002-07-15 19:42:11 +000040.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000041.BR "ebtables [-t table] -E " "old-chain-name new-chain-name"
Bart De Schuymer234bce92002-07-14 21:25:08 +000042.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000043.BR "ebtables [-t table] --init-table"
Bart De Schuymer234bce92002-07-14 21:25:08 +000044.br
Bart De Schuymer7085d662003-02-25 22:33:28 +000045.BR "ebtables [-t table] [--atomic-file file] --atomic-commit
46.br
47.BR "ebtables [-t table] [--atomic-file file] --atomic-init"
48.br
49.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
174to delete, syntax: start_nr[:end_nr]. The second usage is by specifying
175the complete rule as it would have been specified when it was added.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000176.TP
177.B "-I, --insert"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000178Insert the specified rule into the selected chain at the specified rule number.
179The number one, 1, means the head of the chain.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000180.TP
181.B "-P, --policy"
Bart De Schuymerefc3c862002-12-07 11:36:47 +0000182Set the policy for the chain to the given target. The policy can be
183.BR ACCEPT ", " DROP " or " RETURN .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000184.TP
Bart De Schuymer7085d662003-02-25 22:33:28 +0000185.B "-F, --flush"
186Flush the selected chain. If no chain is selected, then every chain will be
187flushed. Flushing the chain does not change the policy of the
188chain, however.
189.TP
190.B "-Z, --zero"
191Set the counters of the selected chain to zero. If no chain is selected, all the counters
192are set to zero. The
193.B "-Z"
194command can be used in conjunction with the
195.B "-L"
196command.
197When both the
198.B "-Z"
199and
200.B "-L"
201commands are used together in this way, the rule counters are printed on the screen
202before they are set to zero.
203.TP
204.B "-L, --list"
205List all rules in the selected chain. If no chain is selected, all chains
206are listed.
207.br
208The following three options change the output of the
209.B "-L"
210list command:
211.br
212.B "--Ln"
213.br
214Places the rule number in front of every rule.
215.br
216.B "--Lc"
217.br
218Shows the counters at the end of each rule displayed by the
219.B "-L"
220command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
221.br
222.B "--Lx"
223.br
224The output of the
225.B "--Lx"
226option may be used to create a set of
227.B ebtables
228commands. You may use this set of commands in an
229.B ebtables
230boot or reload
231script. For example the output could be used at system startup.
232The
233.B "--Lx"
234option is incompatible with both of the other
235.B "--Ln"
236and
237.B "--Lc"
238chain listing options,
239.B "-L."
240All necessary
241.B ebtables
242commands for making the current list of
243user-defined chains in the kernel and any commands issued by the user to
244rename the standard
245.B ebtables
246chains will be listed, when no chain name is
247supplied for the
248.B "-L"
249command while using the
250.B "-Lx"
251option.
252.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000253.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000254Create a new user-defined chain with the given name. The number of
255user-defined chains is unlimited. A user-defined chain name has maximum
256length of 31 characters.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000257.TP
258.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000259Delete the specified user-defined chain. There must be no remaining references
260to the to be deleted chain. Otherwise,
Bart De Schuymer29749c62002-06-25 21:27:57 +0000261.B ebtables
262will complain if there are.
263.TP
264.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000265Rename the specified chain to a new name. Besides renaming a user-defined
266chain, you may rename a standard chain name to a name that suits your
267taste. For example, if you like PREBRIDGING more than PREROUTING,
268then you can use the -E command to rename the PREROUTING chain. If you do
269rename one of the standard
270.B ebtables
271chain names, please be sure to mention
272this fact should you post a question on the
273.B ebtables
274mailing lists.
275It would be wise to use the standard name in your post. Renaming a standard
276.B ebtables
277chain in this fashion has no effect on the structure or function
278of the
279.B ebtables
280kernel table.
281.TP
282.B "--init-table"
283Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000284.TP
285.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000286Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000287file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000288to the file. The file can be specified using the
289.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000290command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000291.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000292.TP
293.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000294Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000295file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000296to the file. The file can be specified using the
297.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000298command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000299.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000300.TP
301.B "--atomic-commit"
302Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000303file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000304certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000305time and allowing atomic updates of the tables. The file which contains
306the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000307.B "--atomic-init"
308or the
309.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000310command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000311.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000312command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000313.IR EBTABLES_ATOMIC_FILE " environment variable"
314allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000315committing it to the kernel.
316.TP
317.B "--atomic-file -Z"
318The counters stored in a file with, say,
319.B "--atomic-init"
320can be optionally zeroed by supplying the
321.B "-Z"
322command. You may also zero the counters by setting the
323.IR EBTABLES_ATOMIC_FILE " environment variable."
324
325.SS MISCELLANOUS COMMANDS
326.TP
327.B "-V, --version"
328Show the version of the ebtables userspace program.
329.TP
330.B "-h, --help"
331Give a brief description of the command syntax. Here you can also specify
332names of extensions and
333.B ebtables
334will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
335Specify
336.I list_extensions
337to list all extensions supported by the userspace
338utility.
339.TP
340.BR "-j, --jump " "\fItarget\fP"
341The target of the rule. This is one of the following values:
342.BR ACCEPT ,
343.BR DROP ,
344.BR CONTINUE ,
345.BR RETURN ,
346a target extension (see
347.BR "TARGET EXTENSIONS" ")"
348or a user-defined chain name.
349.TP
350.B --atomic-file file
351Let the command operate on the specified file. The data of the table to
352operate on will be extracted from the file and the result of the operation
353will be saved back into the file. If specified, this option should come
354before the command specification. An alternative that should be preferred,
355is setting the
356.IR EBTABLES_ATOMIC_FILE " environment variable."
357.TP
358.B -M, --modprobe program
359When talking to the kernel, use this program to try to automatically load
360missing kernel modules.
361
Bart De Schuymer29749c62002-06-25 21:27:57 +0000362.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000363RULE-SPECIFICATIONS
364The following command line arguments make up a rule specification (as used
365in the add and delete commands). A "!" option before the specification
366inverts the test for that specification. Apart from these standard rule
367specifications there are some other command line arguments of interest.
368See both the
369.BR "MATCH-EXTENSIONS"
370and the
371.BR "WATCHER-EXTENSION(S)"
372below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000373.TP
374.BR "-p, --protocol " "[!] \fIprotocol\fP"
375The protocol that was responsible for creating the frame. This can be a
376hexadecimal number, above
377.IR 0x0600 ,
378a name (e.g.
379.I ARP
380) or
381.BR LENGTH .
382The protocol field of the Ethernet frame can be used to denote the
383length of the header (802.2/802.3 networks). When the value of that field is
384below (or equals)
385.IR 0x0600 ,
386the value equals the size of the header and shouldn't be used as a
387protocol number. Instead, all frames where the protocol field is used as
388the length field are assumed to be of the same 'protocol'. The protocol
389name used in
390.B ebtables
391for these frames is
392.BR LENGTH .
393.br
394The file
395.B /etc/ethertypes
396can be used to show readable
397characters instead of hexadecimal numbers for the protocols. For example,
398.I 0x0800
399will be represented by
400.IR IPV4 .
401The use of this file is not case sensitive.
402See that file for more information. The flag
403.B --proto
404is an alias for this option.
405.TP
406.BR "-i, --in-interface " "[!] \fIname\fP"
407The interface via which a frame is received (for the
408.BR INPUT ,
409.BR FORWARD ,
410.BR PREROUTING " and " BROUTING
411chains). The flag
412.B --in-if
413is an alias for this option.
414.TP
415.BR "--logical-in " "[!] \fIname\fP"
416The (logical) bridge interface via which a frame is received (for the
417.BR INPUT ,
418.BR FORWARD ,
419.BR PREROUTING " and " BROUTING
420chains).
421.TP
422.BR "-o, --out-interface " "[!] \fIname\fP"
423The interface via which a frame is going to be sent (for the
424.BR OUTPUT ,
425.B FORWARD
426and
427.B POSTROUTING
428chains). The flag
429.B --out-if
430is an alias for this option.
431.TP
432.BR "--logical-out " "[!] \fIname\fP"
433The (logical) bridge interface via which a frame is going to be sent (for
434the
435.BR OUTPUT ,
436.B FORWARD
437and
438.B POSTROUTING
439chains).
440.TP
441.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
442The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000443numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000444Multicast or Broadcast.
445.br
446Unicast=00:00:00:00:00:00/01:00:00:00:00:00,
447Multicast=01:00:00:00:00:00/01:00:00:00:00:00 and
448Broadcast=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff. Note that a broadcast
449address will also match the multicast specification. The flag
450.B --src
451is an alias for this option.
452.TP
453.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
454The destination mac address. See -s (above) for more details. The flag
455.B --dst
456is an alias for this option.
457
Bart De Schuymer7085d662003-02-25 22:33:28 +0000458.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000459.B ebtables
460extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000461to explicitly load them with a -m option like in
462.BR iptables .
463However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000464extensions deal with functionality supported by supplemental kernel modules.
465.SS ip
Bart De Schuymer7085d662003-02-25 22:33:28 +0000466Specify ip fields. These will only work if the protocol equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000467.BR IPv4 .
468.TP
469.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
470The source ip address.
471The flag
472.B --ip-src
473is an alias for this option.
474.TP
475.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
476The destination ip address.
477The flag
478.B --ip-dst
479is an alias for this option.
480.TP
481.BR "--ip-tos " "[!] \fItos\fP"
482The ip type of service, in hexadecimal numbers.
483.BR IPv4 .
484.TP
485.BR "--ip-protocol " "[!] \fIprotocol\fP"
486The ip protocol.
487The flag
488.B --ip-proto
489is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000490.TP
491.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
492The source port or port range for the ip protocols 6 (TCP) and 17
493(UDP). If the first port is omitted, "0" is assumed; if the last
494is omitted, "65535" is assumed. The flag
495.B --ip-sport
496is an alias for this option.
497.TP
498.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
499The destination port or port range for ip protocols 6 (TCP) and
50017 (UDP). The flag
501.B --ip-dport
502is an alias for this option.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000503.SS arp
Bart De Schuymer7085d662003-02-25 22:33:28 +0000504Specify arp fields. These will only work if the protocol equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000505.BR ARP " or " RARP .
506.TP
507.BR "--arp-opcode " "[!] \fIopcode\fP"
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000508The (r)arp opcode (decimal or a string, for more details see
509.BR "ebtables -h arp" ).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000510.TP
511.BR "--arp-htype " "[!] \fIhardware type\fP"
512The hardware type, this can be a decimal or the string "Ethernet". This
513is normally Ethernet (value 1).
514.TP
515.BR "--arp-ptype " "[!] \fIprotocol type\fP"
516The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
517This is normally IPv4 (0x0800).
518.TP
519.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
520The ARP IP source address specification.
521.TP
522.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
523The ARP IP destination address specification.
524.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000525Specify 802.1Q Tag Control Information fields.
526The protocol rule specification (frame type) should be set to
527.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000528.TP
529.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000530The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000531.TP
532.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000533The user_priority field. Decimal number from 0 to 7.
534The VID should be set to 0 ("null VID") or unspecified
535(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000536.TP
fnm3ed7e9012002-06-25 16:43:23 +0000537.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000538The encapsulated Ethernet frame type/length.
539Specified as hexadecimal
540number from 0x0000 to 0xFFFF or as a symbolic name
541from
542.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000543.SS mark_m
544.TP
Bart De Schuymer8a8ca612002-07-21 15:18:07 +0000545.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
546Matches frames with the given unsigned mark value. If a mark value and
547mask is specified, the logical AND of the mark value of the frame and
Bart De Schuymer7085d662003-02-25 22:33:28 +0000548the user-specified mask is taken before comparing it with the user-specified
Bart De Schuymer8a8ca612002-07-21 15:18:07 +0000549mark value. If only a mask is specified (start with '/') the logical AND
Bart De Schuymer7085d662003-02-25 22:33:28 +0000550of the mark value of the frame and the user-specified mark is taken and
Bart De Schuymer8a8ca612002-07-21 15:18:07 +0000551the result is compared with zero.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000552
Bart De Schuymer7085d662003-02-25 22:33:28 +0000553.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000554Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000555see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000556.SS log
557The fact that the log module is a watcher lets us log stuff while giving a target
558by choice. Note that the log module therefore is not a target.
559.TP
560.B "--log"
561.br
562Use this if you won't specify any other log options, so if you want to use the default
563settings: log-prefix="", no arp logging, no ip logging, log-level=info.
564.TP
565.B --log-level "\fIlevel\fP"
566.br
567defines the logging level. For the possible values: ebtables -h log.
568The default level is
569.IR info .
570.TP
571.BR --log-prefix " \fItext\fP"
572.br
573defines the prefix to be printed before the logging information.
574.TP
575.B --log-ip
576.br
577will log the ip information when a frame made by the ip protocol matches
578the rule. The default is no ip information logging.
579.TP
580.B --log-arp
581.br
582will log the (r)arp information when a frame made by the (r)arp protocols
583matches the rule. The default is no (r)arp information logging.
584.SS TARGET EXTENSIONS
585.TP
586.B snat
587The
588.B snat
589target can only be used in the
590.BR POSTROUTING " chain of the " nat " table."
591It specifies that the source mac address has to be changed.
592.br
593.BR "--to-source " "\fIaddress\fP"
594.br
595The flag
596.B --to-src
597is an alias for this option.
598.br
599.BR "--snat-target " "\fItarget\fP"
600.br
601Specifies the standard target. After doing the snat, the rule still has
602to give a standard target so
603.B ebtables
604knows what to do.
605The default target is ACCEPT. Making it CONTINUE could let you use
606multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000607make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000608that using RETURN in a base chain is not allowed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000609.TP
610.B dnat
611The
612.B dnat
613target can only be used in the
614.BR BROUTING " chain of the " broute " table and the "
615.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
616It specifies that the destination mac address has to be changed.
617.br
618.BR "--to-destination " "\fIaddress\fP"
619.br
620The flag
621.B --to-dst
622is an alias for this option.
623.br
624.BR "--dnat-target " "\fItarget\fP"
625.br
626Specifies the standard target. After doing the dnat, the rule still has to
627give a standard target so
628.B ebtables
629knows what to do.
630The default target is ACCEPT. Making it CONTINUE could let you use
631multiple target extensions on the same frame. Making it DROP only makes
632sense in the BROUTING chain but using the redirect target is more logical
Bart De Schuymer29749c62002-06-25 21:27:57 +0000633there. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000634that using RETURN in a base chain is not allowed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000635.TP
636.B redirect
637The
638.B redirect
639target will change the MAC target address to that of the bridge device the
640frame arrived on. This target can only be used in the
641.BR BROUTING " chain of the " broute " table and the "
642.BR PREROUTING " chain of the " nat " table."
643.br
644.BR "--redirect-target " "\fItarget\fP"
645.br
646Specifies the standard target. After doing the MAC redirect, the rule
647still has to give a standard target so
648.B ebtables
649knows what to do.
650The default target is ACCEPT. Making it CONTINUE could let you use
651multiple target extensions on the same frame. Making it DROP in the
Bart De Schuymer29749c62002-06-25 21:27:57 +0000652BROUTING chain will let the frames be routed. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000653that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000654.TP
655.B mark
656The mark target can be used in every chain of every table. It is possible
657to use the marking of a frame/packet in both ebtables and iptables,
658if the br-nf code is compiled into the kernel. Both put the marking at the
659same place. So, you can consider this fact as a feature, or as something to
660watch out for.
661.br
662.BR "--mark-target " "\fItarget\fP"
663.br
664Specifies the standard target. After marking the frame, the rule
665still has to give a standard target so
666.B ebtables
667knows what to do.
668The default target is ACCEPT. Making it CONTINUE can let you do other
669things with the frame in other rules of the chain.
670.br
671.BR "--set-mark " "\fIvalue\fP"
672.br
673Mark the frame with the specified unsigned value.
674.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000675.SH FILES
676.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000677.SH ENVIRONMENT VARIABLES
678.I EBTABLES_ATOMIC_FILE
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000679.SH BUGS
680This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000681.SH MAILINGLISTS
682.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000683.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000684.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000685.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000686.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)