1EBTABLES(8) System Manager's Manual EBTABLES(8)
2
3
4
6 ebtables - Ethernet bridge frame table administration (nft-based)
7
9 ebtables [-t table ] -[ACDI] chain rule specification [match exten‐
10 sions] [watcher extensions] target
11 ebtables [-t table ] -P chain ACCEPT | DROP | RETURN
12 ebtables [-t table ] -F [chain]
13 ebtables [-t table ] -Z [chain]
14 ebtables [-t table ] -L [-Z] [chain] [ [--Ln] | [--Lx] ] [--Lc]
15 [--Lmac2]
16 ebtables [-t table ] -N chain [-P ACCEPT | DROP | RETURN]
17 ebtables [-t table ] -X [chain]
18 ebtables [-t table ] -E old-chain-name new-chain-name
19 ebtables [-t table ] --init-table
20
21
23 ebtables is an application program used to set up and maintain the ta‐
24 bles of rules (inside the Linux kernel) that inspect Ethernet frames.
25 It is analogous to the iptables application, but less complicated, due
26 to the fact that the Ethernet protocol is much simpler than the IP pro‐
27 tocol.
28
29 CHAINS
30 There are two ebtables tables with built-in chains in the Linux kernel.
31 These tables are used to divide functionality into different sets of
32 rules. Each set of rules is called a chain. Each chain is an ordered
33 list of rules that can match Ethernet frames. If a rule matches an Eth‐
34 ernet frame, then a processing specification tells what to do with that
35 matching frame. The processing specification is called a 'target'. How‐
36 ever, if the frame does not match the current rule in the chain, then
37 the next rule in the chain is examined and so forth. The user can cre‐
38 ate new (user-defined) chains that can be used as the 'target' of a
39 rule. User-defined chains are very useful to get better performance
40 over the linear traversal of the rules and are also essential for
41 structuring the filtering rules into well-organized and maintainable
42 sets of rules.
43
44 TARGETS
45 A firewall rule specifies criteria for an Ethernet frame and a frame
46 processing specification called a target. When a frame matches a rule,
47 then the next action performed by the kernel is specified by the tar‐
48 get. The target can be one of these values: ACCEPT, DROP, CONTINUE,
49 RETURN, an 'extension' (see below) or a jump to a user-defined chain.
50
51 ACCEPT means to let the frame through. DROP means the frame has to be
52 dropped. CONTINUE means the next rule has to be checked. This can be
53 handy, f.e., to know how many frames pass a certain point in the chain,
54 to log those frames or to apply multiple targets on a frame. RETURN
55 means stop traversing this chain and resume at the next rule in the
56 previous (calling) chain. For the extension targets please refer to
57 the TARGET EXTENSIONS section of this man page.
58
59 TABLES
60 As stated earlier, there are two ebtables tables in the Linux kernel.
61 The table names are filter and nat. Of these two tables, the filter
62 table is the default table that the command operates on. If you are
63 working with the filter table, then you can drop the '-t filter' argu‐
64 ment to the ebtables command. However, you will need to provide the -t
65 argument for nat table. Moreover, the -t argument must be the first
66 argument on the ebtables command line, if used.
67
68 -t, --table
69 filter is the default table and contains three built-in chains:
70 INPUT (for frames destined for the bridge itself, on the level
71 of the MAC destination address), OUTPUT (for locally-generated
72 or (b)routed frames) and FORWARD (for frames being forwarded by
73 the bridge).
74 nat is mostly used to change the mac addresses and contains
75 three built-in chains: PREROUTING (for altering frames as soon
76 as they come in), OUTPUT (for altering locally generated or
77 (b)routed frames before they are bridged) and POSTROUTING (for
78 altering frames as they are about to go out). A small note on
79 the naming of chains PREROUTING and POSTROUTING: it would be
80 more accurate to call them PREFORWARDING and POSTFORWARDING, but
81 for all those who come from the iptables world to ebtables it is
82 easier to have the same names. Note that you can change the name
83 (-E) if you don't like the default.
84
86 After the initial ebtables '-t table' command line argument, the re‐
87 maining arguments can be divided into several groups. These groups are
88 commands, miscellaneous commands, rule specifications, match exten‐
89 sions, watcher extensions and target extensions.
90
91 COMMANDS
92 The ebtables command arguments specify the actions to perform on the
93 table defined with the -t argument. If you do not use the -t argument
94 to name a table, the commands apply to the default filter table. Only
95 one command may be used on the command line at a time, except when the
96 commands -L and -Z are combined or the commands -N and -P are combined.
97
98 -A, --append
99 Append a rule to the end of the selected chain.
100
101 -D, --delete
102 Delete the specified rule or rules from the selected chain.
103 There are two ways to use this command. The first is by specify‐
104 ing an interval of rule numbers to delete (directly after -D).
105 Syntax: start_nr[:end_nr] (use -L --Ln to list the rules with
106 their rule number). When end_nr is omitted, all rules starting
107 from start_nr are deleted. Using negative numbers is allowed,
108 for more details about using negative numbers, see the -I com‐
109 mand. The second usage is by specifying the complete rule as it
110 would have been specified when it was added. Only the first en‐
111 countered rule that is the same as this specified rule, in other
112 words the matching rule with the lowest (positive) rule number,
113 is deleted.
114
115 -C, --change-counters
116 Change the counters of the specified rule or rules from the se‐
117 lected chain. There are two ways to use this command. The first
118 is by specifying an interval of rule numbers to do the changes
119 on (directly after -C). Syntax: start_nr[:end_nr] (use -L --Ln
120 to list the rules with their rule number). The details are the
121 same as for the -D command. The second usage is by specifying
122 the complete rule as it would have been specified when it was
123 added. Only the counters of the first encountered rule that is
124 the same as this specified rule, in other words the matching
125 rule with the lowest (positive) rule number, are changed. In
126 the first usage, the counters are specified directly after the
127 interval specification, in the second usage directly after -C.
128 First the packet counter is specified, then the byte counter. If
129 the specified counters start with a '+', the counter values are
130 added to the respective current counter values. If the speci‐
131 fied counters start with a '-', the counter values are decreased
132 from the respective current counter values. No bounds checking
133 is done. If the counters don't start with '+' or '-', the cur‐
134 rent counters are changed to the specified counters.
135
136 -I, --insert
137 Insert the specified rule into the selected chain at the speci‐
138 fied rule number. If the rule number is not specified, the rule
139 is added at the head of the chain. If the current number of
140 rules equals N, then the specified number can be between -N and
141 N+1. For a positive number i, it holds that i and i-N-1 specify
142 the same place in the chain where the rule should be inserted.
143 The rule number 0 specifies the place past the last rule in the
144 chain and using this number is therefore equivalent to using the
145 -A command. Rule numbers structly smaller than 0 can be useful
146 when more than one rule needs to be inserted in a chain.
147
148 -P, --policy
149 Set the policy for the chain to the given target. The policy can
150 be ACCEPT, DROP or RETURN.
151
152 -F, --flush
153 Flush the selected chain. If no chain is selected, then every
154 chain will be flushed. Flushing a chain does not change the pol‐
155 icy of the chain, however.
156
157 -Z, --zero
158 Set the counters of the selected chain to zero. If no chain is
159 selected, all the counters are set to zero. The -Z command can
160 be used in conjunction with the -L command. When both the -Z
161 and -L commands are used together in this way, the rule counters
162 are printed on the screen before they are set to zero.
163
164 -L, --list
165 List all rules in the selected chain. If no chain is selected,
166 all chains are listed.
167 The following options change the output of the -L command.
168 --Ln
169 Places the rule number in front of every rule. This option is
170 incompatible with the --Lx option.
171 --Lc
172 Shows the counters at the end of each rule displayed by the -L
173 command. Both a frame counter (pcnt) and a byte counter (bcnt)
174 are displayed. The frame counter shows how many frames have
175 matched the specific rule, the byte counter shows the sum of the
176 frame sizes of these matching frames. Using this option in com‐
177 bination with the --Lx option causes the counters to be written
178 out in the '-c <pcnt> <bcnt>' option format.
179 --Lx
180 Changes the output so that it produces a set of ebtables com‐
181 mands that construct the contents of the chain, when specified.
182 If no chain is specified, ebtables commands to construct the
183 contents of the table are given, including commands for creating
184 the user-defined chains (if any). You can use this set of com‐
185 mands in an ebtables boot or reload script. For example the
186 output could be used at system startup. The --Lx option is in‐
187 compatible with the --Ln listing option. Using the --Lx option
188 together with the --Lc option will cause the counters to be
189 written out in the '-c <pcnt> <bcnt>' option format.
190 --Lmac2
191 Shows all MAC addresses with the same length, adding leading ze‐
192 roes if necessary. The default representation omits leading ze‐
193 roes in the addresses.
194
195 -N, --new-chain
196 Create a new user-defined chain with the given name. The number
197 of user-defined chains is limited only by the number of possible
198 chain names. A user-defined chain name has a maximum length of
199 31 characters. The standard policy of the user-defined chain is
200 ACCEPT. The policy of the new chain can be initialized to a dif‐
201 ferent standard target by using the -P command together with the
202 -N command. In this case, the chain name does not have to be
203 specified for the -P command.
204
205 -X, --delete-chain
206 Delete the specified user-defined chain. There must be no re‐
207 maining references (jumps) to the specified chain, otherwise
208 ebtables will refuse to delete it. If no chain is specified, all
209 user-defined chains that aren't referenced will be removed.
210
211 -E, --rename-chain
212 Rename the specified chain to a new name. Besides renaming a
213 user-defined chain, you can rename a standard chain to a name
214 that suits your taste. For example, if you like PREFORWARDING
215 more than PREROUTING, then you can use the -E command to rename
216 the PREROUTING chain. If you do rename one of the standard ebta‐
217 bles chain names, please be sure to mention this fact should you
218 post a question on the ebtables mailing lists. It would be wise
219 to use the standard name in your post. Renaming a standard ebta‐
220 bles chain in this fashion has no effect on the structure or
221 functioning of the ebtables kernel table.
222
223 --init-table
224 Replace the current table data by the initial table data.
225
226 MISCELLANOUS COMMANDS
227 -V, --version
228 Show the version of the ebtables userspace program.
229
230 -h, --help [list of module names]
231 Give a brief description of the command syntax. Here you can
232 also specify names of extensions and ebtables will try to write
233 help about those extensions. E.g. ebtables -h snat log ip arp.
234 Specify list_extensions to list all extensions supported by the
235 userspace utility.
236
237 -j, --jump target
238 The target of the rule. This is one of the following values: AC‐
239 CEPT, DROP, CONTINUE, RETURN, a target extension (see TARGET EX‐
240 TENSIONS) or a user-defined chain name.
241
242 -M, --modprobe program
243 When talking to the kernel, use this program to try to automati‐
244 cally load missing kernel modules.
245
246 --concurrent
247 Use a file lock to support concurrent scripts updating the ebta‐
248 bles kernel tables.
249
250
251 RULE SPECIFICATIONS
252 The following command line arguments make up a rule specification (as
253 used in the add and delete commands). A "!" option before the specifi‐
254 cation inverts the test for that specification. Apart from these stan‐
255 dard rule specifications there are some other command line arguments of
256 interest. See both the MATCH EXTENSIONS and the WATCHER EXTENSIONS be‐
257 low.
258
259 -p, --protocol [!] protocol
260 The protocol that was responsible for creating the frame. This
261 can be a hexadecimal number, above 0x0600, a name (e.g. ARP )
262 or LENGTH. The protocol field of the Ethernet frame can be used
263 to denote the length of the header (802.2/802.3 networks). When
264 the value of that field is below or equals 0x0600, the value
265 equals the size of the header and shouldn't be used as a proto‐
266 col number. Instead, all frames where the protocol field is used
267 as the length field are assumed to be of the same 'protocol'.
268 The protocol name used in ebtables for these frames is LENGTH.
269 The file /etc/ethertypes can be used to show readable characters
270 instead of hexadecimal numbers for the protocols. For example,
271 0x0800 will be represented by IPV4. The use of this file is not
272 case sensitive. See that file for more information. The flag
273 --proto is an alias for this option.
274
275 -i, --in-interface [!] name
276 The interface (bridge port) via which a frame is received (this
277 option is useful in the INPUT, FORWARD, PREROUTING and BROUTING
278 chains). If the interface name ends with '+', then any interface
279 name that begins with this name (disregarding '+') will match.
280 The flag --in-if is an alias for this option.
281
282 --logical-in [!] name
283 The (logical) bridge interface via which a frame is received
284 (this option is useful in the INPUT, FORWARD, PREROUTING and
285 BROUTING chains). If the interface name ends with '+', then any
286 interface name that begins with this name (disregarding '+')
287 will match.
288
289 -o, --out-interface [!] name
290 The interface (bridge port) via which a frame is going to be
291 sent (this option is useful in the OUTPUT, FORWARD and POSTROUT‐
292 ING chains). If the interface name ends with '+', then any in‐
293 terface name that begins with this name (disregarding '+') will
294 match. The flag --out-if is an alias for this option.
295
296 --logical-out [!] name
297 The (logical) bridge interface via which a frame is going to be
298 sent (this option is useful in the OUTPUT, FORWARD and POSTROUT‐
299 ING chains). If the interface name ends with '+', then any in‐
300 terface name that begins with this name (disregarding '+') will
301 match.
302
303 -s, --source [!] address[/mask]
304 The source MAC address. Both mask and address are written as 6
305 hexadecimal numbers separated by colons. Alternatively one can
306 specify Unicast, Multicast, Broadcast or BGA (Bridge Group Ad‐
307 dress):
308 Unicast=00:00:00:00:00:00/01:00:00:00:00:00, Multi‐
309 cast=01:00:00:00:00:00/01:00:00:00:00:00, Broad‐
310 cast=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or
311 BGA=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff. Note that a broadcast
312 address will also match the multicast specification. The flag
313 --src is an alias for this option.
314
315 -d, --destination [!] address[/mask]
316 The destination MAC address. See -s (above) for more details on
317 MAC addresses. The flag --dst is an alias for this option.
318
319 -c, --set-counter pcnt bcnt
320 If used with -A or -I, then the packet and byte counters of the
321 new rule will be set to pcnt, resp. bcnt. If used with the -C
322 or -D commands, only rules with a packet and byte count equal to
323 pcnt, resp. bcnt will match.
324
325
326 MATCH EXTENSIONS
327 Ebtables extensions are dynamically loaded into the userspace tool,
328 there is therefore no need to explicitly load them with a -m option
329 like is done in iptables. These extensions deal with functionality
330 supported by kernel modules supplemental to the core ebtables code.
331
332 802_3
333 Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be
334 specified as LENGTH (see the option -p above).
335
336 --802_3-sap [!] sap
337 DSAP and SSAP are two one byte 802.3 fields. The bytes are al‐
338 ways equal, so only one byte (hexadecimal) is needed as an argu‐
339 ment.
340
341 --802_3-type [!] type
342 If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type
343 field must be consulted to determine the payload protocol. This
344 is a two byte (hexadecimal) argument. Only 802.3 frames with
345 DSAP/SSAP 0xaa are checked for type.
346
347 among
348 Match a MAC address or MAC/IP address pair versus a list of MAC ad‐
349 dresses and MAC/IP address pairs. A list entry has the following for‐
350 mat: xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,]. Multiple list entries are sep‐
351 arated by a comma, specifying an IP address corresponding to the MAC
352 address is optional. Multiple MAC/IP address pairs with the same MAC
353 address but different IP address (and vice versa) can be specified. If
354 the MAC address doesn't match any entry from the list, the frame
355 doesn't match the rule (unless "!" was used).
356
357 --among-dst [!] list
358 Compare the MAC destination to the given list. If the Ethernet
359 frame has type IPv4 or ARP, then comparison with MAC/IP destina‐
360 tion address pairs from the list is possible.
361
362 --among-src [!] list
363 Compare the MAC source to the given list. If the Ethernet frame
364 has type IPv4 or ARP, then comparison with MAC/IP source address
365 pairs from the list is possible.
366
367 --among-dst-file [!] file
368 Same as --among-dst but the list is read in from the specified
369 file.
370
371 --among-src-file [!] file
372 Same as --among-src but the list is read in from the specified
373 file.
374
375 arp
376 Specify (R)ARP fields. The protocol must be specified as ARP or RARP.
377
378 --arp-opcode [!] opcode
379 The (R)ARP opcode (decimal or a string, for more details see
380 ebtables -h arp).
381
382 --arp-htype [!] hardware type
383 The hardware type, this can be a decimal or the string Ethernet
384 (which sets type to 1). Most (R)ARP packets have Eternet as
385 hardware type.
386
387 --arp-ptype [!] protocol type
388 The protocol type for which the (r)arp is used (hexadecimal or
389 the string IPv4, denoting 0x0800). Most (R)ARP packets have
390 protocol type IPv4.
391
392 --arp-ip-src [!] address[/mask]
393 The (R)ARP IP source address specification.
394
395 --arp-ip-dst [!] address[/mask]
396 The (R)ARP IP destination address specification.
397
398 --arp-mac-src [!] address[/mask]
399 The (R)ARP MAC source address specification.
400
401 --arp-mac-dst [!] address[/mask]
402 The (R)ARP MAC destination address specification.
403
404 [!] --arp-gratuitous
405 Checks for ARP gratuitous packets: checks equality of IPv4
406 source address and IPv4 destination address inside the ARP
407 header.
408
409 ip
410 Specify IPv4 fields. The protocol must be specified as IPv4.
411
412 --ip-source [!] address[/mask]
413 The source IP address. The flag --ip-src is an alias for this
414 option.
415
416 --ip-destination [!] address[/mask]
417 The destination IP address. The flag --ip-dst is an alias for
418 this option.
419
420 --ip-tos [!] tos
421 The IP type of service, in hexadecimal numbers. IPv4.
422
423 --ip-protocol [!] protocol
424 The IP protocol. The flag --ip-proto is an alias for this op‐
425 tion.
426
427 --ip-source-port [!] port1[:port2]
428 The source port or port range for the IP protocols 6 (TCP), 17
429 (UDP), 33 (DCCP) or 132 (SCTP). The --ip-protocol option must be
430 specified as TCP, UDP, DCCP or SCTP. If port1 is omitted,
431 0:port2 is used; if port2 is omitted but a colon is specified,
432 port1:65535 is used. The flag --ip-sport is an alias for this
433 option.
434
435 --ip-destination-port [!] port1[:port2]
436 The destination port or port range for ip protocols 6 (TCP), 17
437 (UDP), 33 (DCCP) or 132 (SCTP). The --ip-protocol option must be
438 specified as TCP, UDP, DCCP or SCTP. If port1 is omitted,
439 0:port2 is used; if port2 is omitted but a colon is specified,
440 port1:65535 is used. The flag --ip-dport is an alias for this
441 option.
442
443 ip6
444 Specify IPv6 fields. The protocol must be specified as IPv6.
445
446 --ip6-source [!] address[/mask]
447 The source IPv6 address. The flag --ip6-src is an alias for
448 this option.
449
450 --ip6-destination [!] address[/mask]
451 The destination IPv6 address. The flag --ip6-dst is an alias
452 for this option.
453
454 --ip6-tclass [!] tclass
455 The IPv6 traffic class, in hexadecimal numbers.
456
457 --ip6-protocol [!] protocol
458 The IP protocol. The flag --ip6-proto is an alias for this op‐
459 tion.
460
461 --ip6-source-port [!] port1[:port2]
462 The source port or port range for the IPv6 protocols 6 (TCP), 17
463 (UDP), 33 (DCCP) or 132 (SCTP). The --ip6-protocol option must
464 be specified as TCP, UDP, DCCP or SCTP. If port1 is omitted,
465 0:port2 is used; if port2 is omitted but a colon is specified,
466 port1:65535 is used. The flag --ip6-sport is an alias for this
467 option.
468
469 --ip6-destination-port [!] port1[:port2]
470 The destination port or port range for IPv6 protocols 6 (TCP),
471 17 (UDP), 33 (DCCP) or 132 (SCTP). The --ip6-protocol option
472 must be specified as TCP, UDP, DCCP or SCTP. If port1 is omit‐
473 ted, 0:port2 is used; if port2 is omitted but a colon is speci‐
474 fied, port1:65535 is used. The flag --ip6-dport is an alias for
475 this option.
476
477 --ip6-icmp-type [!] {type[:type]/code[:code]|typename}
478 Specify ipv6-icmp type and code to match. Ranges for both type
479 and code are supported. Type and code are separated by a slash.
480 Valid numbers for type and range are 0 to 255. To match a sin‐
481 gle type including all valid codes, symbolic names can be used
482 instead of numbers. The list of known type names is shown by the
483 command
484 ebtables --help ip6
485 This option is only valid for --ip6-prococol ipv6-icmp.
486
487 limit
488 This module matches at a limited rate using a token bucket filter. A
489 rule using this extension will match until this limit is reached. It
490 can be used with the --log watcher to give limited logging, for exam‐
491 ple. Its use is the same as the limit match of iptables.
492
493 --limit [value]
494 Maximum average matching rate: specified as a number, with an
495 optional /second, /minute, /hour, or /day suffix; the default is
496 3/hour.
497
498 --limit-burst [number]
499 Maximum initial number of packets to match: this number gets
500 recharged by one every time the limit specified above is not
501 reached, up to this number; the default is 5.
502
503 mark_m
504 --mark [!] [value][/mask]
505 Matches frames with the given unsigned mark value. If a value
506 and mask are specified, the logical AND of the mark value of the
507 frame and the user-specified mask is taken before comparing it
508 with the user-specified mark value. When only a mark value is
509 specified, the packet only matches when the mark value of the
510 frame equals the user-specified mark value. If only a mask is
511 specified, the logical AND of the mark value of the frame and
512 the user-specified mask is taken and the frame matches when the
513 result of this logical AND is non-zero. Only specifying a mask
514 is useful to match multiple mark values.
515
516 pkttype
517 --pkttype-type [!] type
518 Matches on the Ethernet "class" of the frame, which is deter‐
519 mined by the generic networking code. Possible values: broadcast
520 (MAC destination is the broadcast address), multicast (MAC des‐
521 tination is a multicast address), host (MAC destination is the
522 receiving network device), or otherhost (none of the above).
523
524 stp
525 Specify stp BPDU (bridge protocol data unit) fields. The destination
526 address (-d) must be specified as the bridge group address (BGA). For
527 all options for which a range of values can be specified, it holds that
528 if the lower bound is omitted (but the colon is not), then the lowest
529 possible lower bound for that option is used, while if the upper bound
530 is omitted (but the colon again is not), the highest possible upper
531 bound for that option is used.
532
533 --stp-type [!] type
534 The BPDU type (0-255), recognized non-numerical types are con‐
535 fig, denoting a configuration BPDU (=0), and tcn, denothing a
536 topology change notification BPDU (=128).
537
538 --stp-flags [!] flag
539 The BPDU flag (0-255), recognized non-numerical flags are topol‐
540 ogy-change, denoting the topology change flag (=1), and topol‐
541 ogy-change-ack, denoting the topology change acknowledgement
542 flag (=128).
543
544 --stp-root-prio [!] [prio][:prio]
545 The root priority (0-65535) range.
546
547 --stp-root-addr [!] [address][/mask]
548 The root mac address, see the option -s for more details.
549
550 --stp-root-cost [!] [cost][:cost]
551 The root path cost (0-4294967295) range.
552
553 --stp-sender-prio [!] [prio][:prio]
554 The BPDU's sender priority (0-65535) range.
555
556 --stp-sender-addr [!] [address][/mask]
557 The BPDU's sender mac address, see the option -s for more de‐
558 tails.
559
560 --stp-port [!] [port][:port]
561 The port identifier (0-65535) range.
562
563 --stp-msg-age [!] [age][:age]
564 The message age timer (0-65535) range.
565
566 --stp-max-age [!] [age][:age]
567 The max age timer (0-65535) range.
568
569 --stp-hello-time [!] [time][:time]
570 The hello time timer (0-65535) range.
571
572 --stp-forward-delay [!] [delay][:delay]
573 The forward delay timer (0-65535) range.
574
575 vlan
576 Specify 802.1Q Tag Control Information fields. The protocol must be
577 specified as 802_1Q (0x8100).
578
579 --vlan-id [!] id
580 The VLAN identifier field (VID). Decimal number from 0 to 4095.
581
582 --vlan-prio [!] prio
583 The user priority field, a decimal number from 0 to 7. The VID
584 should be set to 0 ("null VID") or unspecified (in the latter
585 case the VID is deliberately set to 0).
586
587 --vlan-encap [!] type
588 The encapsulated Ethernet frame type/length. Specified as a
589 hexadecimal number from 0x0000 to 0xFFFF or as a symbolic name
590 from /etc/ethertypes.
591
592
593 WATCHER EXTENSIONS
594 Watchers only look at frames passing by, they don't modify them nor de‐
595 cide to accept the frames or not. These watchers only see the frame if
596 the frame matches the rule, and they see it before the target is exe‐
597 cuted.
598
599 log
600 The log watcher writes descriptive data about a frame to the syslog.
601
602 --log
603 Log with the default loggin options: log-level= info, log-pre‐
604 fix="", no ip logging, no arp logging.
605
606 --log-level level
607 Defines the logging level. For the possible values, see ebtables
608 -h log. The default level is info.
609
610 --log-prefix text
611 Defines the prefix text to be printed at the beginning of the
612 line with the logging information.
613
614 --log-ip
615 Will log the ip information when a frame made by the ip protocol
616 matches the rule. The default is no ip information logging.
617
618 --log-ip6
619 Will log the ipv6 information when a frame made by the ipv6 pro‐
620 tocol matches the rule. The default is no ipv6 information log‐
621 ging.
622
623 --log-arp
624 Will log the (r)arp information when a frame made by the (r)arp
625 protocols matches the rule. The default is no (r)arp information
626 logging.
627
628 nflog
629 The nflog watcher passes the packet to the loaded logging backend in
630 order to log the packet. This is usually used in combination with
631 nfnetlink_log as logging backend, which will multicast the packet
632 through a netlink socket to the specified multicast group. One or more
633 userspace processes may subscribe to the group to receive the packets.
634
635 --nflog
636 Log with the default logging options
637
638 --nflog-group nlgroup
639 The netlink group (1 - 2^32-1) to which packets are (only appli‐
640 cable for nfnetlink_log). The default value is 1.
641
642 --nflog-prefix prefix
643 A prefix string to include in the log message, up to 30 charac‐
644 ters long, useful for distinguishing messages in the logs.
645
646 --nflog-range size
647 The number of bytes to be copied to userspace (only applicable
648 for nfnetlink_log). nfnetlink_log instances may specify their
649 own range, this option overrides it.
650
651 --nflog-threshold size
652 Number of packets to queue inside the kernel before sending them
653 to userspace (only applicable for nfnetlink_log). Higher values
654 result in less overhead per packet, but increase delay until the
655 packets reach userspace. The default value is 1.
656
657 ulog
658 The ulog watcher passes the packet to a userspace logging daemon using
659 netlink multicast sockets. This differs from the log watcher in the
660 sense that the complete packet is sent to userspace instead of a de‐
661 scriptive text and that netlink multicast sockets are used instead of
662 the syslog. This watcher enables parsing of packets with userspace
663 programs, the physical bridge in and out ports are also included in the
664 netlink messages. The ulog watcher module accepts 2 parameters when
665 the module is loaded into the kernel (e.g. with modprobe): nlbufsiz
666 specifies how big the buffer for each netlink multicast group is. If
667 you say nlbufsiz=8192, for example, up to eight kB of packets will get
668 accumulated in the kernel until they are sent to userspace. It is not
669 possible to allocate more than 128kB. Please also keep in mind that
670 this buffer size is allocated for each nlgroup you are using, so the
671 total kernel memory usage increases by that factor. The default is
672 4096. flushtimeout specifies after how many hundredths of a second the
673 queue should be flushed, even if it is not full yet. The default is 10
674 (one tenth of a second).
675
676 --ulog
677 Use the default settings: ulog-prefix="", ulog-nlgroup=1, ulog-
678 cprange=4096, ulog-qthreshold=1.
679
680 --ulog-prefix text
681 Defines the prefix included with the packets sent to userspace.
682
683 --ulog-nlgroup group
684 Defines which netlink group number to use (a number from 1 to
685 32). Make sure the netlink group numbers used for the iptables
686 ULOG target differ from those used for the ebtables ulog
687 watcher. The default group number is 1.
688
689 --ulog-cprange range
690 Defines the maximum copy range to userspace, for packets match‐
691 ing the rule. The default range is 0, which means the maximum
692 copy range is given by nlbufsiz. A maximum copy range larger
693 than 128*1024 is meaningless as the packets sent to userspace
694 have an upper size limit of 128*1024.
695
696 --ulog-qthreshold threshold
697 Queue at most threshold number of packets before sending them to
698 userspace with a netlink socket. Note that packets can be sent
699 to userspace before the queue is full, this happens when the
700 ulog kernel timer goes off (the frequency of this timer depends
701 on flushtimeout).
702
703 TARGET EXTENSIONS
704 arpreply
705 The arpreply target can be used in the PREROUTING chain of the nat ta‐
706 ble. If this target sees an ARP request it will automatically reply
707 with an ARP reply. The used MAC address for the reply can be specified.
708 The protocol must be specified as ARP. When the ARP message is not an
709 ARP request or when the ARP request isn't for an IP address on an Eth‐
710 ernet network, it is ignored by this target (CONTINUE). When the ARP
711 request is malformed, it is dropped (DROP).
712
713 --arpreply-mac address
714 Specifies the MAC address to reply with: the Ethernet source MAC
715 and the ARP payload source MAC will be filled in with this ad‐
716 dress.
717
718 --arpreply-target target
719 Specifies the standard target. After sending the ARP reply, the
720 rule still has to give a standard target so ebtables knows what
721 to do with the ARP request. The default target is DROP.
722
723 dnat
724 The dnat target can only be used in the PREROUTING and OUTPUT chains of
725 the nat table. It specifies that the destination MAC address has to be
726 changed.
727
728 --to-destination address
729 Change the destination MAC address to the specified address.
730 The flag --to-dst is an alias for this option.
731
732 --dnat-target target
733 Specifies the standard target. After doing the dnat, the rule
734 still has to give a standard target so ebtables knows what to do
735 with the dnated frame. The default target is ACCEPT. Making it
736 CONTINUE could let you use multiple target extensions on the
737 same frame. Making it DROP only makes sense in the BROUTING
738 chain but using the redirect target is more logical there. RE‐
739 TURN is also allowed. Note that using RETURN in a base chain is
740 not allowed (for obvious reasons).
741
742 mark
743 The mark target can be used in every chain of every table. It is possi‐
744 ble to use the marking of a frame/packet in both ebtables and iptables,
745 if the bridge-nf code is compiled into the kernel. Both put the marking
746 at the same place. This allows for a form of communication between
747 ebtables and iptables.
748
749 --mark-set value
750 Mark the frame with the specified non-negative value.
751
752 --mark-or value
753 Or the frame with the specified non-negative value.
754
755 --mark-and value
756 And the frame with the specified non-negative value.
757
758 --mark-xor value
759 Xor the frame with the specified non-negative value.
760
761 --mark-target target
762 Specifies the standard target. After marking the frame, the rule
763 still has to give a standard target so ebtables knows what to
764 do. The default target is ACCEPT. Making it CONTINUE can let
765 you do other things with the frame in subsequent rules of the
766 chain.
767
768 redirect
769 The redirect target will change the MAC target address to that of the
770 bridge device the frame arrived on. This target can only be used in the
771 PREROUTING chain of the nat table. The MAC address of the bridge is
772 used as destination address."
773
774 --redirect-target target
775 Specifies the standard target. After doing the MAC redirect, the
776 rule still has to give a standard target so ebtables knows what
777 to do. The default target is ACCEPT. Making it CONTINUE could
778 let you use multiple target extensions on the same frame. Making
779 it DROP in the BROUTING chain will let the frames be routed. RE‐
780 TURN is also allowed. Note that using RETURN in a base chain is
781 not allowed.
782
783 snat
784 The snat target can only be used in the POSTROUTING chain of the nat
785 table. It specifies that the source MAC address has to be changed.
786
787 --to-source address
788 Changes the source MAC address to the specified address. The
789 flag --to-src is an alias for this option.
790
791 --snat-target target
792 Specifies the standard target. After doing the snat, the rule
793 still has to give a standard target so ebtables knows what to
794 do. The default target is ACCEPT. Making it CONTINUE could let
795 you use multiple target extensions on the same frame. Making it
796 DROP doesn't make sense, but you could do that too. RETURN is
797 also allowed. Note that using RETURN in a base chain is not al‐
798 lowed.
799
800 --snat-arp
801 Also change the hardware source address inside the arp header if
802 the packet is an arp message and the hardware address length in
803 the arp header is 6 bytes.
804
806 /etc/ethertypes
807
809 See http://netfilter.org/mailinglists.html
810
812 The version of ebtables this man page ships with does not support the
813 broute table. Also there is no support for string match. Further, sup‐
814 port for atomic-options (--atomic-file, --atomic-init, --atomic-save,
815 --atomic-commit) has not been implemented, although ebtables-save and
816 ebtables-restore might replace them entirely given the inherent atomic‐
817 ity of nftables. Finally, this list is probably not complete.
818
820 xtables-nft(8), iptables(8), ip(8)
821
822 See https://wiki.nftables.org
823
824
825
826 December 2011 EBTABLES(8)