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