blob: 06b8089bfa20b4c36c638e3c6e568899fc464f97 [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
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"
243chain listing options,
244.B "-L."
245All necessary
246.B ebtables
247commands for making the current list of
248user-defined chains in the kernel and any commands issued by the user to
249rename the standard
250.B ebtables
251chains will be listed, when no chain name is
252supplied for the
253.B "-L"
254command while using the
255.B "-Lx"
256option.
257.TP
Bart De Schuymer29749c62002-06-25 21:27:57 +0000258.B "-N, --new-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000259Create a new user-defined chain with the given name. The number of
260user-defined chains is unlimited. A user-defined chain name has maximum
261length of 31 characters.
Bart De Schuymer29749c62002-06-25 21:27:57 +0000262.TP
263.B "-X, --delete-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000264Delete the specified user-defined chain. There must be no remaining references
265to the to be deleted chain. Otherwise,
Bart De Schuymer29749c62002-06-25 21:27:57 +0000266.B ebtables
267will complain if there are.
268.TP
269.B "-E, --rename-chain"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000270Rename the specified chain to a new name. Besides renaming a user-defined
271chain, you may rename a standard chain name to a name that suits your
272taste. For example, if you like PREBRIDGING more than PREROUTING,
273then you can use the -E command to rename the PREROUTING chain. If you do
274rename one of the standard
275.B ebtables
276chain names, please be sure to mention
277this fact should you post a question on the
278.B ebtables
279mailing lists.
280It would be wise to use the standard name in your post. Renaming a standard
281.B ebtables
282chain in this fashion has no effect on the structure or function
283of the
284.B ebtables
285kernel table.
286.TP
287.B "--init-table"
288Replace the current table data by the initial table data.
Bart De Schuymer234bce92002-07-14 21:25:08 +0000289.TP
290.B "--atomic-init"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000291Copy the kernel's initial data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000292file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000293to the file. The file can be specified using the
294.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000295command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000296.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000297.TP
298.B "--atomic-save"
Bart De Schuymera02773a2002-07-15 19:42:11 +0000299Copy the kernel's current data of the table to the specified
Bart De Schuymer234bce92002-07-14 21:25:08 +0000300file. This can be used as the first action, after which rules are added
Bart De Schuymereecff422002-12-03 20:50:30 +0000301to the file. The file can be specified using the
302.B --atomic-file
Bart De Schuymer7085d662003-02-25 22:33:28 +0000303command or through the
Bart De Schuymereecff422002-12-03 20:50:30 +0000304.IR EBTABLES_ATOMIC_FILE " environment variable."
Bart De Schuymer234bce92002-07-14 21:25:08 +0000305.TP
306.B "--atomic-commit"
307Replace the kernel table data with the data contained in the specified
Bart De Schuymer7085d662003-02-25 22:33:28 +0000308file. This is a useful command that allows you to load all your rules of a
Bart De Schuymer234bce92002-07-14 21:25:08 +0000309certain table into the kernel at once, saving the kernel a lot of precious
Bart De Schuymereecff422002-12-03 20:50:30 +0000310time and allowing atomic updates of the tables. The file which contains
311the table data is constructed by using either the
Bart De Schuymer234bce92002-07-14 21:25:08 +0000312.B "--atomic-init"
313or the
314.B "--atomic-save"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000315command to generate a starting file. After that, using the
Bart De Schuymereecff422002-12-03 20:50:30 +0000316.B "--atomic-file"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000317command when constructing rules or setting the
Bart De Schuymereecff422002-12-03 20:50:30 +0000318.IR EBTABLES_ATOMIC_FILE " environment variable"
319allows you to extend the file and build the complete table before
Bart De Schuymer7085d662003-02-25 22:33:28 +0000320committing it to the kernel.
321.TP
322.B "--atomic-file -Z"
323The counters stored in a file with, say,
324.B "--atomic-init"
325can be optionally zeroed by supplying the
326.B "-Z"
327command. You may also zero the counters by setting the
328.IR EBTABLES_ATOMIC_FILE " environment variable."
329
330.SS MISCELLANOUS COMMANDS
331.TP
332.B "-V, --version"
333Show the version of the ebtables userspace program.
334.TP
335.B "-h, --help"
336Give a brief description of the command syntax. Here you can also specify
337names of extensions and
338.B ebtables
339will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
340Specify
341.I list_extensions
342to list all extensions supported by the userspace
343utility.
344.TP
345.BR "-j, --jump " "\fItarget\fP"
346The target of the rule. This is one of the following values:
347.BR ACCEPT ,
348.BR DROP ,
349.BR CONTINUE ,
350.BR RETURN ,
351a target extension (see
352.BR "TARGET EXTENSIONS" ")"
353or a user-defined chain name.
354.TP
355.B --atomic-file file
356Let the command operate on the specified file. The data of the table to
357operate on will be extracted from the file and the result of the operation
358will be saved back into the file. If specified, this option should come
359before the command specification. An alternative that should be preferred,
360is setting the
361.IR EBTABLES_ATOMIC_FILE " environment variable."
362.TP
363.B -M, --modprobe program
364When talking to the kernel, use this program to try to automatically load
365missing kernel modules.
366
Bart De Schuymer29749c62002-06-25 21:27:57 +0000367.SS
Bart De Schuymer7085d662003-02-25 22:33:28 +0000368RULE-SPECIFICATIONS
369The following command line arguments make up a rule specification (as used
370in the add and delete commands). A "!" option before the specification
371inverts the test for that specification. Apart from these standard rule
372specifications there are some other command line arguments of interest.
373See both the
374.BR "MATCH-EXTENSIONS"
375and the
376.BR "WATCHER-EXTENSION(S)"
377below.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000378.TP
379.BR "-p, --protocol " "[!] \fIprotocol\fP"
380The protocol that was responsible for creating the frame. This can be a
381hexadecimal number, above
382.IR 0x0600 ,
383a name (e.g.
384.I ARP
385) or
386.BR LENGTH .
387The protocol field of the Ethernet frame can be used to denote the
388length of the header (802.2/802.3 networks). When the value of that field is
389below (or equals)
390.IR 0x0600 ,
391the value equals the size of the header and shouldn't be used as a
392protocol number. Instead, all frames where the protocol field is used as
393the length field are assumed to be of the same 'protocol'. The protocol
394name used in
395.B ebtables
396for these frames is
397.BR LENGTH .
398.br
399The file
400.B /etc/ethertypes
401can be used to show readable
402characters instead of hexadecimal numbers for the protocols. For example,
403.I 0x0800
404will be represented by
405.IR IPV4 .
406The use of this file is not case sensitive.
407See that file for more information. The flag
408.B --proto
409is an alias for this option.
410.TP
411.BR "-i, --in-interface " "[!] \fIname\fP"
412The interface via which a frame is received (for the
413.BR INPUT ,
414.BR FORWARD ,
415.BR PREROUTING " and " BROUTING
416chains). The flag
417.B --in-if
418is an alias for this option.
419.TP
420.BR "--logical-in " "[!] \fIname\fP"
421The (logical) bridge interface via which a frame is received (for the
422.BR INPUT ,
423.BR FORWARD ,
424.BR PREROUTING " and " BROUTING
425chains).
426.TP
427.BR "-o, --out-interface " "[!] \fIname\fP"
428The interface via which a frame is going to be sent (for the
429.BR OUTPUT ,
430.B FORWARD
431and
432.B POSTROUTING
433chains). The flag
434.B --out-if
435is an alias for this option.
436.TP
437.BR "--logical-out " "[!] \fIname\fP"
438The (logical) bridge interface via which a frame is going to be sent (for
439the
440.BR OUTPUT ,
441.B FORWARD
442and
443.B POSTROUTING
444chains).
445.TP
446.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
447The source mac address. Both mask and address are written as 6 hexadecimal
Bart De Schuymer7085d662003-02-25 22:33:28 +0000448numbers separated by colons. Alternatively one can specify Unicast,
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000449Multicast or Broadcast.
450.br
451Unicast=00:00:00:00:00:00/01:00:00:00:00:00,
452Multicast=01:00:00:00:00:00/01:00:00:00:00:00 and
453Broadcast=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff. Note that a broadcast
454address will also match the multicast specification. The flag
455.B --src
456is an alias for this option.
457.TP
458.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
459The destination mac address. See -s (above) for more details. The flag
460.B --dst
461is an alias for this option.
462
Bart De Schuymer7085d662003-02-25 22:33:28 +0000463.SS MATCH-EXTENSIONS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000464.B ebtables
465extensions are precompiled into the userspace tool. So there is no need
Bart De Schuymer7085d662003-02-25 22:33:28 +0000466to explicitly load them with a -m option like in
467.BR iptables .
468However, these
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000469extensions deal with functionality supported by supplemental kernel modules.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000470.SS arp
471Specify arp fields. These will only work if the protocol equals
472.BR ARP " or " RARP .
473.TP
474.BR "--arp-opcode " "[!] \fIopcode\fP"
475The (r)arp opcode (decimal or a string, for more details see
476.BR "ebtables -h arp" ).
477.TP
478.BR "--arp-htype " "[!] \fIhardware type\fP"
479The hardware type, this can be a decimal or the string "Ethernet". This
480is normally Ethernet (value 1).
481.TP
482.BR "--arp-ptype " "[!] \fIprotocol type\fP"
483The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
484This is normally IPv4 (0x0800).
485.TP
486.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
487The ARP IP source address specification.
488.TP
489.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
490The ARP IP destination address specification.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000491.SS ip
Bart De Schuymer7085d662003-02-25 22:33:28 +0000492Specify ip fields. These will only work if the protocol equals
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000493.BR IPv4 .
494.TP
495.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
496The source ip address.
497The flag
498.B --ip-src
499is an alias for this option.
500.TP
501.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
502The destination ip address.
503The flag
504.B --ip-dst
505is an alias for this option.
506.TP
507.BR "--ip-tos " "[!] \fItos\fP"
508The ip type of service, in hexadecimal numbers.
509.BR IPv4 .
510.TP
511.BR "--ip-protocol " "[!] \fIprotocol\fP"
512The ip protocol.
513The flag
514.B --ip-proto
515is an alias for this option.
Bart De Schuymer4883ba52002-09-19 21:10:45 +0000516.TP
517.BR "--ip-source-port " "[!] \fIport\fP[:\fIport\fP]"
518The source port or port range for the ip protocols 6 (TCP) and 17
519(UDP). If the first port is omitted, "0" is assumed; if the last
520is omitted, "65535" is assumed. The flag
521.B --ip-sport
522is an alias for this option.
523.TP
524.BR "--ip-destination-port " "[!] \fIport\fP[:\fIport\fP]"
525The destination port or port range for ip protocols 6 (TCP) and
52617 (UDP). The flag
527.B --ip-dport
528is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000529.SS mark_m
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000530.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000531.BR "--mark " "[!] [\fIvalue\fP][/\fImask\fP]"
532Matches frames with the given unsigned mark value. If a mark value and
533mask is specified, the logical AND of the mark value of the frame and
534the user-specified mask is taken before comparing it with the user-specified
535mark value. If only a mask is specified (start with '/') the logical AND
536of the mark value of the frame and the user-specified mark is taken and
537the result is compared with zero.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000538.SS vlan
Bart De Schuymer7085d662003-02-25 22:33:28 +0000539Specify 802.1Q Tag Control Information fields.
540The protocol rule specification (frame type) should be set to
541.BR 802_1Q " (0x8100)."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000542.TP
543.BR "--vlan-id " "[!] \fIid\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000544The VLAN identifier field (VID). Decimal number from 0 to 4095.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000545.TP
546.BR "--vlan-prio " "[!] \fIprio\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000547The user_priority field. Decimal number from 0 to 7.
548The VID should be set to 0 ("null VID") or unspecified
549(for this case the VID is deliberately set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000550.TP
fnm3ed7e9012002-06-25 16:43:23 +0000551.BR "--vlan-encap " "[!] \fItype\fP"
Bart De Schuymer7085d662003-02-25 22:33:28 +0000552The encapsulated Ethernet frame type/length.
553Specified as hexadecimal
554number from 0x0000 to 0xFFFF or as a symbolic name
555from
556.BR /etc/ethertypes .
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000557
Bart De Schuymer7085d662003-02-25 22:33:28 +0000558.SS WATCHER-EXTENSION(S)
Bart De Schuymer9553d9c2002-07-23 21:13:05 +0000559Watchers are things that only look at frames passing by. These watchers only
Bart De Schuymer7085d662003-02-25 22:33:28 +0000560see the frame if the frame matches the rule.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000561.SS log
562The fact that the log module is a watcher lets us log stuff while giving a target
563by choice. Note that the log module therefore is not a target.
564.TP
565.B "--log"
566.br
567Use this if you won't specify any other log options, so if you want to use the default
568settings: log-prefix="", no arp logging, no ip logging, log-level=info.
569.TP
570.B --log-level "\fIlevel\fP"
571.br
572defines the logging level. For the possible values: ebtables -h log.
573The default level is
574.IR info .
575.TP
576.BR --log-prefix " \fItext\fP"
577.br
578defines the prefix to be printed before the logging information.
579.TP
580.B --log-ip
581.br
582will log the ip information when a frame made by the ip protocol matches
583the rule. The default is no ip information logging.
584.TP
585.B --log-arp
586.br
587will log the (r)arp information when a frame made by the (r)arp protocols
588matches the rule. The default is no (r)arp information logging.
589.SS TARGET EXTENSIONS
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000590.SS
591.B dnat
592The
593.B dnat
594target can only be used in the
595.BR BROUTING " chain of the " broute " table and the "
596.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
597It specifies that the destination mac address has to be changed.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000598.TP
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000599.BR "--to-destination " "\fIaddress\fP"
600.br
601The flag
602.B --to-dst
603is an alias for this option.
604.TP
605.BR "--dnat-target " "\fItarget\fP"
606.br
607Specifies the standard target. After doing the dnat, the rule still has to
608give a standard target so
609.B ebtables
610knows what to do.
611The default target is ACCEPT. Making it CONTINUE could let you use
612multiple target extensions on the same frame. Making it DROP only makes
613sense in the BROUTING chain but using the redirect target is more logical
614there. RETURN is also allowed. Note
615that using RETURN in a base chain is not allowed.
616.SS
617.B mark
618The mark target can be used in every chain of every table. It is possible
619to use the marking of a frame/packet in both ebtables and iptables,
620if the br-nf code is compiled into the kernel. Both put the marking at the
621same place. So, you can consider this fact as a feature, or as something to
622watch out for.
623.TP
624.BR "--set-mark " "\fIvalue\fP"
625.br
626Mark the frame with the specified unsigned value.
627.TP
628.BR "--mark-target " "\fItarget\fP"
629.br
630Specifies the standard target. After marking the frame, the rule
631still has to give a standard target so
632.B ebtables
633knows what to do.
634The default target is ACCEPT. Making it CONTINUE can let you do other
635things with the frame in other rules of the chain.
636.SS
637.B redirect
638The
639.B redirect
640target will change the MAC target address to that of the bridge device the
641frame arrived on. This target can only be used in the
642.BR BROUTING " chain of the " broute " table and the "
643.BR PREROUTING " chain of the " nat " table."
644.TP
645.BR "--redirect-target " "\fItarget\fP"
646.br
647Specifies the standard target. After doing the MAC redirect, the rule
648still has to give a standard target so
649.B ebtables
650knows what to do.
651The default target is ACCEPT. Making it CONTINUE could let you use
652multiple target extensions on the same frame. Making it DROP in the
653BROUTING chain will let the frames be routed. RETURN is also allowed. Note
654that using RETURN in a base chain is not allowed.
655.SS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000656.B snat
657The
658.B snat
659target can only be used in the
660.BR POSTROUTING " chain of the " nat " table."
661It specifies that the source mac address has to be changed.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000662.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000663.BR "--to-source " "\fIaddress\fP"
664.br
665The flag
666.B --to-src
667is an alias for this option.
Bart De Schuymerff852ce2003-03-19 19:53:37 +0000668.TP
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000669.BR "--snat-target " "\fItarget\fP"
670.br
671Specifies the standard target. After doing the snat, the rule still has
672to give a standard target so
673.B ebtables
674knows what to do.
675The default target is ACCEPT. Making it CONTINUE could let you use
676multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000677make sense, but you could do that too. RETURN is also allowed. Note
Bart De Schuymer4c4447d2002-07-25 14:55:14 +0000678that using RETURN in a base chain is not allowed.
Bart De Schuymer2ac6b742002-07-20 16:14:38 +0000679.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000680.SH FILES
681.I /etc/ethertypes
Bart De Schuymereecff422002-12-03 20:50:30 +0000682.SH ENVIRONMENT VARIABLES
683.I EBTABLES_ATOMIC_FILE
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000684.SH BUGS
685This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000686.SH MAILINGLISTS
687.I ebtables-user@lists.sourceforge.net
Bart De Schuymer7085d662003-02-25 22:33:28 +0000688.br
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000689.I ebtables-devel@lists.sourceforge.net
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000690.SH SEE ALSO
Bart De Schuymer3006c8c2003-03-15 17:07:44 +0000691.BR iptables "(8), " brctl "(8), " ifconfig "(8), " route (8)