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