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