blob: d4e23ea42c127c4020bbca694f8c77bcd0caced4 [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
fnm3ed7e9012002-06-25 16:43:23 +0000324.BR 802_1Q.
325Also see extension help by
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000326.BR "ebtables -h vlan" .
327.TP
328.BR "--vlan-id " "[!] \fIid\fP"
fnm3ed7e9012002-06-25 16:43:23 +0000329The VLAN identifier field, VID (decimal number from 0 to 4094).
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000330.TP
331.BR "--vlan-prio " "[!] \fIprio\fP"
fnm3ed7e9012002-06-25 16:43:23 +0000332The user_priority field, this can be a decimal number from 0 to 7.
333Required 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 +0000334.TP
fnm3ed7e9012002-06-25 16:43:23 +0000335.BR "--vlan-encap " "[!] \fItype\fP"
336The encapsulated ethernet frame type/length, this can be a hexadecimal number from 0x0000 to 0xFFFF.
337Usually it's 0x0800 (IPv4). See also
338.B /etc/ethertypes
339file.
Bart De Schuymer1abc55d2002-06-01 19:23:47 +0000340.SH WATCHER EXTENSION(S)
341Watchers are things that only look at frames passing by. These watchers only see the
342frame if the frame passes all the matches of the rule.
343.SS log
344The fact that the log module is a watcher lets us log stuff while giving a target
345by choice. Note that the log module therefore is not a target.
346.TP
347.B "--log"
348.br
349Use this if you won't specify any other log options, so if you want to use the default
350settings: log-prefix="", no arp logging, no ip logging, log-level=info.
351.TP
352.B --log-level "\fIlevel\fP"
353.br
354defines the logging level. For the possible values: ebtables -h log.
355The default level is
356.IR info .
357.TP
358.BR --log-prefix " \fItext\fP"
359.br
360defines the prefix to be printed before the logging information.
361.TP
362.B --log-ip
363.br
364will log the ip information when a frame made by the ip protocol matches
365the rule. The default is no ip information logging.
366.TP
367.B --log-arp
368.br
369will log the (r)arp information when a frame made by the (r)arp protocols
370matches the rule. The default is no (r)arp information logging.
371.SS TARGET EXTENSIONS
372.TP
373.B snat
374The
375.B snat
376target can only be used in the
377.BR POSTROUTING " chain of the " nat " table."
378It specifies that the source mac address has to be changed.
379.br
380.BR "--to-source " "\fIaddress\fP"
381.br
382The flag
383.B --to-src
384is an alias for this option.
385.br
386.BR "--snat-target " "\fItarget\fP"
387.br
388Specifies the standard target. After doing the snat, the rule still has
389to give a standard target so
390.B ebtables
391knows what to do.
392The default target is ACCEPT. Making it CONTINUE could let you use
393multiple target extensions on the same frame. Making it DROP doesn't
394make sense, but you could do that too.
395.TP
396.B dnat
397The
398.B dnat
399target can only be used in the
400.BR BROUTING " chain of the " broute " table and the "
401.BR PREROUTING " and " OUTPUT " chains of the " nat " table."
402It specifies that the destination mac address has to be changed.
403.br
404.BR "--to-destination " "\fIaddress\fP"
405.br
406The flag
407.B --to-dst
408is an alias for this option.
409.br
410.BR "--dnat-target " "\fItarget\fP"
411.br
412Specifies the standard target. After doing the dnat, the rule still has to
413give a standard target so
414.B ebtables
415knows what to do.
416The default target is ACCEPT. Making it CONTINUE could let you use
417multiple target extensions on the same frame. Making it DROP only makes
418sense in the BROUTING chain but using the redirect target is more logical
419there.
420.TP
421.B redirect
422The
423.B redirect
424target will change the MAC target address to that of the bridge device the
425frame arrived on. This target can only be used in the
426.BR BROUTING " chain of the " broute " table and the "
427.BR PREROUTING " chain of the " nat " table."
428.br
429.BR "--redirect-target " "\fItarget\fP"
430.br
431Specifies the standard target. After doing the MAC redirect, the rule
432still has to give a standard target so
433.B ebtables
434knows what to do.
435The default target is ACCEPT. Making it CONTINUE could let you use
436multiple target extensions on the same frame. Making it DROP in the
437BROUTING chain will let the frames be routed.
438.SH FILES
439.I /etc/ethertypes
440.SH BUGS
441This won't work on an architecture with a user32/kernel64 situation like the Sparc64.
442.SH AUTHOR
443.IR "" "Bart De Schuymer <" bart.de.schuymer@pandora.be >
444.SH SEE ALSO
445.BR iptables "(8), " brctl (8)