Debian Codegraph @

upstream/debian-unstable/man8/ebtables-nft.8

raw
1 .TH EBTABLES 8 "December 2011"
2 .\"
3 .\" Man page written by Bart De Schuymer <[email protected]>
4 .\" It is based on the iptables man page.
5 .\"
6 .\" The man page was edited, February 25th 2003, by
7 .\" Greg Morgan <" dr_kludge_at_users_sourceforge_net >
8 .\"
9 .\" 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
27 ebtables \(em Ethernet bridge frame table administration (nft-based)
28 .SH SYNOPSIS
29 .BR "ebtables " [ -t " table ] " - [ ACDI "] chain rule specification [match extensions] [watcher extensions] target"
30 .br
31 .BR "ebtables " [ -t " table ] " -P " chain " ACCEPT " | " DROP " | " RETURN
32 .br
33 .BR "ebtables " [ -t " table ] " -F " [chain]"
34 .br
35 .BR "ebtables " [ -t " table ] " -Z " [chain]"
36 .br
37 .BR "ebtables " [ -t " table ] " -L " [" -Z "] [chain] [ [" --Ln "] | [" --Lx "] ] [" --Lc "] [" --Lmac2 ]
38 .br
39 .BR "ebtables " [ -t " table ] " -N " chain [" "-P ACCEPT " | " DROP " | " RETURN" ]
40 .br
41 .BR "ebtables " [ -t " table ] " -X " [chain]"
42 .br
43 .BR "ebtables " [ -t " table ] " -E " old-chain-name new-chain-name"
44 .br
45 .BR "ebtables " [ -t " table ] " --init-table
46 .br
47
48 .SH DESCRIPTION
49 .B ebtables
50 is an application program used to set up and maintain the
51 tables of rules (inside the Linux kernel) that inspect
52 Ethernet frames.
53 It is analogous to the
54 .B iptables
55 application, but less complicated, due to the fact that the Ethernet protocol
56 is much simpler than the IP protocol.
57 .SS CHAINS
58 There are three ebtables tables with built-in chains in the
59 Linux kernel. These tables are used to divide functionality into
60 different sets of rules. Each set of rules is called a chain.
61 Each chain is an ordered list of rules that can match Ethernet frames. If a
62 rule matches an Ethernet frame, then a processing specification tells
63 what to do with that matching frame. The processing specification is
64 called a 'target'. However, if the frame does not match the current
65 rule in the chain, then the next rule in the chain is examined and so forth.
66 The user can create new (user-defined) chains that can be used as the 'target'
67 of a rule. User-defined chains are very useful to get better performance
68 over the linear traversal of the rules and are also essential for structuring
69 the filtering rules into well-organized and maintainable sets of rules.
70 .SS TARGETS
71 A firewall rule specifies criteria for an Ethernet frame and a frame
72 processing specification called a target. When a frame matches a rule,
73 then the next action performed by the kernel is specified by the target.
74 The target can be one of these values:
75 .BR ACCEPT ,
76 .BR DROP ,
77 .BR CONTINUE ,
78 .BR RETURN ,
79 an 'extension' (see below) or a jump to a user-defined chain.
80 .PP
81 .B ACCEPT
82 means to let the frame through.
83 .B DROP
84 means the frame has to be dropped. In the
85 .BR BROUTING " chain however, the " ACCEPT " and " DROP " target have different"
86 meanings (see the info provided for the
87 .BR -t " option)."
88 .B CONTINUE
89 means the next rule has to be checked. This can be handy, f.e., to know how many
90 frames pass a certain point in the chain, to log those frames or to apply multiple
91 targets on a frame.
92 .B RETURN
93 means stop traversing this chain and resume at the next rule in the
94 previous (calling) chain.
95 For the extension targets please refer to the
96 .B "TARGET EXTENSIONS"
97 section of this man page.
98 .SS TABLES
99 As stated earlier, the table names are
100 .BR filter ", " nat " and " broute .
101 Of these tables,
102 the filter table is the default table that the command operates on.
103 If you are working with a table other than filter, you will need to provide
104 the -t argument. Moreover, the -t argument must be the
105 first argument on the ebtables command line, if used.
106 .TP
107 .B "-t, --table"
108 .br
109 .B filter
110 is the default table and contains three built-in chains:
111 .B INPUT
112 (for frames destined for the bridge itself, on the level of the MAC destination address),
113 .B OUTPUT
114 (for locally-generated or (b)routed frames) and
115 .B FORWARD
116 (for frames being forwarded by the bridge).
117 .br
118 .br
119 .B nat
120 is mostly used to change the mac addresses and contains three built-in chains:
121 .B PREROUTING
122 (for altering frames as soon as they come in),
123 .B OUTPUT
124 (for altering locally generated or (b)routed frames before they are bridged) and
125 .B POSTROUTING
126 (for altering frames as they are about to go out). A small note on the naming
127 of chains PREROUTING and POSTROUTING: it would be more accurate to call them
128 PREFORWARDING and POSTFORWARDING, but for all those who come from the
129 iptables world to ebtables it is easier to have the same names. Note that you
130 can change the name
131 .BR "" ( -E )
132 if you don't like the default.
133 .br
134 .br
135 .B broute
136 is used to make a brouter, it has one built-in chain:
137 .BR BROUTING .
138 The targets
139 .BR DROP " and " ACCEPT
140 have a special meaning in the broute table (these names are used for
141 compatibility reasons with ebtables-legacy).
142 .B DROP
143 actually means the frame has to be routed, while
144 .B ACCEPT
145 means the frame has to be bridged. The
146 .B BROUTING
147 chain is traversed very early.
148 Normally those frames
149 would be bridged, but you can decide otherwise here.
150 .SH EBTABLES COMMAND LINE ARGUMENTS
151 After the initial ebtables '-t table' command line argument, the remaining
152 arguments can be divided into several groups. These groups
153 are commands, miscellaneous commands, rule specifications, match extensions,
154 watcher extensions and target extensions.
155 .SS COMMANDS
156 The ebtables command arguments specify the actions to perform on the table
157 defined with the -t argument. If you do not use the -t argument to name
158 a table, the commands apply to the default filter table.
159 Only one command may be used on the command line at a time, except when
160 the commands
161 .BR -L " and " -Z
162 are combined or the commands
163 .BR -N " and " -P
164 are combined.
165 .TP
166 .B "-A, --append"
167 Append a rule to the end of the selected chain.
168 .TP
169 .B "-D, --delete"
170 Delete the specified rule or rules from the selected chain. There are two ways to
171 use this command. The first is by specifying an interval of rule numbers
172 to delete (directly after
173 .BR -D ).
174 Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
175 .B -L --Ln
176 to list the rules with their rule number). When \fIend_nr\fP is omitted, all rules starting
177 from \fIstart_nr\fP are deleted. Using negative numbers is allowed, for more
178 details about using negative numbers, see the
179 .B -I
180 command. The second usage is by
181 specifying the complete rule as it would have been specified when it was added. Only
182 the first encountered rule that is the same as this specified rule, in other
183 words the matching rule with the lowest (positive) rule number, is deleted.
184 .TP
185 .B "-C, --change-counters"
186 Change the counters of the specified rule or rules from the selected chain. There are two ways to
187 use this command. The first is by specifying an interval of rule numbers
188 to do the changes on (directly after
189 .BR -C ).
190 Syntax: \fIstart_nr\fP[\fI:end_nr\fP] (use
191 .B -L --Ln
192 to list the rules with their rule number). The details are the same as for the
193 .BR -D " command. The second usage is by"
194 specifying the complete rule as it would have been specified when it was added. Only
195 the counters of the first encountered rule that is the same as this specified rule, in other
196 words the matching rule with the lowest (positive) rule number, are changed.
197 In the first usage, the counters are specified directly after the interval specification,
198 in the second usage directly after
199 .BR -C .
200 First the packet counter is specified, then the byte counter. If the specified counters start
201 with a '+', the counter values are added to the respective current counter values.
202 If the specified counters start with a '-', the counter values are decreased from the respective
203 current counter values. No bounds checking is done. If the counters don't start with '+' or '-',
204 the current counters are changed to the specified counters.
205 .TP
206 .B "-I, --insert"
207 Insert the specified rule into the selected chain at the specified rule number. If the
208 rule number is not specified, the rule is added at the head of the chain.
209 If the current number of rules equals
210 .IR N ,
211 then the specified number can be
212 between
213 .IR -N " and " N+1 .
214 For a positive number
215 .IR i ,
216 it holds that
217 .IR i " and " i-N-1
218 specify the same place in the chain where the rule should be inserted. The rule number
219 0 specifies the place past the last rule in the chain and using this number is therefore
220 equivalent to using the
221 .BR -A " command."
222 Rule numbers structly smaller than 0 can be useful when more than one rule needs to be inserted
223 in a chain.
224 .TP
225 .B "-P, --policy"
226 Set the policy for the chain to the given target. The policy can be
227 .BR ACCEPT ", " DROP " or " RETURN .
228 .TP
229 .B "-F, --flush"
230 Flush the selected chain. If no chain is selected, then every chain will be
231 flushed. Flushing a chain does not change the policy of the
232 chain, however.
233 .TP
234 .B "-Z, --zero"
235 Set the counters of the selected chain to zero. If no chain is selected, all the counters
236 are set to zero. The
237 .B "-Z"
238 command can be used in conjunction with the
239 .B "-L"
240 command.
241 When both the
242 .B "-Z"
243 and
244 .B "-L"
245 commands are used together in this way, the rule counters are printed on the screen
246 before they are set to zero.
247 .TP
248 .B "-L, --list"
249 List all rules in the selected chain. If no chain is selected, all chains
250 are listed.
251 .br
252 The following options change the output of the
253 .B "-L"
254 command.
255 .br
256 .B "--Ln"
257 .br
258 Places the rule number in front of every rule. This option is incompatible with the
259 .BR --Lx " option."
260 .br
261 .B "--Lc"
262 .br
263 Shows the counters at the end of each rule displayed by the
264 .B "-L"
265 command. Both a frame counter (pcnt) and a byte counter (bcnt) are displayed.
266 The frame counter shows how many frames have matched the specific rule, the byte
267 counter shows the sum of the frame sizes of these matching frames. Using this option
268 .BR "" "in combination with the " --Lx " option causes the counters to be written out"
269 .BR "" "in the '" -c " <pcnt> <bcnt>' option format."
270 .br
271 .B "--Lx"
272 .br
273 Changes the output so that it produces a set of ebtables commands that construct
274 the contents of the chain, when specified.
275 If no chain is specified, ebtables commands to construct the contents of the
276 table are given, including commands for creating the user-defined chains (if any).
277 You can use this set of commands in an ebtables boot or reload
278 script. For example the output could be used at system startup.
279 The
280 .B "--Lx"
281 option is incompatible with the
282 .B "--Ln"
283 listing option. Using the
284 .BR --Lx " option together with the " --Lc " option will cause the counters to be written out"
285 .BR "" "in the '" -c " <pcnt> <bcnt>' option format."
286 .br
287 .B "--Lmac2"
288 .br
289 Shows all MAC addresses with the same length, adding leading zeroes
290 if necessary. The default representation omits leading zeroes in the addresses.
291 .TP
292 .B "-N, --new-chain"
293 Create a new user-defined chain with the given name. The number of
294 user-defined chains is limited only by the number of possible chain names.
295 A user-defined chain name has a maximum
296 length of 31 characters. The standard policy of the user-defined chain is
297 ACCEPT. The policy of the new chain can be initialized to a different standard
298 target by using the
299 .B -P
300 command together with the
301 .B -N
302 command. In this case, the chain name does not have to be specified for the
303 .B -P
304 command.
305 .TP
306 .B "-X, --delete-chain"
307 Delete the specified user-defined chain. There must be no remaining references (jumps)
308 to the specified chain, otherwise ebtables will refuse to delete it. If no chain is
309 specified, all user-defined chains that aren't referenced will be removed.
310 .TP
311 .B "-E, --rename-chain"
312 Rename the specified chain to a new name. Besides renaming a user-defined
313 chain, you can rename a standard chain to a name that suits your
314 taste. For example, if you like PREFORWARDING more than PREROUTING,
315 then you can use the -E command to rename the PREROUTING chain. If you do
316 rename one of the standard ebtables chain names, please be sure to mention
317 this fact should you post a question on the ebtables mailing lists.
318 It would be wise to use the standard name in your post. Renaming a standard
319 ebtables chain in this fashion has no effect on the structure or functioning
320 of the ebtables kernel table.
321 .TP
322 .B "--init-table"
323 Replace the current table data by the initial table data.
324 .SS MISCELLANEOUS COMMANDS
325 .TP
326 .B "-v, --verbose"
327 Verbose mode.
328 For appending, insertion, deletion and replacement, this causes
329 detailed information on the rule or rules to be printed. \fB\-v\fP may be
330 specified multiple times to possibly emit more detailed debug statements.
331 .TP
332 .B "-V, --version"
333 Show the version of the ebtables userspace program.
334 .TP
335 .BR "-h, --help " "[\fIlist of module names\fP]"
336 Give a brief description of the command syntax. Here you can also specify
337 names of extensions and ebtables will try to write help about those
338 extensions. E.g.
339 .IR "ebtables -h snat log ip arp" .
340 Specify
341 .I list_extensions
342 to list all extensions supported by the userspace
343 utility.
344 .TP
345 .BR "-j, --jump " "\fItarget\fP"
346 The target of the rule. This is one of the following values:
347 .BR ACCEPT ,
348 .BR DROP ,
349 .BR CONTINUE ,
350 .BR RETURN ,
351 a target extension (see
352 .BR "TARGET EXTENSIONS" ")"
353 or a user-defined chain name.
354 .TP
355 .B -M, --modprobe "\fIprogram\fP"
356 When talking to the kernel, use this
357 .I program
358 to try to automatically load missing kernel modules.
359 .TP
360 .B --concurrent
361 This would use a file lock to support concurrent scripts updating the ebtables
362 kernel tables. It is not needed with \fBebtables-nft\fP though and thus ignored.
363
364 .SS
365 RULE SPECIFICATIONS
366 The following command line arguments make up a rule specification (as used
367 in the add and delete commands). A "!" option before the specification
368 inverts the test for that specification. Apart from these standard rule
369 specifications there are some other command line arguments of interest.
370 See both the
371 .BR "MATCH EXTENSIONS"
372 and the
373 .BR "WATCHER EXTENSIONS"
374 below.
375 .TP
376 .RB [ ! ] " -p" , " --protocol " \fIprotocol\fP
377 The protocol that was responsible for creating the frame. This can be a
378 hexadecimal number, above
379 .IR 0x0600 ,
380 a name (e.g.
381 .I ARP
382 ) or
383 .BR LENGTH .
384 The protocol field of the Ethernet frame can be used to denote the
385 length of the header (802.2/802.3 networks). When the value of that field is
386 below or equals
387 .IR 0x0600 ,
388 the value equals the size of the header and shouldn't be used as a
389 protocol number. Instead, all frames where the protocol field is used as
390 the length field are assumed to be of the same 'protocol'. The protocol
391 name used in ebtables for these frames is
392 .BR LENGTH .
393 .br
394 The file
395 .B /etc/ethertypes
396 can be used to show readable
397 characters instead of hexadecimal numbers for the protocols. For example,
398 .I 0x0800
399 will be represented by
400 .IR IPV4 .
401 The use of this file is not case sensitive.
402 See that file for more information. The flag
403 .B --proto
404 is an alias for this option.
405 .TP
406 .RB [ ! ] " -i" , " --in-interface " \fIname\fP
407 The interface (bridge port) via which a frame is received (this option is useful in the
408 .BR INPUT ,
409 .BR FORWARD ,
410 .BR PREROUTING " and " BROUTING
411 chains). If the interface name ends with '+', then
412 any interface name that begins with this name (disregarding '+') will match.
413 The flag
414 .B --in-if
415 is an alias for this option.
416 .TP
417 .RB [ ! ] " --logical-in " \fIname\fP
418 The (logical) bridge interface via which a frame is received (this option is useful in the
419 .BR INPUT ,
420 .BR FORWARD ,
421 .BR PREROUTING " and " BROUTING
422 chains).
423 If the interface name ends with '+', then
424 any interface name that begins with this name (disregarding '+') will match.
425 .TP
426 .RB [ ! ] " -o" , " --out-interface " \fIname\fP
427 The interface (bridge port) via which a frame is going to be sent (this option is useful in the
428 .BR OUTPUT ,
429 .B FORWARD
430 and
431 .B POSTROUTING
432 chains). If the interface name ends with '+', then
433 any interface name that begins with this name (disregarding '+') will match.
434 The flag
435 .B --out-if
436 is an alias for this option.
437 .TP
438 .RB [ ! ] " --logical-out " \fIname\fP
439 The (logical) bridge interface via which a frame is going to be sent (this option
440 is useful in the
441 .BR OUTPUT ,
442 .B FORWARD
443 and
444 .B POSTROUTING
445 chains).
446 If the interface name ends with '+', then
447 any interface name that begins with this name (disregarding '+') will match.
448 .TP
449 .RB [ ! ] " -s" , " --source " \fIaddress\fP[ / \fImask\fP]
450 The source MAC address. Both mask and address are written as 6 hexadecimal
451 numbers separated by colons. Alternatively one can specify Unicast,
452 Multicast, Broadcast or BGA (Bridge Group Address):
453 .br
454 .IR "Unicast" "=00:00:00:00:00:00/01:00:00:00:00:00,"
455 .IR "Multicast" "=01:00:00:00:00:00/01:00:00:00:00:00,"
456 .IR "Broadcast" "=ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff or"
457 .IR "BGA" "=01:80:c2:00:00:00/ff:ff:ff:ff:ff:ff."
458 Note that a broadcast
459 address will also match the multicast specification. The flag
460 .B --src
461 is an alias for this option.
462 .TP
463 .RB [ ! ] " -d" , " --destination " \fIaddress\fP[ / \fImask\fP]
464 The destination MAC address. See
465 .B -s
466 (above) for more details on MAC addresses. The flag
467 .B --dst
468 is an alias for this option.
469 .TP
470 .BR "-c, --set-counter " "\fIpcnt bcnt\fP"
471 If used with
472 .BR -A " or " -I ", then the packet and byte counters of the new rule will be set to
473 .IR pcnt ", resp. " bcnt ".
474 If used with the
475 .BR -C " or " -D " commands, only rules with a packet and byte count equal to"
476 .IR pcnt ", resp. " bcnt " will match."
477
478 .SS MATCH EXTENSIONS
479 Ebtables extensions are dynamically loaded into the userspace tool,
480 there is therefore no need to explicitly load them with a
481 -m option like is done in iptables.
482 These extensions deal with functionality supported by kernel modules supplemental to
483 the core ebtables code.
484 .SS 802_3
485 Specify 802.3 DSAP/SSAP fields or SNAP type. The protocol must be specified as
486 .IR "LENGTH " "(see the option " " -p " above).
487 .TP
488 .RB [ ! ] " --802_3-sap " \fIsap\fP
489 DSAP and SSAP are two one byte 802.3 fields. The bytes are always
490 equal, so only one byte (hexadecimal) is needed as an argument.
491 .TP
492 .RB [ ! ] " --802_3-type " \fItype\fP
493 If the 802.3 DSAP and SSAP values are 0xaa then the SNAP type field must
494 be consulted to determine the payload protocol. This is a two byte
495 (hexadecimal) argument. Only 802.3 frames with DSAP/SSAP 0xaa are
496 checked for type.
497 .SS among
498 Match a MAC address or MAC/IP address pair versus a list of MAC addresses
499 and MAC/IP address pairs.
500 A list entry has the following format:
501 .IR xx:xx:xx:xx:xx:xx[=ip.ip.ip.ip][,] ". Multiple"
502 list entries are separated by a comma, specifying an IP address corresponding to
503 the MAC address is optional. Multiple MAC/IP address pairs with the same MAC address
504 but different IP address (and vice versa) can be specified. If the MAC address doesn't
505 match any entry from the list, the frame doesn't match the rule (unless "!" was used).
506 .TP
507 .RB [ ! ] " --among-dst " \fIlist\fP
508 Compare the MAC destination to the given list. If the Ethernet frame has type
509 .IR IPv4 " or " ARP ,
510 then comparison with MAC/IP destination address pairs from the
511 list is possible.
512 .TP
513 .RB [ ! ] " --among-src " \fIlist\fP
514 Compare the MAC source to the given list. If the Ethernet frame has type
515 .IR IPv4 " or " ARP ,
516 then comparison with MAC/IP source address pairs from the list
517 is possible.
518 .TP
519 .RB [ ! ] " --among-dst-file " \fIfile\fP
520 Same as
521 .BR --among-dst " but the list is read in from the specified file."
522 .TP
523 .RB [ ! ] " --among-src-file " \fIfile\fP
524 Same as
525 .BR --among-src " but the list is read in from the specified file."
526 .SS arp
527 Specify (R)ARP fields. The protocol must be specified as
528 .IR ARP " or " RARP .
529 .TP
530 .RB [ ! ] " --arp-opcode " \fIopcode\fP
531 The (R)ARP opcode (decimal or a string, for more details see
532 .BR "ebtables -h arp" ).
533 .TP
534 .RB [ ! ] " --arp-htype " \fIhardware-type\fP
535 The hardware type, this can be a decimal or the string
536 .I Ethernet
537 (which sets
538 .I type
539 to 1). Most (R)ARP packets have Eternet as hardware type.
540 .TP
541 .RB [ ! ] " --arp-ptype " \fIprotocol-type\fP
542 The protocol type for which the (r)arp is used (hexadecimal or the string
543 .IR IPv4 ,
544 denoting 0x0800).
545 Most (R)ARP packets have protocol type IPv4.
546 .TP
547 .RB [ ! ] " --arp-ip-src " \fIaddress\fP[ / \fImask\fP]
548 The (R)ARP IP source address specification.
549 .TP
550 .RB [ ! ] " --arp-ip-dst " \fIaddress\fP[ / \fImask\fP]
551 The (R)ARP IP destination address specification.
552 .TP
553 .RB [ ! ] " --arp-mac-src " \fIaddress\fP[ / \fImask\fP]
554 The (R)ARP MAC source address specification.
555 .TP
556 .RB [ ! ] " --arp-mac-dst " \fIaddress\fP[ / \fImask\fP]
557 The (R)ARP MAC destination address specification.
558 .TP
559 .RB [ ! ] " --arp-gratuitous"
560 Checks for ARP gratuitous packets: checks equality of IPv4 source
561 address and IPv4 destination address inside the ARP header.
562 .SS ip
563 Specify IPv4 fields. The protocol must be specified as
564 .IR IPv4 .
565 .TP
566 .RB [ ! ] " --ip-source " \fIaddress\fP[ / \fImask\fP]
567 The source IP address.
568 The flag
569 .B --ip-src
570 is an alias for this option.
571 .TP
572 .RB [ ! ] " --ip-destination " \fIaddress\fP[ / \fImask\fP]
573 The destination IP address.
574 The flag
575 .B --ip-dst
576 is an alias for this option.
577 .TP
578 .RB [ ! ] " --ip-tos " \fItos\fP
579 The IP type of service, in hexadecimal numbers.
580 .BR IPv4 .
581 .TP
582 .RB [ ! ] " --ip-protocol " \fIprotocol\fP
583 The IP protocol.
584 The flag
585 .B --ip-proto
586 is an alias for this option.
587 .TP
588 .RB [ ! ] " --ip-source-port " \fIport1\fP[ : \fIport2\fP]
589 The source port or port range for the IP protocols 6 (TCP), 17
590 (UDP), 33 (DCCP) or 132 (SCTP). The
591 .B --ip-protocol
592 option must be specified as
593 .IR TCP ", " UDP ", " DCCP " or " SCTP .
594 If
595 .IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
596 The flag
597 .B --ip-sport
598 is an alias for this option.
599 .TP
600 .RB [ ! ] " --ip-destination-port " \fIport1\fP[ : \fIport2\fP]
601 The destination port or port range for ip protocols 6 (TCP), 17
602 (UDP), 33 (DCCP) or 132 (SCTP). The
603 .B --ip-protocol
604 option must be specified as
605 .IR TCP ", " UDP ", " DCCP " or " SCTP .
606 If
607 .IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
608 The flag
609 .B --ip-dport
610 is an alias for this option.
611 .SS ip6
612 Specify IPv6 fields. The protocol must be specified as
613 .IR IPv6 .
614 .TP
615 .RB [ ! ] " --ip6-source " \fIaddress\fP[ / \fImask\fP]
616 The source IPv6 address.
617 The flag
618 .B --ip6-src
619 is an alias for this option.
620 .TP
621 .RB [ ! ] " --ip6-destination " \fIaddress\fP[ / \fImask\fP]
622 The destination IPv6 address.
623 The flag
624 .B --ip6-dst
625 is an alias for this option.
626 .TP
627 .RB [ ! ] " --ip6-tclass " \fItclass\fP
628 The IPv6 traffic class, in hexadecimal numbers.
629 .TP
630 .RB [ ! ] " --ip6-protocol " \fIprotocol\fP
631 The IP protocol.
632 The flag
633 .B --ip6-proto
634 is an alias for this option.
635 .TP
636 .RB [ ! ] " --ip6-source-port " \fIport1\fP[ : \fIport2\fP]
637 The source port or port range for the IPv6 protocols 6 (TCP), 17
638 (UDP), 33 (DCCP) or 132 (SCTP). The
639 .B --ip6-protocol
640 option must be specified as
641 .IR TCP ", " UDP ", " DCCP " or " SCTP .
642 If
643 .IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
644 The flag
645 .B --ip6-sport
646 is an alias for this option.
647 .TP
648 .RB [ ! ] " --ip6-destination-port " \fIport1\fP[ : \fIport2\fP]
649 The destination port or port range for IPv6 protocols 6 (TCP), 17
650 (UDP), 33 (DCCP) or 132 (SCTP). The
651 .B --ip6-protocol
652 option must be specified as
653 .IR TCP ", " UDP ", " DCCP " or " SCTP .
654 If
655 .IR port1 " is omitted, " 0:port2 " is used; if " port2 " is omitted but a colon is specified, " port1:65535 " is used."
656 The flag
657 .B --ip6-dport
658 is an alias for this option.
659 .TP
660 .RB [ ! ] " --ip6-icmp-type " {\fItype\fP[ : \fItype\fP] / \fIcode\fP[ : \fIcode\fP]|\fItypename\fP}
661 Specify ipv6\-icmp type and code to match.
662 Ranges for both type and code are supported. Type and code are
663 separated by a slash. Valid numbers for type and range are 0 to 255.
664 To match a single type including all valid codes, symbolic names can
665 be used instead of numbers. The list of known type names is shown by the command
666 .nf
667 ebtables \-\-help ip6
668 .fi
669 This option is only valid for \-\-ip6-prococol ipv6-icmp.
670 .SS limit
671 This module matches at a limited rate using a token bucket filter.
672 A rule using this extension will match until this limit is reached.
673 It can be used with the
674 .B --log
675 watcher to give limited logging, for example. Its use is the same
676 as the limit match of iptables.
677 .TP
678 .BR "--limit " "[\fIvalue\fP]"
679 Maximum average matching rate: specified as a number, with an optional
680 .IR /second ", " /minute ", " /hour ", or " /day " suffix; the default is " 3/hour .
681 .TP
682 .BR "--limit-burst " "[\fInumber\fP]"
683 Maximum initial number of packets to match: this number gets recharged by
684 one every time the limit specified above is not reached, up to this
685 number; the default is
686 .IR 5 .
687 .SS mark_m
688 .TP
689 .RB [ ! ] " --mark " [\fIvalue\fP][ / \fImask\fP]
690 Matches frames with the given unsigned mark value. If a
691 .IR value " and " mask " are specified, the logical AND of the mark value of the frame and"
692 the user-specified
693 .IR mask " is taken before comparing it with the"
694 user-specified mark
695 .IR value ". When only a mark "
696 .IR value " is specified, the packet"
697 only matches when the mark value of the frame equals the user-specified
698 mark
699 .IR value .
700 If only a
701 .IR mask " is specified, the logical"
702 AND of the mark value of the frame and the user-specified
703 .IR mask " is taken and the frame matches when the result of this logical AND is"
704 non-zero. Only specifying a
705 .IR mask " is useful to match multiple mark values."
706 .SS pkttype
707 .TP
708 .RB [ ! ] " --pkttype-type " \fItype\fP
709 Matches on the Ethernet "class" of the frame, which is determined by the
710 generic networking code. Possible values:
711 .IR broadcast " (MAC destination is the broadcast address),"
712 .IR multicast " (MAC destination is a multicast address),"
713 .IR host " (MAC destination is the receiving network device), or "
714 .IR otherhost " (none of the above)."
715 .SS stp
716 Specify stp BPDU (bridge protocol data unit) fields. The destination
717 address
718 .BR "" ( -d ") must be specified as the bridge group address"
719 .IR "" ( BGA ).
720 For all options for which a range of values can be specified, it holds that
721 if the lower bound is omitted (but the colon is not), then the lowest possible lower bound
722 for that option is used, while if the upper bound is omitted (but the colon again is not), the
723 highest possible upper bound for that option is used.
724 .TP
725 .RB [ ! ] " --stp-type " \fItype\fP
726 The BPDU type (0\(en255), recognized non-numerical types are
727 .IR config ", denoting a configuration BPDU (=0), and"
728 .IR tcn ", denothing a topology change notification BPDU (=128)."
729 .TP
730 .RB [ ! ] " --stp-flags " \fIflag\fP
731 The BPDU flag (0\(en255), recognized non-numerical flags are
732 .IR topology-change ", denoting the topology change flag (=1), and"
733 .IR topology-change-ack ", denoting the topology change acknowledgement flag (=128)."
734 .TP
735 .RB [ ! ] " --stp-root-prio " [\fIprio\fP][ : \fIprio\fP]
736 The root priority (0\(en65535) range.
737 .TP
738 .RB [ ! ] " --stp-root-addr " [\fIaddress\fP][ / \fImask\fP]
739 The root mac address, see the option
740 .BR -s " for more details."
741 .TP
742 .RB [ ! ] " --stp-root-cost " [\fIcost\fP][ : \fIcost\fP]
743 The root path cost (0\(en4294967295) range.
744 .TP
745 .RB [ ! ] " --stp-sender-prio " [\fIprio\fP][ : \fIprio\fP]
746 The BPDU's sender priority (0\(en65535) range.
747 .TP
748 .RB [ ! ] " --stp-sender-addr " [\fIaddress\fP][ / \fImask\fP]
749 The BPDU's sender mac address, see the option
750 .BR -s " for more details."
751 .TP
752 .RB [ ! ] " --stp-port " [\fIport\fP][ : \fIport\fP]
753 The port identifier (0\(en65535) range.
754 .TP
755 .RB [ ! ] " --stp-msg-age " [\fIage\fP][ : \fIage\fP]
756 The message age timer (0\(en65535) range.
757 .TP
758 .RB [ ! ] " --stp-max-age " [\fIage\fP][ : \fIage\fP]
759 The max age timer (0\(en65535) range.
760 .TP
761 .RB [ ! ] " --stp-hello-time " [\fItime\fP][ : \fItime\fP]
762 The hello time timer (0\(en65535) range.
763 .TP
764 .RB [ ! ] " --stp-forward-delay " [\fIdelay\fP][ : \fIdelay\fP]
765 The forward delay timer (0\(en65535) range.
766 .\" .SS string
767 .\" This module matches on a given string using some pattern matching strategy.
768 .\" .TP
769 .\" .BR "--string-algo " "\fIalgorithm\fP"
770 .\" The pattern matching strategy. (bm = Boyer-Moore, kmp = Knuth-Pratt-Morris)
771 .\" .TP
772 .\" .BR "--string-from " "\fIoffset\fP"
773 .\" The lowest offset from which a match can start. (default: 0)
774 .\" .TP
775 .\" .BR "--string-to " "\fIoffset\fP"
776 .\" The highest offset from which a match can start. (default: size of frame)
777 .\" .TP
778 .\" .RB [ ! ] " --string " \fIpattern\fP
779 .\" Matches the given pattern.
780 .\" .TP
781 .\" .RB [ ! ] " --string-hex " \fIpattern\fP
782 .\" Matches the given pattern in hex notation, e.g. '|0D 0A|', '|0D0A|', 'www|09|netfilter|03|org|00|'
783 .\" .TP
784 .\" .BR "--string-icase"
785 .\" Ignore case when searching.
786 .SS vlan
787 Specify 802.1Q Tag Control Information fields.
788 The protocol must be specified as
789 .IR 802_1Q " (0x8100)."
790 .TP
791 .RB [ ! ] " --vlan-id " \fIid\fP
792 The VLAN identifier field (VID). Decimal number from 0 to 4095.
793 .TP
794 .RB [ ! ] " --vlan-prio " \fIprio\fP
795 The user priority field, a decimal number from 0 to 7.
796 The VID should be set to 0 ("null VID") or unspecified
797 (in the latter case the VID is deliberately set to 0).
798 .TP
799 .RB [ ! ] " --vlan-encap " \fItype\fP
800 The encapsulated Ethernet frame type/length.
801 Specified as a hexadecimal
802 number from 0x0000 to 0xFFFF or as a symbolic name
803 from
804 .BR /etc/ethertypes .
805
806 .SS WATCHER EXTENSIONS
807 Watchers only look at frames passing by, they don't modify them nor decide
808 to accept the frames or not. These watchers only
809 see the frame if the frame matches the rule, and they see it before the
810 target is executed.
811 .SS log
812 The log watcher writes descriptive data about a frame to the syslog.
813 .TP
814 .B "--log"
815 .br
816 Log with the default logging options: log-level=
817 .IR info ,
818 log-prefix="", no ip logging, no arp logging.
819 .TP
820 .B --log-level "\fIlevel\fP"
821 .br
822 Defines the logging level. For the possible values, see
823 .BR "ebtables -h log" .
824 The default level is
825 .IR info .
826 .TP
827 .BR --log-prefix " \fItext\fP"
828 .br
829 Defines the prefix
830 .I text
831 to be printed at the beginning of the line with the logging information.
832 .TP
833 .B --log-ip
834 .br
835 Will log the ip information when a frame made by the ip protocol matches
836 the rule. The default is no ip information logging.
837 .TP
838 .B --log-ip6
839 .br
840 Will log the ipv6 information when a frame made by the ipv6 protocol matches
841 the rule. The default is no ipv6 information logging.
842 .TP
843 .B --log-arp
844 .br
845 Will log the (r)arp information when a frame made by the (r)arp protocols
846 matches the rule. The default is no (r)arp information logging.
847 .SS nflog
848 The nflog watcher passes the packet to the loaded logging backend
849 in order to log the packet. This is usually used in combination with
850 nfnetlink_log as logging backend, which will multicast the packet
851 through a
852 .IR netlink
853 socket to the specified multicast group. One or more userspace processes
854 may subscribe to the group to receive the packets.
855 .TP
856 .B "--nflog"
857 .br
858 Log with the default logging options
859 .TP
860 .B --nflog-group "\fInlgroup\fP"
861 .br
862 The netlink group (1\(en2\(ha32\-1) to which packets are (only applicable for
863 nfnetlink_log). The default value is 1.
864 .TP
865 .B --nflog-prefix "\fIprefix\fP"
866 .br
867 A prefix string to include in the log message, up to 30 characters
868 long, useful for distinguishing messages in the logs.
869 .TP
870 .B --nflog-range "\fIsize\fP"
871 .br
872 The number of bytes to be copied to userspace (only applicable for
873 nfnetlink_log). nfnetlink_log instances may specify their own
874 range, this option overrides it.
875 .TP
876 .B --nflog-threshold "\fIsize\fP"
877 .br
878 Number of packets to queue inside the kernel before sending them
879 to userspace (only applicable for nfnetlink_log). Higher values
880 result in less overhead per packet, but increase delay until the
881 packets reach userspace. The default value is 1.
882 .SS ulog
883 The ulog watcher passes the packet to a userspace
884 logging daemon using netlink multicast sockets. This differs
885 from the log watcher in the sense that the complete packet is
886 sent to userspace instead of a descriptive text and that
887 netlink multicast sockets are used instead of the syslog.
888 This watcher enables parsing of packets with userspace programs, the
889 physical bridge in and out ports are also included in the netlink messages.
890 The ulog watcher module accepts 2 parameters when the module is loaded
891 into the kernel (e.g. with modprobe):
892 .B nlbufsiz
893 specifies how big the buffer for each netlink multicast
894 group is. If you say
895 .IR nlbufsiz=8192 ,
896 for example, up to eight kB of packets will
897 get accumulated in the kernel until they are sent to userspace. It is
898 not possible to allocate more than 128kB. Please also keep in mind that
899 this buffer size is allocated for each nlgroup you are using, so the
900 total kernel memory usage increases by that factor. The default is 4096.
901 .B flushtimeout
902 specifies after how many hundredths of a second the queue should be
903 flushed, even if it is not full yet. The default is 10 (one tenth of
904 a second).
905 .TP
906 .B "--ulog"
907 .br
908 Use the default settings: ulog-prefix="", ulog-nlgroup=1,
909 ulog-cprange=4096, ulog-qthreshold=1.
910 .TP
911 .B --ulog-prefix "\fItext\fP"
912 .br
913 Defines the prefix included with the packets sent to userspace.
914 .TP
915 .BR --ulog-nlgroup " \fIgroup\fP"
916 .br
917 Defines which netlink group number to use (a number from 1 to 32).
918 Make sure the netlink group numbers used for the iptables ULOG
919 target differ from those used for the ebtables ulog watcher.
920 The default group number is 1.
921 .TP
922 .BR --ulog-cprange " \fIrange\fP"
923 .br
924 Defines the maximum copy range to userspace, for packets matching the
925 rule. The default range is 0, which means the maximum copy range is
926 given by
927 .BR nlbufsiz .
928 A maximum copy range larger than
929 128*1024 is meaningless as the packets sent to userspace have an upper
930 size limit of 128*1024.
931 .TP
932 .BR --ulog-qthreshold " \fIthreshold\fP"
933 .br
934 Queue at most
935 .I threshold
936 number of packets before sending them to
937 userspace with a netlink socket. Note that packets can be sent to
938 userspace before the queue is full, this happens when the ulog
939 kernel timer goes off (the frequency of this timer depends on
940 .BR flushtimeout ).
941 .SS TARGET EXTENSIONS
942 .SS arpreply
943 The
944 .B arpreply
945 target can be used in the
946 .BR PREROUTING " chain of the " nat " table."
947 If this target sees an ARP request it will automatically reply
948 with an ARP reply. The used MAC address for the reply can be specified.
949 The protocol must be specified as
950 .IR ARP .
951 When the ARP message is not an ARP request or when the ARP request isn't
952 for an IP address on an Ethernet network, it is ignored by this target
953 .BR "" ( CONTINUE ).
954 When the ARP request is malformed, it is dropped
955 .BR "" ( DROP ).
956 .TP
957 .BR "--arpreply-mac " "\fIaddress\fP"
958 Specifies the MAC address to reply with: the Ethernet source MAC and the
959 ARP payload source MAC will be filled in with this address.
960 .TP
961 .BR "--arpreply-target " "\fItarget\fP"
962 Specifies the standard target. After sending the ARP reply, the rule still
963 has to give a standard target so ebtables knows what to do with the ARP request.
964 The default target
965 .BR "" "is " DROP .
966 .SS dnat
967 The
968 .B dnat
969 target can only be used in the
970 .BR PREROUTING " and " OUTPUT " chains of the " nat " table."
971 It specifies that the destination MAC address has to be changed.
972 .TP
973 .BR "--to-destination " "\fIaddress\fP"
974 .br
975 Change the destination MAC address to the specified
976 .IR address .
977 The flag
978 .B --to-dst
979 is an alias for this option.
980 .TP
981 .BR "--dnat-target " "\fItarget\fP"
982 .br
983 Specifies the standard target. After doing the dnat, the rule still has to
984 give a standard target so ebtables knows what to do with the dnated frame.
985 The default target is
986 .BR ACCEPT .
987 Making it
988 .BR CONTINUE " could let you use"
989 multiple target extensions on the same frame. Making it
990 .BR DROP " only makes"
991 sense in the
992 .BR BROUTING " chain but using the " redirect " target is more logical there. " RETURN " is also allowed. Note that using " RETURN
993 in a base chain is not allowed (for obvious reasons).
994 .SS mark
995 .BR "" "The " mark " target can be used in every chain of every table. It is possible"
996 to use the marking of a frame/packet in both ebtables and iptables,
997 if the bridge-nf code is compiled into the kernel. Both put the marking at the
998 same place. This allows for a form of communication between ebtables and iptables.
999 .TP
1000 .BR "--mark-set " "\fIvalue\fP"
1001 .br
1002 Mark the frame with the specified non-negative
1003 .IR value .
1004 .TP
1005 .BR "--mark-or " "\fIvalue\fP"
1006 .br
1007 Or the frame with the specified non-negative
1008 .IR value .
1009 .TP
1010 .BR "--mark-and " "\fIvalue\fP"
1011 .br
1012 And the frame with the specified non-negative
1013 .IR value .
1014 .TP
1015 .BR "--mark-xor " "\fIvalue\fP"
1016 .br
1017 Xor the frame with the specified non-negative
1018 .IR value .
1019 .TP
1020 .BR "--mark-target " "\fItarget\fP"
1021 .br
1022 Specifies the standard target. After marking the frame, the rule
1023 still has to give a standard target so ebtables knows what to do.
1024 The default target is
1025 .BR ACCEPT ". Making it " CONTINUE " can let you do other"
1026 things with the frame in subsequent rules of the chain.
1027 .SS redirect
1028 The
1029 .B redirect
1030 target will change the MAC target address to that of the bridge device the
1031 frame arrived on. This target can only be used in the
1032 .BR PREROUTING " chain of the " nat " table."
1033 The MAC address of the bridge is used as destination address."
1034 .TP
1035 .BR "--redirect-target " "\fItarget\fP"
1036 .br
1037 Specifies the standard target. After doing the MAC redirect, the rule
1038 still has to give a standard target so ebtables knows what to do.
1039 The default target is
1040 .BR ACCEPT ". Making it " CONTINUE " could let you use"
1041 multiple target extensions on the same frame. Making it
1042 .BR DROP " in the " BROUTING " chain will let the frames be routed. " RETURN " is also allowed. Note"
1043 .BR "" "that using " RETURN " in a base chain is not allowed."
1044 .SS snat
1045 The
1046 .B snat
1047 target can only be used in the
1048 .BR POSTROUTING " chain of the " nat " table."
1049 It specifies that the source MAC address has to be changed.
1050 .TP
1051 .BR "--to-source " "\fIaddress\fP"
1052 .br
1053 Changes the source MAC address to the specified
1054 .IR address ". The flag"
1055 .B --to-src
1056 is an alias for this option.
1057 .TP
1058 .BR "--snat-target " "\fItarget\fP"
1059 .br
1060 Specifies the standard target. After doing the snat, the rule still has
1061 to give a standard target so ebtables knows what to do.
1062 .BR "" "The default target is " ACCEPT ". Making it " CONTINUE " could let you use"
1063 .BR "" "multiple target extensions on the same frame. Making it " DROP " doesn't"
1064 .BR "" "make sense, but you could do that too. " RETURN " is also allowed. Note"
1065 .BR "" "that using " RETURN " in a base chain is not allowed."
1066 .br
1067 .TP
1068 .BR "--snat-arp "
1069 .br
1070 Also change the hardware source address inside the arp header if the packet is an
1071 arp message and the hardware address length in the arp header is 6 bytes.
1072 .br
1073 .SH FILES
1074 .I /etc/ethertypes
1075 .SH MAILINGLISTS
1076 .BR "" "See " http://netfilter.org/mailinglists.html
1077 .SH BUGS
1078 The version of ebtables this man page ships with does not support the
1079 .B string
1080 match. Further, support for atomic-options
1081 .RB ( --atomic-file ", " --atomic-init ", " --atomic-save ", " --atomic-commit )
1082 has not been implemented, although
1083 .BR ebtables-save " and " ebtables-restore
1084 might replace them entirely given the inherent atomicity of nftables.
1085 Finally, this list is probably not complete.
1086 .SH SEE ALSO
1087 .BR xtables-nft "(8), " iptables "(8), " ip (8)
1088 .PP
1089 .BR "" "See " https://wiki.nftables.org