blob: 3f43b2c9bc6a8a2af9deda1ec6b1a91ed46224e9 [file] [log] [blame]
Bart De Schuymer29749c62002-06-25 21:27:57 +00001.TH EBTABLES 8 "26 June 2002"
Bart De Schuymer1abc55d2002-06-01 19:23:47 +00002.\"
3.\" Man page written by Bart De Schuymer <bart.de.schuymer@pandora.be>
4.\" It is based on the iptables man page.
5.\"
6.\" Iptables page by Herve Eychenne March 2000.
7.\"
8.\" This program is free software; you can redistribute it and/or modify
9.\" it under the terms of the GNU General Public License as published by
10.\" the Free Software Foundation; either version 2 of the License, or
11.\" (at your option) any later version.
12.\"
13.\" This program is distributed in the hope that it will be useful,
14.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.\" GNU General Public License for more details.
17.\"
18.\" You should have received a copy of the GNU General Public License
19.\" along with this program; if not, write to the Free Software
20.\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21.\"
22.\"
23.SH NAME
fnm3f794d5a2002-06-14 17:28:13 +000024ebtables (v.2.0) \- ethernet bridge packet table administration
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000025.SH SYNOPSIS
Bart De Schuymer29749c62002-06-25 21:27:57 +000026.BR "ebtables -[ADI] " "chain rule-specification " [ options ]
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000027.br
28.BR "ebtables -P " "chain target"
29.br
30.BR "ebtables -[FLZ] [" "chain" "]"
31.br
Bart De Schuymer29749c62002-06-25 21:27:57 +000032.BR "ebtables -[NX] " chain
33.br
34.BR "ebtables -E " "old-chain-name new-chain-name"
35.br
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000036.B "ebtables -L DB"
37.br
38.BR "ebtables -[b] [" "y/n" "]"
39.br
40.SH DESCRIPTION
41.B ebtables
42is used to set up, maintain, and inspect the tables of Ethernet frame
43rules in the Linux kernel. It works analogous as iptables, but is less
44complicated. This man page is written with the man page of iptables
45next to it, so don't be surprised to see copied sentences and structure.
46
47There are three tables with built-in chains. Each chain is a list
48of rules which can match frames: each rule specifies what to do with a
49frame which matches. This is called a 'target'. The tables are used to
50divide functionality into different sets of chains.
51
52.SS TARGETS
53A firewall rule specifies criteria for a frame, and a target. If the
54frame does not match, the next rule in the chain is the examined one; if
55it does match, then the next thing to do is specified by the target.
56This target can be one of these values:
57.IR ACCEPT ,
58.IR DROP ,
59.IR CONTINUE ,
Bart De Schuymer29749c62002-06-25 21:27:57 +000060.IR RETURN ,
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000061an extention.
62.PP
63.I ACCEPT
64means to let the frame through.
65.I DROP
66means the frame has to be dropped.
67.I CONTINUE
68means the next rule has to be checked. This can be handy to know how many
Bart De Schuymer29749c62002-06-25 21:27:57 +000069frames pass a certain point in the chain or to log those frames.
70.I RETURN
71means stop traversing this chain and resume at the next rule in the
72previous (calling) chain.
73For the
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000074other targets see the
75.B "TARGET EXTENSIONS"
76section.
77.SS TABLES
78There are three tables.
79.TP
80.B "-t, --table"
81This option specifies the frame matching table which the command should
Bart De Schuymer29749c62002-06-25 21:27:57 +000082operate on. If specified it should be the first option. The tables are:
Bart De Schuymer1abc55d2002-06-01 19:23:47 +000083.BR filter ,
84this is the default table and contains three chains:
85.B INPUT
86(for frames destined for the bridge itself),
87.B OUTPUT
88(for locally-generated frames) and
89.B FORWARD
90(for frames being bridged).
91.BR nat ,
92this table is used to change the mac addresses and contains three chains:
93.B PREROUTING
94(for altering frames as soon as they come in),
95.B OUTPUT
96(for altering locally generated frames before they are bridged) and
97.B POSTROUTING
98(for altering frames as they are about to go out). A small note on the naming
99of chains POSTROUTING and PREROUTING: it would be more accurate to call them
100PREFORWARDING and POSTFORWARDING, but for all those who come from the
101.BR iptables " world to " ebtables
102it is easier to have the same names.
103.BR broute ,
104this table is used to make a brouter, it has one chain:
105.BR BROUTING .
106The targets
107.BR DROP " and " ACCEPT
108have special meaning in this table.
109.B DROP
110actually means the frame has to be routed, while
111.B ACCEPT
112means the frame has to be bridged. The
113.B BROUTING
114chain is traversed very early. It is only traversed by frames entering on
115a bridge enslaved nic that is in forwarding state. Normally those frames
116would be bridged, but you can decide otherwise here. The
117.B redirect
118target is very handy here.
119.SH OPTIONS
120The options can be divided into several different groups.
121.SS COMMANDS
122These options specify the specific actions to perform; only one of them
123can be specified on the command line (the
124.B -Z
125command is an exception). All these options only apply to the selected
126(or default) table.
127.TP
128.B "-A, --append"
129Append a rule to the end of the selected chain.
130.TP
131.B "-D, --delete"
132Delete the specified rule from the selected chain. There are two versions
133of this command. A rule number (starting at 1) or the complete rule can be
134specified.
135.TP
136.B "-I, --insert"
137Insert the specified rule into the selected chain at the specified rule number (1 meaning
138the head of the chain).
139.TP
140.B "-L, --list"
141List all rules in the selected chain. If no chain is selected, all chains
142are listed. If the chainname equals
143.BR DB ,
144.B ebtables
145will try to show the database. This database gives a survey of the kind of
146frames that pass the different bridge hooks. It uses the interfaces where
147the frame came in or will go out, the protocol field and the hook. This
148database is independent from the rest of
149.B ebtables
150and is in a different kernel module.
151.TP
152.B "-F, --flush"
153Flush the selected chain. If no chain is selected, every chain will be
154flushed. This does not change the policy of the chain.
155.TP
156.B "-Z, --zero"
157Put the counters of the selected chain on zero. If no chain is selected, all the counters
158are put on zero. This can be used in conjunction with the -L command (see above).
159This will cause the rule counters to be printed on the screen before they are put on zero.
160.TP
161.B "-P, --policy"
162Set the policy for the chain to the given target. The policy is either
163.B ACCEPT
164, either
165.BR DROP .
Bart De Schuymer29749c62002-06-25 21:27:57 +0000166.TP
167.B "-N, --new-chain"
168Create a new user-defined chain by the given name.
169.TP
170.B "-X, --delete-chain"
171Delete the specified user-defined chain. There must be no references to the
172chain,
173.B ebtables
174will complain if there are.
175.TP
176.B "-E, --rename-chain"
177Rename the specified chain to the new name. This has no effect on the
178structure of the table. It is also allowed to rename a base chain, f.e.
179if you like PREBRIDGING more than PREROUTING. Be sure to talk about the
180standard chain names when you would ask a question on a mailing list.
181.SS
182PARAMETERS
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000183The following parameters make up a rule specification (as used in the add
184and delete commands). A "!" argument before the specification inverts the
185test for that specification. Apart from these standard parameters, there are others, see
186.BR "MATCH EXTENSIONS" .
187.TP
188.BR "-p, --protocol " "[!] \fIprotocol\fP"
189The protocol that was responsible for creating the frame. This can be a
190hexadecimal number, above
191.IR 0x0600 ,
192a name (e.g.
193.I ARP
194) or
195.BR LENGTH .
196The protocol field of the Ethernet frame can be used to denote the
197length of the header (802.2/802.3 networks). When the value of that field is
198below (or equals)
199.IR 0x0600 ,
200the value equals the size of the header and shouldn't be used as a
201protocol number. Instead, all frames where the protocol field is used as
202the length field are assumed to be of the same 'protocol'. The protocol
203name used in
204.B ebtables
205for these frames is
206.BR LENGTH .
207.br
208The file
209.B /etc/ethertypes
210can be used to show readable
211characters instead of hexadecimal numbers for the protocols. For example,
212.I 0x0800
213will be represented by
214.IR IPV4 .
215The use of this file is not case sensitive.
216See that file for more information. The flag
217.B --proto
218is an alias for this option.
219.TP
220.BR "-i, --in-interface " "[!] \fIname\fP"
221The interface via which a frame is received (for the
222.BR INPUT ,
223.BR FORWARD ,
224.BR PREROUTING " and " BROUTING
225chains). The flag
226.B --in-if
227is an alias for this option.
228.TP
229.BR "--logical-in " "[!] \fIname\fP"
230The (logical) bridge interface via which a frame is received (for the
231.BR INPUT ,
232.BR FORWARD ,
233.BR PREROUTING " and " BROUTING
234chains).
235.TP
236.BR "-o, --out-interface " "[!] \fIname\fP"
237The interface via which a frame is going to be sent (for the
238.BR OUTPUT ,
239.B FORWARD
240and
241.B POSTROUTING
242chains). The flag
243.B --out-if
244is an alias for this option.
245.TP
246.BR "--logical-out " "[!] \fIname\fP"
247The (logical) bridge interface via which a frame is going to be sent (for
248the
249.BR OUTPUT ,
250.B FORWARD
251and
252.B POSTROUTING
253chains).
254.TP
255.BR "-s, --source " "[!] \fIaddress\fP[/\fImask\fP]"
256The source mac address. Both mask and address are written as 6 hexadecimal
257numbers seperated by colons. Alternatively one can specify Unicast,
258Multicast or Broadcast.
259.br
260Unicast=00:00:00:00:00:00/01:00:00:00:00:00,
261Multicast=01:00:00:00:00:00/01:00:00:00:00:00 and
262Broadcast=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff. Note that a broadcast
263address will also match the multicast specification. The flag
264.B --src
265is an alias for this option.
266.TP
267.BR "-d, --destination " "[!] \fIaddress\fP[/\fImask\fP]"
268The destination mac address. See -s (above) for more details. The flag
269.B --dst
270is an alias for this option.
271
272.SS OTHER OPTIONS
273.TP
274.B "-V, --version"
275Show the version of the userprogram.
276.TP
277.B "-h, --help"
278Give a brief description of the command syntax. Here you can also specify
279names of extensions and
280.B ebtables
281will try to write help about those extensions. E.g. ebtables -h snat log ip arp.
282.TP
283.BR "-b --db " "[\fIy/n\fP]"
284.IR "" "Enable (" y ") or disable (" n ") the database."
285.TP
286.BR "-j, --jump " "\fItarget\fP"
287The target of the rule. This is one of the following values:
288.BR ACCEPT ,
289.BR DROP ,
290.BR CONTINUE ,
291or a target extension, see
292.BR "TARGET EXTENSIONS" .
Bart De Schuymer86fe8602002-06-15 08:16:41 +0000293.TP
294.BR "-M, --modprobe " "\fIcommand\fP"
295When talking to the kernel, use this
296.IR command " to try to automatically load missing kernel modules."
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000297.SH MATCH EXTENSIONS
298.B ebtables
299extensions are precompiled into the userspace tool. So there is no need
300to explicitly load them with a -m option like in iptables. However, these
301extensions deal with functionality supported by supplemental kernel modules.
302.SS ip
303Specify ip specific fields. These will only work if the protocol equals
304.BR IPv4 .
305.TP
306.BR "--ip-source " "[!] \fIaddress\fP[/\fImask\fP]"
307The source ip address.
308The flag
309.B --ip-src
310is an alias for this option.
311.TP
312.BR "--ip-destination " "[!] \fIaddress\fP[/\fImask\fP]"
313The destination ip address.
314The flag
315.B --ip-dst
316is an alias for this option.
317.TP
318.BR "--ip-tos " "[!] \fItos\fP"
319The ip type of service, in hexadecimal numbers.
320.BR IPv4 .
321.TP
322.BR "--ip-protocol " "[!] \fIprotocol\fP"
323The ip protocol.
324The flag
325.B --ip-proto
326is an alias for this option.
327.SS arp
328Specify arp specific fields. These will only work if the protocol equals
329.BR ARP " or " RARP .
330.TP
331.BR "--arp-opcode " "[!] \fIopcode\fP"
332The (r)arp opcode (decimal or a string, for more details see ebtables -h arp).
333.TP
334.BR "--arp-htype " "[!] \fIhardware type\fP"
335The hardware type, this can be a decimal or the string "Ethernet". This
336is normally Ethernet (value 1).
337.TP
338.BR "--arp-ptype " "[!] \fIprotocol type\fP"
339The protocol type for which the (r)arp is used (hexadecimal or the string "IPv4").
340This is normally IPv4 (0x0800).
341.TP
342.BR "--arp-ip-src " "[!] \fIaddress\fP[/\fImask\fP]"
343The ARP IP source address specification.
344.TP
345.BR "--arp-ip-dst " "[!] \fIaddress\fP[/\fImask\fP]"
346The ARP IP destination address specification.
347.SS vlan
fnm3f794d5a2002-06-14 17:28:13 +0000348Specify 802.1Q Tag Control Information fields. These will only work if the protocol equals
fnm3ed7e9012002-06-25 16:43:23 +0000349.BR 802_1Q.
350Also see extension help by
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000351.BR "ebtables -h vlan" .
352.TP
353.BR "--vlan-id " "[!] \fIid\fP"
fnm3ed7e9012002-06-25 16:43:23 +0000354The VLAN identifier field, VID (decimal number from 0 to 4094).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000355.TP
356.BR "--vlan-prio " "[!] \fIprio\fP"
fnm3ed7e9012002-06-25 16:43:23 +0000357The user_priority field, this can be a decimal number from 0 to 7.
358Required VID to be 0 (null VID) or not specified vlan-id parameter (in this case VID deliberately be set to 0).
fnm3f794d5a2002-06-14 17:28:13 +0000359.TP
fnm3ed7e9012002-06-25 16:43:23 +0000360.BR "--vlan-encap " "[!] \fItype\fP"
361The encapsulated ethernet frame type/length, this can be a hexadecimal number from 0x0000 to 0xFFFF.
362Usually it's 0x0800 (IPv4). See also
363.B /etc/ethertypes
364file.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000365.SH WATCHER EXTENSION(S)
366Watchers are things that only look at frames passing by. These watchers only see the
367frame if the frame passes all the matches of the rule.
368.SS log
369The fact that the log module is a watcher lets us log stuff while giving a target
370by choice. Note that the log module therefore is not a target.
371.TP
372.B "--log"
373.br
374Use this if you won't specify any other log options, so if you want to use the default
375settings: log-prefix="", no arp logging, no ip logging, log-level=info.
376.TP
377.B --log-level "\fIlevel\fP"
378.br
379defines the logging level. For the possible values: ebtables -h log.
380The default level is
381.IR info .
382.TP
383.BR --log-prefix " \fItext\fP"
384.br
385defines the prefix to be printed before the logging information.
386.TP
387.B --log-ip
388.br
389will log the ip information when a frame made by the ip protocol matches
390the rule. The default is no ip information logging.
391.TP
392.B --log-arp
393.br
394will log the (r)arp information when a frame made by the (r)arp protocols
395matches the rule. The default is no (r)arp information logging.
396.SS TARGET EXTENSIONS
397.TP
398.B snat
399The
400.B snat
401target can only be used in the
402.BR POSTROUTING " chain of the " nat " table."
403It specifies that the source mac address has to be changed.
404.br
405.BR "--to-source " "\fIaddress\fP"
406.br
407The flag
408.B --to-src
409is an alias for this option.
410.br
411.BR "--snat-target " "\fItarget\fP"
412.br
413Specifies the standard target. After doing the snat, the rule still has
414to give a standard target so
415.B ebtables
416knows what to do.
417The default target is ACCEPT. Making it CONTINUE could let you use
418multiple target extensions on the same frame. Making it DROP doesn't
Bart De Schuymer29749c62002-06-25 21:27:57 +0000419make sense, but you could do that too. RETURN is also allowed. Note
420that using RETURN in a base chain will result in the CONTINUE behaviour.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000421.TP
422.B dnat
423The
424.B dnat
425target can only be used in the
426.BR BROUTING " chain of the " broute " table and the "
427.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
428It specifies that the destination mac address has to be changed.
429.br
430.BR "--to-destination " "\fIaddress\fP"
431.br
432The flag
433.B --to-dst
434is an alias for this option.
435.br
436.BR "--dnat-target " "\fItarget\fP"
437.br
438Specifies the standard target. After doing the dnat, the rule still has to
439give a standard target so
440.B ebtables
441knows what to do.
442The default target is ACCEPT. Making it CONTINUE could let you use
443multiple target extensions on the same frame. Making it DROP only makes
444sense in the BROUTING chain but using the redirect target is more logical
Bart De Schuymer29749c62002-06-25 21:27:57 +0000445there. RETURN is also allowed. Note
446that using RETURN in a base chain will result in the CONTINUE behaviour.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000447.TP
448.B redirect
449The
450.B redirect
451target will change the MAC target address to that of the bridge device the
452frame arrived on. This target can only be used in the
453.BR BROUTING " chain of the " broute " table and the "
454.BR PREROUTING " chain of the " nat " table."
455.br
456.BR "--redirect-target " "\fItarget\fP"
457.br
458Specifies the standard target. After doing the MAC redirect, the rule
459still has to give a standard target so
460.B ebtables
461knows what to do.
462The default target is ACCEPT. Making it CONTINUE could let you use
463multiple target extensions on the same frame. Making it DROP in the
Bart De Schuymer29749c62002-06-25 21:27:57 +0000464BROUTING chain will let the frames be routed. RETURN is also allowed. Note
465that using RETURN in a base chain will result in the CONTINUE behaviour.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000466.SH FILES
467.I /etc/ethertypes
468.SH BUGS
469This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
470.SH AUTHOR
471.IR "" "Bart De Schuymer <" bart.de.schuymer@pandora.be >
472.SH SEE ALSO
473.BR iptables "(8), " brctl (8)