Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2 | Linux Ethernet Bonding Driver HOWTO |
| 3 | |
Jiri Pirko | a549952 | 2009-09-25 03:28:09 +0000 | [diff] [blame] | 4 | Latest update: 23 September 2009 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
| 6 | Initial release : Thomas Davis <tadavis at lbl.gov> |
| 7 | Corrections, HA extensions : 2000/10/03-15 : |
| 8 | - Willy Tarreau <willy at meta-x.org> |
| 9 | - Constantine Gavrilov <const-g at xpert.com> |
| 10 | - Chad N. Tindel <ctindel at ieee dot org> |
| 11 | - Janice Girouard <girouard at us dot ibm dot com> |
| 12 | - Jay Vosburgh <fubar at us dot ibm dot com> |
| 13 | |
| 14 | Reorganized and updated Feb 2005 by Jay Vosburgh |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 15 | Added Sysfs information: 2006/04/24 |
| 16 | - Mitch Williams <mitch.a.williams at intel.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 18 | Introduction |
| 19 | ============ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 21 | The Linux bonding driver provides a method for aggregating |
| 22 | multiple network interfaces into a single logical "bonded" interface. |
| 23 | The behavior of the bonded interfaces depends upon the mode; generally |
| 24 | speaking, modes provide either hot standby or load balancing services. |
| 25 | Additionally, link integrity monitoring may be performed. |
| 26 | |
| 27 | The bonding driver originally came from Donald Becker's |
| 28 | beowulf patches for kernel 2.0. It has changed quite a bit since, and |
| 29 | the original tools from extreme-linux and beowulf sites will not work |
| 30 | with this version of the driver. |
| 31 | |
| 32 | For new versions of the driver, updated userspace tools, and |
| 33 | who to ask for help, please follow the links at the end of this file. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | Table of Contents |
| 36 | ================= |
| 37 | |
| 38 | 1. Bonding Driver Installation |
| 39 | |
| 40 | 2. Bonding Driver Options |
| 41 | |
| 42 | 3. Configuring Bonding Devices |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 43 | 3.1 Configuration with Sysconfig Support |
| 44 | 3.1.1 Using DHCP with Sysconfig |
| 45 | 3.1.2 Configuring Multiple Bonds with Sysconfig |
| 46 | 3.2 Configuration with Initscripts Support |
| 47 | 3.2.1 Using DHCP with Initscripts |
| 48 | 3.2.2 Configuring Multiple Bonds with Initscripts |
| 49 | 3.3 Configuring Bonding Manually with Ifenslave |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 50 | 3.3.1 Configuring Multiple Bonds Manually |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 51 | 3.4 Configuring Bonding Manually via Sysfs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 53 | 4. Querying Bonding Configuration |
| 54 | 4.1 Bonding Configuration |
| 55 | 4.2 Network Configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 57 | 5. Switch Configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 59 | 6. 802.1q VLAN Support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 61 | 7. Link Monitoring |
| 62 | 7.1 ARP Monitor Operation |
| 63 | 7.2 Configuring Multiple ARP Targets |
| 64 | 7.3 MII Monitor Operation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 66 | 8. Potential Trouble Sources |
| 67 | 8.1 Adventures in Routing |
| 68 | 8.2 Ethernet Device Renaming |
| 69 | 8.3 Painfully Slow Or No Failed Link Detection By Miimon |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 71 | 9. SNMP agents |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 73 | 10. Promiscuous mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 75 | 11. Configuring Bonding for High Availability |
| 76 | 11.1 High Availability in a Single Switch Topology |
| 77 | 11.2 High Availability in a Multiple Switch Topology |
| 78 | 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology |
| 79 | 11.2.2 HA Link Monitoring for Multiple Switch Topology |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 81 | 12. Configuring Bonding for Maximum Throughput |
| 82 | 12.1 Maximum Throughput in a Single Switch Topology |
| 83 | 12.1.1 MT Bonding Mode Selection for Single Switch Topology |
| 84 | 12.1.2 MT Link Monitoring for Single Switch Topology |
| 85 | 12.2 Maximum Throughput in a Multiple Switch Topology |
| 86 | 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology |
| 87 | 12.2.2 MT Link Monitoring for Multiple Switch Topology |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 89 | 13. Switch Behavior Issues |
| 90 | 13.1 Link Establishment and Failover Delays |
| 91 | 13.2 Duplicated Incoming Packets |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 93 | 14. Hardware Specific Considerations |
| 94 | 14.1 IBM BladeCenter |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 95 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 96 | 15. Frequently Asked Questions |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 97 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 98 | 16. Resources and Links |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
| 100 | |
| 101 | 1. Bonding Driver Installation |
| 102 | ============================== |
| 103 | |
| 104 | Most popular distro kernels ship with the bonding driver |
| 105 | already available as a module and the ifenslave user level control |
| 106 | program installed and ready for use. If your distro does not, or you |
| 107 | have need to compile bonding from source (e.g., configuring and |
| 108 | installing a mainline kernel from kernel.org), you'll need to perform |
| 109 | the following steps: |
| 110 | |
| 111 | 1.1 Configure and build the kernel with bonding |
| 112 | ----------------------------------------------- |
| 113 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 114 | The current version of the bonding driver is available in the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | drivers/net/bonding subdirectory of the most recent kernel source |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 116 | (which is available on http://kernel.org). Most users "rolling their |
| 117 | own" will want to use the most recent kernel from kernel.org. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
| 119 | Configure kernel with "make menuconfig" (or "make xconfig" or |
| 120 | "make config"), then select "Bonding driver support" in the "Network |
| 121 | device support" section. It is recommended that you configure the |
| 122 | driver as module since it is currently the only way to pass parameters |
| 123 | to the driver or configure more than one bonding device. |
| 124 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 125 | Build and install the new kernel and modules, then continue |
| 126 | below to install ifenslave. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | 1.2 Install ifenslave Control Utility |
| 129 | ------------------------------------- |
| 130 | |
| 131 | The ifenslave user level control program is included in the |
| 132 | kernel source tree, in the file Documentation/networking/ifenslave.c. |
| 133 | It is generally recommended that you use the ifenslave that |
| 134 | corresponds to the kernel that you are using (either from the same |
| 135 | source tree or supplied with the distro), however, ifenslave |
| 136 | executables from older kernels should function (but features newer |
| 137 | than the ifenslave release are not supported). Running an ifenslave |
| 138 | that is newer than the kernel is not supported, and may or may not |
| 139 | work. |
| 140 | |
| 141 | To install ifenslave, do the following: |
| 142 | |
| 143 | # gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave |
| 144 | # cp ifenslave /sbin/ifenslave |
| 145 | |
| 146 | If your kernel source is not in "/usr/src/linux," then replace |
| 147 | "/usr/src/linux/include" in the above with the location of your kernel |
| 148 | source include directory. |
| 149 | |
| 150 | You may wish to back up any existing /sbin/ifenslave, or, for |
| 151 | testing or informal use, tag the ifenslave to the kernel version |
| 152 | (e.g., name the ifenslave executable /sbin/ifenslave-2.6.10). |
| 153 | |
| 154 | IMPORTANT NOTE: |
| 155 | |
| 156 | If you omit the "-I" or specify an incorrect directory, you |
| 157 | may end up with an ifenslave that is incompatible with the kernel |
| 158 | you're trying to build it for. Some distros (e.g., Red Hat from 7.1 |
| 159 | onwards) do not have /usr/include/linux symbolically linked to the |
| 160 | default kernel source include directory. |
| 161 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 162 | SECOND IMPORTANT NOTE: |
| 163 | If you plan to configure bonding using sysfs, you do not need |
| 164 | to use ifenslave. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | |
| 166 | 2. Bonding Driver Options |
| 167 | ========================= |
| 168 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 169 | Options for the bonding driver are supplied as parameters to the |
| 170 | bonding module at load time, or are specified via sysfs. |
| 171 | |
| 172 | Module options may be given as command line arguments to the |
| 173 | insmod or modprobe command, but are usually specified in either the |
| 174 | /etc/modules.conf or /etc/modprobe.conf configuration file, or in a |
| 175 | distro-specific configuration file (some of which are detailed in the next |
| 176 | section). |
| 177 | |
| 178 | Details on bonding support for sysfs is provided in the |
| 179 | "Configuring Bonding Manually via Sysfs" section, below. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | |
| 181 | The available bonding driver parameters are listed below. If a |
| 182 | parameter is not specified the default value is used. When initially |
| 183 | configuring a bond, it is recommended "tail -f /var/log/messages" be |
| 184 | run in a separate window to watch for bonding driver error messages. |
| 185 | |
| 186 | It is critical that either the miimon or arp_interval and |
| 187 | arp_ip_target parameters be specified, otherwise serious network |
| 188 | degradation will occur during link failures. Very few devices do not |
| 189 | support at least miimon, so there is really no reason not to use it. |
| 190 | |
| 191 | Options with textual values will accept either the text name |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 192 | or, for backwards compatibility, the option value. E.g., |
| 193 | "mode=802.3ad" and "mode=4" set the same mode. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | The parameters are as follows: |
| 196 | |
Jay Vosburgh | fd989c8 | 2008-11-04 17:51:16 -0800 | [diff] [blame] | 197 | ad_select |
| 198 | |
| 199 | Specifies the 802.3ad aggregation selection logic to use. The |
| 200 | possible values and their effects are: |
| 201 | |
| 202 | stable or 0 |
| 203 | |
| 204 | The active aggregator is chosen by largest aggregate |
| 205 | bandwidth. |
| 206 | |
| 207 | Reselection of the active aggregator occurs only when all |
| 208 | slaves of the active aggregator are down or the active |
| 209 | aggregator has no slaves. |
| 210 | |
| 211 | This is the default value. |
| 212 | |
| 213 | bandwidth or 1 |
| 214 | |
| 215 | The active aggregator is chosen by largest aggregate |
| 216 | bandwidth. Reselection occurs if: |
| 217 | |
| 218 | - A slave is added to or removed from the bond |
| 219 | |
| 220 | - Any slave's link state changes |
| 221 | |
| 222 | - Any slave's 802.3ad association state changes |
| 223 | |
Matt LaPlante | 19f5946 | 2009-04-27 15:06:31 +0200 | [diff] [blame] | 224 | - The bond's administrative state changes to up |
Jay Vosburgh | fd989c8 | 2008-11-04 17:51:16 -0800 | [diff] [blame] | 225 | |
| 226 | count or 2 |
| 227 | |
| 228 | The active aggregator is chosen by the largest number of |
| 229 | ports (slaves). Reselection occurs as described under the |
| 230 | "bandwidth" setting, above. |
| 231 | |
| 232 | The bandwidth and count selection policies permit failover of |
| 233 | 802.3ad aggregations when partial failure of the active aggregator |
| 234 | occurs. This keeps the aggregator with the highest availability |
| 235 | (either in bandwidth or in number of ports) active at all times. |
| 236 | |
| 237 | This option was added in bonding version 3.4.0. |
| 238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | arp_interval |
| 240 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 241 | Specifies the ARP link monitoring frequency in milliseconds. |
Jay Vosburgh | f5b2b96 | 2006-09-22 21:54:53 -0700 | [diff] [blame] | 242 | |
| 243 | The ARP monitor works by periodically checking the slave |
| 244 | devices to determine whether they have sent or received |
| 245 | traffic recently (the precise criteria depends upon the |
| 246 | bonding mode, and the state of the slave). Regular traffic is |
| 247 | generated via ARP probes issued for the addresses specified by |
| 248 | the arp_ip_target option. |
| 249 | |
| 250 | This behavior can be modified by the arp_validate option, |
| 251 | below. |
| 252 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 253 | If ARP monitoring is used in an etherchannel compatible mode |
| 254 | (modes 0 and 2), the switch should be configured in a mode |
| 255 | that evenly distributes packets across all links. If the |
| 256 | switch is configured to distribute the packets in an XOR |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | fashion, all replies from the ARP targets will be received on |
| 258 | the same link which could cause the other team members to |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 259 | fail. ARP monitoring should not be used in conjunction with |
| 260 | miimon. A value of 0 disables ARP monitoring. The default |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | value is 0. |
| 262 | |
| 263 | arp_ip_target |
| 264 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 265 | Specifies the IP addresses to use as ARP monitoring peers when |
| 266 | arp_interval is > 0. These are the targets of the ARP request |
| 267 | sent to determine the health of the link to the targets. |
| 268 | Specify these values in ddd.ddd.ddd.ddd format. Multiple IP |
| 269 | addresses must be separated by a comma. At least one IP |
| 270 | address must be given for ARP monitoring to function. The |
| 271 | maximum number of targets that can be specified is 16. The |
| 272 | default value is no IP addresses. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Jay Vosburgh | f5b2b96 | 2006-09-22 21:54:53 -0700 | [diff] [blame] | 274 | arp_validate |
| 275 | |
| 276 | Specifies whether or not ARP probes and replies should be |
| 277 | validated in the active-backup mode. This causes the ARP |
| 278 | monitor to examine the incoming ARP requests and replies, and |
| 279 | only consider a slave to be up if it is receiving the |
| 280 | appropriate ARP traffic. |
| 281 | |
| 282 | Possible values are: |
| 283 | |
| 284 | none or 0 |
| 285 | |
| 286 | No validation is performed. This is the default. |
| 287 | |
| 288 | active or 1 |
| 289 | |
| 290 | Validation is performed only for the active slave. |
| 291 | |
| 292 | backup or 2 |
| 293 | |
| 294 | Validation is performed only for backup slaves. |
| 295 | |
| 296 | all or 3 |
| 297 | |
| 298 | Validation is performed for all slaves. |
| 299 | |
| 300 | For the active slave, the validation checks ARP replies to |
| 301 | confirm that they were generated by an arp_ip_target. Since |
| 302 | backup slaves do not typically receive these replies, the |
| 303 | validation performed for backup slaves is on the ARP request |
| 304 | sent out via the active slave. It is possible that some |
| 305 | switch or network configurations may result in situations |
| 306 | wherein the backup slaves do not receive the ARP requests; in |
| 307 | such a situation, validation of backup slaves must be |
| 308 | disabled. |
| 309 | |
| 310 | This option is useful in network configurations in which |
| 311 | multiple bonding hosts are concurrently issuing ARPs to one or |
| 312 | more targets beyond a common switch. Should the link between |
| 313 | the switch and target fail (but not the switch itself), the |
| 314 | probe traffic generated by the multiple bonding instances will |
| 315 | fool the standard ARP monitor into considering the links as |
| 316 | still up. Use of the arp_validate option can resolve this, as |
| 317 | the ARP monitor will only consider ARP requests and replies |
| 318 | associated with its own instance of bonding. |
| 319 | |
| 320 | This option was added in bonding version 3.1.0. |
| 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | downdelay |
| 323 | |
| 324 | Specifies the time, in milliseconds, to wait before disabling |
| 325 | a slave after a link failure has been detected. This option |
| 326 | is only valid for the miimon link monitor. The downdelay |
| 327 | value should be a multiple of the miimon value; if not, it |
| 328 | will be rounded down to the nearest multiple. The default |
| 329 | value is 0. |
| 330 | |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 331 | fail_over_mac |
| 332 | |
| 333 | Specifies whether active-backup mode should set all slaves to |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 334 | the same MAC address at enslavement (the traditional |
| 335 | behavior), or, when enabled, perform special handling of the |
| 336 | bond's MAC address in accordance with the selected policy. |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 337 | |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 338 | Possible values are: |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 339 | |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 340 | none or 0 |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 341 | |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 342 | This setting disables fail_over_mac, and causes |
| 343 | bonding to set all slaves of an active-backup bond to |
| 344 | the same MAC address at enslavement time. This is the |
| 345 | default. |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 346 | |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 347 | active or 1 |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 348 | |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 349 | The "active" fail_over_mac policy indicates that the |
| 350 | MAC address of the bond should always be the MAC |
| 351 | address of the currently active slave. The MAC |
| 352 | address of the slaves is not changed; instead, the MAC |
| 353 | address of the bond changes during a failover. |
| 354 | |
| 355 | This policy is useful for devices that cannot ever |
| 356 | alter their MAC address, or for devices that refuse |
| 357 | incoming broadcasts with their own source MAC (which |
| 358 | interferes with the ARP monitor). |
| 359 | |
| 360 | The down side of this policy is that every device on |
| 361 | the network must be updated via gratuitous ARP, |
| 362 | vs. just updating a switch or set of switches (which |
| 363 | often takes place for any traffic, not just ARP |
| 364 | traffic, if the switch snoops incoming traffic to |
| 365 | update its tables) for the traditional method. If the |
| 366 | gratuitous ARP is lost, communication may be |
| 367 | disrupted. |
| 368 | |
| 369 | When this policy is used in conjuction with the mii |
| 370 | monitor, devices which assert link up prior to being |
| 371 | able to actually transmit and receive are particularly |
Matt LaPlante | 19f5946 | 2009-04-27 15:06:31 +0200 | [diff] [blame] | 372 | susceptible to loss of the gratuitous ARP, and an |
Jay Vosburgh | 3915c1e | 2008-05-17 21:10:14 -0700 | [diff] [blame] | 373 | appropriate updelay setting may be required. |
| 374 | |
| 375 | follow or 2 |
| 376 | |
| 377 | The "follow" fail_over_mac policy causes the MAC |
| 378 | address of the bond to be selected normally (normally |
| 379 | the MAC address of the first slave added to the bond). |
| 380 | However, the second and subsequent slaves are not set |
| 381 | to this MAC address while they are in a backup role; a |
| 382 | slave is programmed with the bond's MAC address at |
| 383 | failover time (and the formerly active slave receives |
| 384 | the newly active slave's MAC address). |
| 385 | |
| 386 | This policy is useful for multiport devices that |
| 387 | either become confused or incur a performance penalty |
| 388 | when multiple ports are programmed with the same MAC |
| 389 | address. |
| 390 | |
| 391 | |
| 392 | The default policy is none, unless the first slave cannot |
| 393 | change its MAC address, in which case the active policy is |
| 394 | selected by default. |
| 395 | |
| 396 | This option may be modified via sysfs only when no slaves are |
| 397 | present in the bond. |
| 398 | |
| 399 | This option was added in bonding version 3.2.0. The "follow" |
| 400 | policy was added in bonding version 3.3.0. |
Jay Vosburgh | dd957c5 | 2007-10-09 19:57:24 -0700 | [diff] [blame] | 401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | lacp_rate |
| 403 | |
| 404 | Option specifying the rate in which we'll ask our link partner |
| 405 | to transmit LACPDU packets in 802.3ad mode. Possible values |
| 406 | are: |
| 407 | |
| 408 | slow or 0 |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 409 | Request partner to transmit LACPDUs every 30 seconds |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
| 411 | fast or 1 |
| 412 | Request partner to transmit LACPDUs every 1 second |
| 413 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 414 | The default is slow. |
| 415 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | max_bonds |
| 417 | |
| 418 | Specifies the number of bonding devices to create for this |
| 419 | instance of the bonding driver. E.g., if max_bonds is 3, and |
| 420 | the bonding driver is not already loaded, then bond0, bond1 |
Jay Vosburgh | b8a9787 | 2008-06-13 18:12:04 -0700 | [diff] [blame] | 421 | and bond2 will be created. The default value is 1. Specifying |
| 422 | a value of 0 will load bonding, but will not create any devices. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | |
| 424 | miimon |
| 425 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 426 | Specifies the MII link monitoring frequency in milliseconds. |
| 427 | This determines how often the link state of each slave is |
| 428 | inspected for link failures. A value of zero disables MII |
| 429 | link monitoring. A value of 100 is a good starting point. |
| 430 | The use_carrier option, below, affects how the link state is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | determined. See the High Availability section for additional |
| 432 | information. The default value is 0. |
| 433 | |
| 434 | mode |
| 435 | |
| 436 | Specifies one of the bonding policies. The default is |
| 437 | balance-rr (round robin). Possible values are: |
| 438 | |
| 439 | balance-rr or 0 |
| 440 | |
| 441 | Round-robin policy: Transmit packets in sequential |
| 442 | order from the first available slave through the |
| 443 | last. This mode provides load balancing and fault |
| 444 | tolerance. |
| 445 | |
| 446 | active-backup or 1 |
| 447 | |
| 448 | Active-backup policy: Only one slave in the bond is |
| 449 | active. A different slave becomes active if, and only |
| 450 | if, the active slave fails. The bond's MAC address is |
| 451 | externally visible on only one port (network adapter) |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 452 | to avoid confusing the switch. |
| 453 | |
| 454 | In bonding version 2.6.2 or later, when a failover |
| 455 | occurs in active-backup mode, bonding will issue one |
| 456 | or more gratuitous ARPs on the newly active slave. |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 457 | One gratuitous ARP is issued for the bonding master |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 458 | interface and each VLAN interfaces configured above |
| 459 | it, provided that the interface has at least one IP |
| 460 | address configured. Gratuitous ARPs issued for VLAN |
| 461 | interfaces are tagged with the appropriate VLAN id. |
| 462 | |
| 463 | This mode provides fault tolerance. The primary |
| 464 | option, documented below, affects the behavior of this |
| 465 | mode. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | |
| 467 | balance-xor or 2 |
| 468 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 469 | XOR policy: Transmit based on the selected transmit |
| 470 | hash policy. The default policy is a simple [(source |
| 471 | MAC address XOR'd with destination MAC address) modulo |
| 472 | slave count]. Alternate transmit policies may be |
| 473 | selected via the xmit_hash_policy option, described |
| 474 | below. |
| 475 | |
| 476 | This mode provides load balancing and fault tolerance. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | |
| 478 | broadcast or 3 |
| 479 | |
| 480 | Broadcast policy: transmits everything on all slave |
| 481 | interfaces. This mode provides fault tolerance. |
| 482 | |
| 483 | 802.3ad or 4 |
| 484 | |
| 485 | IEEE 802.3ad Dynamic link aggregation. Creates |
| 486 | aggregation groups that share the same speed and |
| 487 | duplex settings. Utilizes all slaves in the active |
| 488 | aggregator according to the 802.3ad specification. |
| 489 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 490 | Slave selection for outgoing traffic is done according |
| 491 | to the transmit hash policy, which may be changed from |
| 492 | the default simple XOR policy via the xmit_hash_policy |
| 493 | option, documented below. Note that not all transmit |
| 494 | policies may be 802.3ad compliant, particularly in |
| 495 | regards to the packet mis-ordering requirements of |
| 496 | section 43.2.4 of the 802.3ad standard. Differing |
| 497 | peer implementations will have varying tolerances for |
| 498 | noncompliance. |
| 499 | |
| 500 | Prerequisites: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | |
| 502 | 1. Ethtool support in the base drivers for retrieving |
| 503 | the speed and duplex of each slave. |
| 504 | |
| 505 | 2. A switch that supports IEEE 802.3ad Dynamic link |
| 506 | aggregation. |
| 507 | |
| 508 | Most switches will require some type of configuration |
| 509 | to enable 802.3ad mode. |
| 510 | |
| 511 | balance-tlb or 5 |
| 512 | |
| 513 | Adaptive transmit load balancing: channel bonding that |
| 514 | does not require any special switch support. The |
| 515 | outgoing traffic is distributed according to the |
| 516 | current load (computed relative to the speed) on each |
| 517 | slave. Incoming traffic is received by the current |
| 518 | slave. If the receiving slave fails, another slave |
| 519 | takes over the MAC address of the failed receiving |
| 520 | slave. |
| 521 | |
| 522 | Prerequisite: |
| 523 | |
| 524 | Ethtool support in the base drivers for retrieving the |
| 525 | speed of each slave. |
| 526 | |
| 527 | balance-alb or 6 |
| 528 | |
| 529 | Adaptive load balancing: includes balance-tlb plus |
| 530 | receive load balancing (rlb) for IPV4 traffic, and |
| 531 | does not require any special switch support. The |
| 532 | receive load balancing is achieved by ARP negotiation. |
| 533 | The bonding driver intercepts the ARP Replies sent by |
| 534 | the local system on their way out and overwrites the |
| 535 | source hardware address with the unique hardware |
| 536 | address of one of the slaves in the bond such that |
| 537 | different peers use different hardware addresses for |
| 538 | the server. |
| 539 | |
| 540 | Receive traffic from connections created by the server |
| 541 | is also balanced. When the local system sends an ARP |
| 542 | Request the bonding driver copies and saves the peer's |
| 543 | IP information from the ARP packet. When the ARP |
| 544 | Reply arrives from the peer, its hardware address is |
| 545 | retrieved and the bonding driver initiates an ARP |
| 546 | reply to this peer assigning it to one of the slaves |
| 547 | in the bond. A problematic outcome of using ARP |
| 548 | negotiation for balancing is that each time that an |
| 549 | ARP request is broadcast it uses the hardware address |
| 550 | of the bond. Hence, peers learn the hardware address |
| 551 | of the bond and the balancing of receive traffic |
| 552 | collapses to the current slave. This is handled by |
| 553 | sending updates (ARP Replies) to all the peers with |
| 554 | their individually assigned hardware address such that |
| 555 | the traffic is redistributed. Receive traffic is also |
| 556 | redistributed when a new slave is added to the bond |
| 557 | and when an inactive slave is re-activated. The |
| 558 | receive load is distributed sequentially (round robin) |
| 559 | among the group of highest speed slaves in the bond. |
| 560 | |
| 561 | When a link is reconnected or a new slave joins the |
| 562 | bond the receive traffic is redistributed among all |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 563 | active slaves in the bond by initiating ARP Replies |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 564 | with the selected MAC address to each of the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 565 | clients. The updelay parameter (detailed below) must |
| 566 | be set to a value equal or greater than the switch's |
| 567 | forwarding delay so that the ARP Replies sent to the |
| 568 | peers will not be blocked by the switch. |
| 569 | |
| 570 | Prerequisites: |
| 571 | |
| 572 | 1. Ethtool support in the base drivers for retrieving |
| 573 | the speed of each slave. |
| 574 | |
| 575 | 2. Base driver support for setting the hardware |
| 576 | address of a device while it is open. This is |
| 577 | required so that there will always be one slave in the |
| 578 | team using the bond hardware address (the |
| 579 | curr_active_slave) while having a unique hardware |
| 580 | address for each slave in the bond. If the |
| 581 | curr_active_slave fails its hardware address is |
| 582 | swapped with the new curr_active_slave that was |
| 583 | chosen. |
| 584 | |
Jay Vosburgh | b59f9f7 | 2008-06-13 18:12:03 -0700 | [diff] [blame] | 585 | num_grat_arp |
| 586 | |
| 587 | Specifies the number of gratuitous ARPs to be issued after a |
| 588 | failover event. One gratuitous ARP is issued immediately after |
| 589 | the failover, subsequent ARPs are sent at a rate of one per link |
| 590 | monitor interval (arp_interval or miimon, whichever is active). |
| 591 | |
| 592 | The valid range is 0 - 255; the default value is 1. This option |
| 593 | affects only the active-backup mode. This option was added for |
| 594 | bonding version 3.3.0. |
| 595 | |
Brian Haley | 305d552 | 2008-11-04 17:51:14 -0800 | [diff] [blame] | 596 | num_unsol_na |
| 597 | |
| 598 | Specifies the number of unsolicited IPv6 Neighbor Advertisements |
| 599 | to be issued after a failover event. One unsolicited NA is issued |
| 600 | immediately after the failover. |
| 601 | |
| 602 | The valid range is 0 - 255; the default value is 1. This option |
| 603 | affects only the active-backup mode. This option was added for |
| 604 | bonding version 3.4.0. |
| 605 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | primary |
| 607 | |
| 608 | A string (eth0, eth2, etc) specifying which slave is the |
| 609 | primary device. The specified device will always be the |
| 610 | active slave while it is available. Only when the primary is |
| 611 | off-line will alternate devices be used. This is useful when |
| 612 | one slave is preferred over another, e.g., when one slave has |
| 613 | higher throughput than another. |
| 614 | |
| 615 | The primary option is only valid for active-backup mode. |
| 616 | |
Jiri Pirko | a549952 | 2009-09-25 03:28:09 +0000 | [diff] [blame] | 617 | primary_reselect |
| 618 | |
| 619 | Specifies the reselection policy for the primary slave. This |
| 620 | affects how the primary slave is chosen to become the active slave |
| 621 | when failure of the active slave or recovery of the primary slave |
| 622 | occurs. This option is designed to prevent flip-flopping between |
| 623 | the primary slave and other slaves. Possible values are: |
| 624 | |
| 625 | always or 0 (default) |
| 626 | |
| 627 | The primary slave becomes the active slave whenever it |
| 628 | comes back up. |
| 629 | |
| 630 | better or 1 |
| 631 | |
| 632 | The primary slave becomes the active slave when it comes |
| 633 | back up, if the speed and duplex of the primary slave is |
| 634 | better than the speed and duplex of the current active |
| 635 | slave. |
| 636 | |
| 637 | failure or 2 |
| 638 | |
| 639 | The primary slave becomes the active slave only if the |
| 640 | current active slave fails and the primary slave is up. |
| 641 | |
| 642 | The primary_reselect setting is ignored in two cases: |
| 643 | |
| 644 | If no slaves are active, the first slave to recover is |
| 645 | made the active slave. |
| 646 | |
| 647 | When initially enslaved, the primary slave is always made |
| 648 | the active slave. |
| 649 | |
| 650 | Changing the primary_reselect policy via sysfs will cause an |
| 651 | immediate selection of the best active slave according to the new |
| 652 | policy. This may or may not result in a change of the active |
| 653 | slave, depending upon the circumstances. |
| 654 | |
| 655 | This option was added for bonding version 3.6.0. |
| 656 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | updelay |
| 658 | |
| 659 | Specifies the time, in milliseconds, to wait before enabling a |
| 660 | slave after a link recovery has been detected. This option is |
| 661 | only valid for the miimon link monitor. The updelay value |
| 662 | should be a multiple of the miimon value; if not, it will be |
| 663 | rounded down to the nearest multiple. The default value is 0. |
| 664 | |
| 665 | use_carrier |
| 666 | |
| 667 | Specifies whether or not miimon should use MII or ETHTOOL |
| 668 | ioctls vs. netif_carrier_ok() to determine the link |
| 669 | status. The MII or ETHTOOL ioctls are less efficient and |
| 670 | utilize a deprecated calling sequence within the kernel. The |
| 671 | netif_carrier_ok() relies on the device driver to maintain its |
| 672 | state with netif_carrier_on/off; at this writing, most, but |
| 673 | not all, device drivers support this facility. |
| 674 | |
| 675 | If bonding insists that the link is up when it should not be, |
| 676 | it may be that your network device driver does not support |
| 677 | netif_carrier_on/off. The default state for netif_carrier is |
| 678 | "carrier on," so if a driver does not support netif_carrier, |
| 679 | it will appear as if the link is always up. In this case, |
| 680 | setting use_carrier to 0 will cause bonding to revert to the |
| 681 | MII / ETHTOOL ioctl method to determine the link state. |
| 682 | |
| 683 | A value of 1 enables the use of netif_carrier_ok(), a value of |
| 684 | 0 will use the deprecated MII / ETHTOOL ioctls. The default |
| 685 | value is 1. |
| 686 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 687 | xmit_hash_policy |
| 688 | |
| 689 | Selects the transmit hash policy to use for slave selection in |
| 690 | balance-xor and 802.3ad modes. Possible values are: |
| 691 | |
| 692 | layer2 |
| 693 | |
| 694 | Uses XOR of hardware MAC addresses to generate the |
| 695 | hash. The formula is |
| 696 | |
| 697 | (source MAC XOR destination MAC) modulo slave count |
| 698 | |
| 699 | This algorithm will place all traffic to a particular |
| 700 | network peer on the same slave. |
| 701 | |
| 702 | This algorithm is 802.3ad compliant. |
| 703 | |
Jay Vosburgh | 6f6652b | 2007-12-06 23:40:34 -0800 | [diff] [blame] | 704 | layer2+3 |
| 705 | |
| 706 | This policy uses a combination of layer2 and layer3 |
| 707 | protocol information to generate the hash. |
| 708 | |
| 709 | Uses XOR of hardware MAC addresses and IP addresses to |
| 710 | generate the hash. The formula is |
| 711 | |
| 712 | (((source IP XOR dest IP) AND 0xffff) XOR |
| 713 | ( source MAC XOR destination MAC )) |
| 714 | modulo slave count |
| 715 | |
| 716 | This algorithm will place all traffic to a particular |
| 717 | network peer on the same slave. For non-IP traffic, |
| 718 | the formula is the same as for the layer2 transmit |
| 719 | hash policy. |
| 720 | |
| 721 | This policy is intended to provide a more balanced |
| 722 | distribution of traffic than layer2 alone, especially |
| 723 | in environments where a layer3 gateway device is |
| 724 | required to reach most destinations. |
| 725 | |
Matt LaPlante | d919588 | 2008-07-25 19:45:33 -0700 | [diff] [blame] | 726 | This algorithm is 802.3ad compliant. |
Jay Vosburgh | 6f6652b | 2007-12-06 23:40:34 -0800 | [diff] [blame] | 727 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 728 | layer3+4 |
| 729 | |
| 730 | This policy uses upper layer protocol information, |
| 731 | when available, to generate the hash. This allows for |
| 732 | traffic to a particular network peer to span multiple |
| 733 | slaves, although a single connection will not span |
| 734 | multiple slaves. |
| 735 | |
| 736 | The formula for unfragmented TCP and UDP packets is |
| 737 | |
| 738 | ((source port XOR dest port) XOR |
| 739 | ((source IP XOR dest IP) AND 0xffff) |
| 740 | modulo slave count |
| 741 | |
| 742 | For fragmented TCP or UDP packets and all other IP |
| 743 | protocol traffic, the source and destination port |
| 744 | information is omitted. For non-IP traffic, the |
| 745 | formula is the same as for the layer2 transmit hash |
| 746 | policy. |
| 747 | |
| 748 | This policy is intended to mimic the behavior of |
| 749 | certain switches, notably Cisco switches with PFC2 as |
| 750 | well as some Foundry and IBM products. |
| 751 | |
| 752 | This algorithm is not fully 802.3ad compliant. A |
| 753 | single TCP or UDP conversation containing both |
| 754 | fragmented and unfragmented packets will see packets |
| 755 | striped across two interfaces. This may result in out |
| 756 | of order delivery. Most traffic types will not meet |
| 757 | this criteria, as TCP rarely fragments traffic, and |
| 758 | most UDP traffic is not involved in extended |
| 759 | conversations. Other implementations of 802.3ad may |
| 760 | or may not tolerate this noncompliance. |
| 761 | |
| 762 | The default value is layer2. This option was added in bonding |
Jay Vosburgh | 6f6652b | 2007-12-06 23:40:34 -0800 | [diff] [blame] | 763 | version 2.6.3. In earlier versions of bonding, this parameter |
| 764 | does not exist, and the layer2 policy is the only policy. The |
| 765 | layer2+3 value was added for bonding version 3.2.2. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 766 | |
| 767 | |
| 768 | 3. Configuring Bonding Devices |
| 769 | ============================== |
| 770 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 771 | You can configure bonding using either your distro's network |
| 772 | initialization scripts, or manually using either ifenslave or the |
| 773 | sysfs interface. Distros generally use one of two packages for the |
| 774 | network initialization scripts: initscripts or sysconfig. Recent |
| 775 | versions of these packages have support for bonding, while older |
| 776 | versions do not. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 777 | |
| 778 | We will first describe the options for configuring bonding for |
| 779 | distros using versions of initscripts and sysconfig with full or |
| 780 | partial support for bonding, then provide information on enabling |
| 781 | bonding without support from the network initialization scripts (i.e., |
| 782 | older versions of initscripts or sysconfig). |
| 783 | |
| 784 | If you're unsure whether your distro uses sysconfig or |
| 785 | initscripts, or don't know if it's new enough, have no fear. |
| 786 | Determining this is fairly straightforward. |
| 787 | |
| 788 | First, issue the command: |
| 789 | |
| 790 | $ rpm -qf /sbin/ifup |
| 791 | |
| 792 | It will respond with a line of text starting with either |
| 793 | "initscripts" or "sysconfig," followed by some numbers. This is the |
| 794 | package that provides your network initialization scripts. |
| 795 | |
| 796 | Next, to determine if your installation supports bonding, |
| 797 | issue the command: |
| 798 | |
| 799 | $ grep ifenslave /sbin/ifup |
| 800 | |
| 801 | If this returns any matches, then your initscripts or |
| 802 | sysconfig has support for bonding. |
| 803 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 804 | 3.1 Configuration with Sysconfig Support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 805 | ---------------------------------------- |
| 806 | |
| 807 | This section applies to distros using a version of sysconfig |
| 808 | with bonding support, for example, SuSE Linux Enterprise Server 9. |
| 809 | |
| 810 | SuSE SLES 9's networking configuration system does support |
| 811 | bonding, however, at this writing, the YaST system configuration |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 812 | front end does not provide any means to work with bonding devices. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 813 | Bonding devices can be managed by hand, however, as follows. |
| 814 | |
| 815 | First, if they have not already been configured, configure the |
| 816 | slave devices. On SLES 9, this is most easily done by running the |
| 817 | yast2 sysconfig configuration utility. The goal is for to create an |
| 818 | ifcfg-id file for each slave device. The simplest way to accomplish |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 819 | this is to configure the devices for DHCP (this is only to get the |
| 820 | file ifcfg-id file created; see below for some issues with DHCP). The |
| 821 | name of the configuration file for each device will be of the form: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 822 | |
| 823 | ifcfg-id-xx:xx:xx:xx:xx:xx |
| 824 | |
| 825 | Where the "xx" portion will be replaced with the digits from |
| 826 | the device's permanent MAC address. |
| 827 | |
| 828 | Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been |
| 829 | created, it is necessary to edit the configuration files for the slave |
| 830 | devices (the MAC addresses correspond to those of the slave devices). |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 831 | Before editing, the file will contain multiple lines, and will look |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 832 | something like this: |
| 833 | |
| 834 | BOOTPROTO='dhcp' |
| 835 | STARTMODE='on' |
| 836 | USERCTL='no' |
| 837 | UNIQUE='XNzu.WeZGOGF+4wE' |
| 838 | _nm_name='bus-pci-0001:61:01.0' |
| 839 | |
| 840 | Change the BOOTPROTO and STARTMODE lines to the following: |
| 841 | |
| 842 | BOOTPROTO='none' |
| 843 | STARTMODE='off' |
| 844 | |
| 845 | Do not alter the UNIQUE or _nm_name lines. Remove any other |
| 846 | lines (USERCTL, etc). |
| 847 | |
| 848 | Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified, |
| 849 | it's time to create the configuration file for the bonding device |
| 850 | itself. This file is named ifcfg-bondX, where X is the number of the |
| 851 | bonding device to create, starting at 0. The first such file is |
| 852 | ifcfg-bond0, the second is ifcfg-bond1, and so on. The sysconfig |
| 853 | network configuration system will correctly start multiple instances |
| 854 | of bonding. |
| 855 | |
| 856 | The contents of the ifcfg-bondX file is as follows: |
| 857 | |
| 858 | BOOTPROTO="static" |
| 859 | BROADCAST="10.0.2.255" |
| 860 | IPADDR="10.0.2.10" |
| 861 | NETMASK="255.255.0.0" |
| 862 | NETWORK="10.0.2.0" |
| 863 | REMOTE_IPADDR="" |
| 864 | STARTMODE="onboot" |
| 865 | BONDING_MASTER="yes" |
| 866 | BONDING_MODULE_OPTS="mode=active-backup miimon=100" |
| 867 | BONDING_SLAVE0="eth0" |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 868 | BONDING_SLAVE1="bus-pci-0000:06:08.1" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 869 | |
| 870 | Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK |
| 871 | values with the appropriate values for your network. |
| 872 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 873 | The STARTMODE specifies when the device is brought online. |
| 874 | The possible values are: |
| 875 | |
| 876 | onboot: The device is started at boot time. If you're not |
| 877 | sure, this is probably what you want. |
| 878 | |
| 879 | manual: The device is started only when ifup is called |
| 880 | manually. Bonding devices may be configured this |
| 881 | way if you do not wish them to start automatically |
| 882 | at boot for some reason. |
| 883 | |
| 884 | hotplug: The device is started by a hotplug event. This is not |
| 885 | a valid choice for a bonding device. |
| 886 | |
| 887 | off or ignore: The device configuration is ignored. |
| 888 | |
| 889 | The line BONDING_MASTER='yes' indicates that the device is a |
| 890 | bonding master device. The only useful value is "yes." |
| 891 | |
| 892 | The contents of BONDING_MODULE_OPTS are supplied to the |
| 893 | instance of the bonding module for this device. Specify the options |
| 894 | for the bonding mode, link monitoring, and so on here. Do not include |
| 895 | the max_bonds bonding parameter; this will confuse the configuration |
| 896 | system if you have multiple bonding devices. |
| 897 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 898 | Finally, supply one BONDING_SLAVEn="slave device" for each |
| 899 | slave. where "n" is an increasing value, one for each slave. The |
| 900 | "slave device" is either an interface name, e.g., "eth0", or a device |
| 901 | specifier for the network device. The interface name is easier to |
| 902 | find, but the ethN names are subject to change at boot time if, e.g., |
| 903 | a device early in the sequence has failed. The device specifiers |
| 904 | (bus-pci-0000:06:08.1 in the example above) specify the physical |
| 905 | network device, and will not change unless the device's bus location |
| 906 | changes (for example, it is moved from one PCI slot to another). The |
| 907 | example above uses one of each type for demonstration purposes; most |
| 908 | configurations will choose one or the other for all slave devices. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 909 | |
| 910 | When all configuration files have been modified or created, |
| 911 | networking must be restarted for the configuration changes to take |
| 912 | effect. This can be accomplished via the following: |
| 913 | |
| 914 | # /etc/init.d/network restart |
| 915 | |
| 916 | Note that the network control script (/sbin/ifdown) will |
| 917 | remove the bonding module as part of the network shutdown processing, |
| 918 | so it is not necessary to remove the module by hand if, e.g., the |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 919 | module parameters have changed. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | |
| 921 | Also, at this writing, YaST/YaST2 will not manage bonding |
| 922 | devices (they do not show bonding interfaces on its list of network |
| 923 | devices). It is necessary to edit the configuration file by hand to |
| 924 | change the bonding configuration. |
| 925 | |
| 926 | Additional general options and details of the ifcfg file |
| 927 | format can be found in an example ifcfg template file: |
| 928 | |
| 929 | /etc/sysconfig/network/ifcfg.template |
| 930 | |
| 931 | Note that the template does not document the various BONDING_ |
| 932 | settings described above, but does describe many of the other options. |
| 933 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 934 | 3.1.1 Using DHCP with Sysconfig |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 935 | ------------------------------- |
| 936 | |
| 937 | Under sysconfig, configuring a device with BOOTPROTO='dhcp' |
| 938 | will cause it to query DHCP for its IP address information. At this |
| 939 | writing, this does not function for bonding devices; the scripts |
| 940 | attempt to obtain the device address from DHCP prior to adding any of |
| 941 | the slave devices. Without active slaves, the DHCP requests are not |
| 942 | sent to the network. |
| 943 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 944 | 3.1.2 Configuring Multiple Bonds with Sysconfig |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 945 | ----------------------------------------------- |
| 946 | |
| 947 | The sysconfig network initialization system is capable of |
| 948 | handling multiple bonding devices. All that is necessary is for each |
| 949 | bonding instance to have an appropriately configured ifcfg-bondX file |
| 950 | (as described above). Do not specify the "max_bonds" parameter to any |
| 951 | instance of bonding, as this will confuse sysconfig. If you require |
| 952 | multiple bonding devices with identical parameters, create multiple |
| 953 | ifcfg-bondX files. |
| 954 | |
| 955 | Because the sysconfig scripts supply the bonding module |
| 956 | options in the ifcfg-bondX file, it is not necessary to add them to |
| 957 | the system /etc/modules.conf or /etc/modprobe.conf configuration file. |
| 958 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 959 | 3.2 Configuration with Initscripts Support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 960 | ------------------------------------------ |
| 961 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 962 | This section applies to distros using a recent version of |
| 963 | initscripts with bonding support, for example, Red Hat Enterprise Linux |
| 964 | version 3 or later, Fedora, etc. On these systems, the network |
| 965 | initialization scripts have knowledge of bonding, and can be configured to |
| 966 | control bonding devices. Note that older versions of the initscripts |
| 967 | package have lower levels of support for bonding; this will be noted where |
| 968 | applicable. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 969 | |
| 970 | These distros will not automatically load the network adapter |
| 971 | driver unless the ethX device is configured with an IP address. |
| 972 | Because of this constraint, users must manually configure a |
| 973 | network-script file for all physical adapters that will be members of |
| 974 | a bondX link. Network script files are located in the directory: |
| 975 | |
| 976 | /etc/sysconfig/network-scripts |
| 977 | |
| 978 | The file name must be prefixed with "ifcfg-eth" and suffixed |
| 979 | with the adapter's physical adapter number. For example, the script |
| 980 | for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0. |
| 981 | Place the following text in the file: |
| 982 | |
| 983 | DEVICE=eth0 |
| 984 | USERCTL=no |
| 985 | ONBOOT=yes |
| 986 | MASTER=bond0 |
| 987 | SLAVE=yes |
| 988 | BOOTPROTO=none |
| 989 | |
| 990 | The DEVICE= line will be different for every ethX device and |
| 991 | must correspond with the name of the file, i.e., ifcfg-eth1 must have |
| 992 | a device line of DEVICE=eth1. The setting of the MASTER= line will |
| 993 | also depend on the final bonding interface name chosen for your bond. |
| 994 | As with other network devices, these typically start at 0, and go up |
| 995 | one for each device, i.e., the first bonding instance is bond0, the |
| 996 | second is bond1, and so on. |
| 997 | |
| 998 | Next, create a bond network script. The file name for this |
| 999 | script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is |
| 1000 | the number of the bond. For bond0 the file is named "ifcfg-bond0", |
| 1001 | for bond1 it is named "ifcfg-bond1", and so on. Within that file, |
| 1002 | place the following text: |
| 1003 | |
| 1004 | DEVICE=bond0 |
| 1005 | IPADDR=192.168.1.1 |
| 1006 | NETMASK=255.255.255.0 |
| 1007 | NETWORK=192.168.1.0 |
| 1008 | BROADCAST=192.168.1.255 |
| 1009 | ONBOOT=yes |
| 1010 | BOOTPROTO=none |
| 1011 | USERCTL=no |
| 1012 | |
| 1013 | Be sure to change the networking specific lines (IPADDR, |
| 1014 | NETMASK, NETWORK and BROADCAST) to match your network configuration. |
| 1015 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1016 | For later versions of initscripts, such as that found with Fedora |
Andy Gospodarek | 3f8b4b1 | 2008-10-22 11:19:48 +0000 | [diff] [blame] | 1017 | 7 (or later) and Red Hat Enterprise Linux version 5 (or later), it is possible, |
| 1018 | and, indeed, preferable, to specify the bonding options in the ifcfg-bond0 |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1019 | file, e.g. a line of the format: |
| 1020 | |
Andy Gospodarek | 3f8b4b1 | 2008-10-22 11:19:48 +0000 | [diff] [blame] | 1021 | BONDING_OPTS="mode=active-backup arp_interval=60 arp_ip_target=192.168.1.254" |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1022 | |
| 1023 | will configure the bond with the specified options. The options |
| 1024 | specified in BONDING_OPTS are identical to the bonding module parameters |
Andy Gospodarek | 3f8b4b1 | 2008-10-22 11:19:48 +0000 | [diff] [blame] | 1025 | except for the arp_ip_target field when using versions of initscripts older |
| 1026 | than and 8.57 (Fedora 8) and 8.45.19 (Red Hat Enterprise Linux 5.2). When |
| 1027 | using older versions each target should be included as a separate option and |
| 1028 | should be preceded by a '+' to indicate it should be added to the list of |
| 1029 | queried targets, e.g., |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1030 | |
| 1031 | arp_ip_target=+192.168.1.1 arp_ip_target=+192.168.1.2 |
| 1032 | |
| 1033 | is the proper syntax to specify multiple targets. When specifying |
| 1034 | options via BONDING_OPTS, it is not necessary to edit /etc/modules.conf or |
| 1035 | /etc/modprobe.conf. |
| 1036 | |
Andy Gospodarek | 3f8b4b1 | 2008-10-22 11:19:48 +0000 | [diff] [blame] | 1037 | For even older versions of initscripts that do not support |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1038 | BONDING_OPTS, it is necessary to edit /etc/modules.conf (or |
| 1039 | /etc/modprobe.conf, depending upon your distro) to load the bonding module |
| 1040 | with your desired options when the bond0 interface is brought up. The |
| 1041 | following lines in /etc/modules.conf (or modprobe.conf) will load the |
| 1042 | bonding module, and select its options: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1043 | |
| 1044 | alias bond0 bonding |
| 1045 | options bond0 mode=balance-alb miimon=100 |
| 1046 | |
| 1047 | Replace the sample parameters with the appropriate set of |
| 1048 | options for your configuration. |
| 1049 | |
| 1050 | Finally run "/etc/rc.d/init.d/network restart" as root. This |
| 1051 | will restart the networking subsystem and your bond link should be now |
| 1052 | up and running. |
| 1053 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1054 | 3.2.1 Using DHCP with Initscripts |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1055 | --------------------------------- |
| 1056 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1057 | Recent versions of initscripts (the versions supplied with Fedora |
| 1058 | Core 3 and Red Hat Enterprise Linux 4, or later versions, are reported to |
| 1059 | work) have support for assigning IP information to bonding devices via |
| 1060 | DHCP. |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1061 | |
| 1062 | To configure bonding for DHCP, configure it as described |
| 1063 | above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp" |
| 1064 | and add a line consisting of "TYPE=Bonding". Note that the TYPE value |
| 1065 | is case sensitive. |
| 1066 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1067 | 3.2.2 Configuring Multiple Bonds with Initscripts |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1068 | ------------------------------------------------- |
| 1069 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1070 | Initscripts packages that are included with Fedora 7 and Red Hat |
| 1071 | Enterprise Linux 5 support multiple bonding interfaces by simply |
| 1072 | specifying the appropriate BONDING_OPTS= in ifcfg-bondX where X is the |
| 1073 | number of the bond. This support requires sysfs support in the kernel, |
| 1074 | and a bonding driver of version 3.0.0 or later. Other configurations may |
| 1075 | not support this method for specifying multiple bonding interfaces; for |
| 1076 | those instances, see the "Configuring Multiple Bonds Manually" section, |
| 1077 | below. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1078 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1079 | 3.3 Configuring Bonding Manually with Ifenslave |
| 1080 | ----------------------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1081 | |
| 1082 | This section applies to distros whose network initialization |
| 1083 | scripts (the sysconfig or initscripts package) do not have specific |
| 1084 | knowledge of bonding. One such distro is SuSE Linux Enterprise Server |
| 1085 | version 8. |
| 1086 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1087 | The general method for these systems is to place the bonding |
| 1088 | module parameters into /etc/modules.conf or /etc/modprobe.conf (as |
| 1089 | appropriate for the installed distro), then add modprobe and/or |
| 1090 | ifenslave commands to the system's global init script. The name of |
| 1091 | the global init script differs; for sysconfig, it is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1092 | /etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local. |
| 1093 | |
| 1094 | For example, if you wanted to make a simple bond of two e100 |
| 1095 | devices (presumed to be eth0 and eth1), and have it persist across |
| 1096 | reboots, edit the appropriate file (/etc/init.d/boot.local or |
| 1097 | /etc/rc.d/rc.local), and add the following: |
| 1098 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1099 | modprobe bonding mode=balance-alb miimon=100 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | modprobe e100 |
| 1101 | ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up |
| 1102 | ifenslave bond0 eth0 |
| 1103 | ifenslave bond0 eth1 |
| 1104 | |
| 1105 | Replace the example bonding module parameters and bond0 |
| 1106 | network configuration (IP address, netmask, etc) with the appropriate |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1107 | values for your configuration. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1108 | |
| 1109 | Unfortunately, this method will not provide support for the |
| 1110 | ifup and ifdown scripts on the bond devices. To reload the bonding |
| 1111 | configuration, it is necessary to run the initialization script, e.g., |
| 1112 | |
| 1113 | # /etc/init.d/boot.local |
| 1114 | |
| 1115 | or |
| 1116 | |
| 1117 | # /etc/rc.d/rc.local |
| 1118 | |
| 1119 | It may be desirable in such a case to create a separate script |
| 1120 | which only initializes the bonding configuration, then call that |
| 1121 | separate script from within boot.local. This allows for bonding to be |
| 1122 | enabled without re-running the entire global init script. |
| 1123 | |
| 1124 | To shut down the bonding devices, it is necessary to first |
| 1125 | mark the bonding device itself as being down, then remove the |
| 1126 | appropriate device driver modules. For our example above, you can do |
| 1127 | the following: |
| 1128 | |
| 1129 | # ifconfig bond0 down |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1130 | # rmmod bonding |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1131 | # rmmod e100 |
| 1132 | |
| 1133 | Again, for convenience, it may be desirable to create a script |
| 1134 | with these commands. |
| 1135 | |
| 1136 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1137 | 3.3.1 Configuring Multiple Bonds Manually |
| 1138 | ----------------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1139 | |
| 1140 | This section contains information on configuring multiple |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1141 | bonding devices with differing options for those systems whose network |
| 1142 | initialization scripts lack support for configuring multiple bonds. |
| 1143 | |
| 1144 | If you require multiple bonding devices, but all with the same |
| 1145 | options, you may wish to use the "max_bonds" module parameter, |
| 1146 | documented above. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1148 | To create multiple bonding devices with differing options, it is |
| 1149 | preferrable to use bonding parameters exported by sysfs, documented in the |
| 1150 | section below. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1151 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1152 | For versions of bonding without sysfs support, the only means to |
| 1153 | provide multiple instances of bonding with differing options is to load |
| 1154 | the bonding driver multiple times. Note that current versions of the |
| 1155 | sysconfig network initialization scripts handle this automatically; if |
| 1156 | your distro uses these scripts, no special action is needed. See the |
| 1157 | section Configuring Bonding Devices, above, if you're not sure about your |
| 1158 | network initialization scripts. |
| 1159 | |
| 1160 | To load multiple instances of the module, it is necessary to |
| 1161 | specify a different name for each instance (the module loading system |
| 1162 | requires that every loaded module, even multiple instances of the same |
| 1163 | module, have a unique name). This is accomplished by supplying multiple |
| 1164 | sets of bonding options in /etc/modprobe.conf, for example: |
| 1165 | |
| 1166 | alias bond0 bonding |
| 1167 | options bond0 -o bond0 mode=balance-rr miimon=100 |
| 1168 | |
| 1169 | alias bond1 bonding |
| 1170 | options bond1 -o bond1 mode=balance-alb miimon=50 |
| 1171 | |
| 1172 | will load the bonding module two times. The first instance is |
| 1173 | named "bond0" and creates the bond0 device in balance-rr mode with an |
| 1174 | miimon of 100. The second instance is named "bond1" and creates the |
| 1175 | bond1 device in balance-alb mode with an miimon of 50. |
| 1176 | |
| 1177 | In some circumstances (typically with older distributions), |
| 1178 | the above does not work, and the second bonding instance never sees |
| 1179 | its options. In that case, the second options line can be substituted |
| 1180 | as follows: |
| 1181 | |
| 1182 | install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \ |
| 1183 | mode=balance-alb miimon=50 |
| 1184 | |
| 1185 | This may be repeated any number of times, specifying a new and |
| 1186 | unique name in place of bond1 for each subsequent instance. |
| 1187 | |
| 1188 | It has been observed that some Red Hat supplied kernels are unable |
| 1189 | to rename modules at load time (the "-o bond1" part). Attempts to pass |
| 1190 | that option to modprobe will produce an "Operation not permitted" error. |
| 1191 | This has been reported on some Fedora Core kernels, and has been seen on |
| 1192 | RHEL 4 as well. On kernels exhibiting this problem, it will be impossible |
| 1193 | to configure multiple bonds with differing parameters (as they are older |
| 1194 | kernels, and also lack sysfs support). |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1195 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1196 | 3.4 Configuring Bonding Manually via Sysfs |
| 1197 | ------------------------------------------ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1198 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1199 | Starting with version 3.0.0, Channel Bonding may be configured |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1200 | via the sysfs interface. This interface allows dynamic configuration |
| 1201 | of all bonds in the system without unloading the module. It also |
| 1202 | allows for adding and removing bonds at runtime. Ifenslave is no |
| 1203 | longer required, though it is still supported. |
| 1204 | |
| 1205 | Use of the sysfs interface allows you to use multiple bonds |
| 1206 | with different configurations without having to reload the module. |
| 1207 | It also allows you to use multiple, differently configured bonds when |
| 1208 | bonding is compiled into the kernel. |
| 1209 | |
| 1210 | You must have the sysfs filesystem mounted to configure |
| 1211 | bonding this way. The examples in this document assume that you |
| 1212 | are using the standard mount point for sysfs, e.g. /sys. If your |
| 1213 | sysfs filesystem is mounted elsewhere, you will need to adjust the |
| 1214 | example paths accordingly. |
| 1215 | |
| 1216 | Creating and Destroying Bonds |
| 1217 | ----------------------------- |
| 1218 | To add a new bond foo: |
| 1219 | # echo +foo > /sys/class/net/bonding_masters |
| 1220 | |
| 1221 | To remove an existing bond bar: |
| 1222 | # echo -bar > /sys/class/net/bonding_masters |
| 1223 | |
| 1224 | To show all existing bonds: |
| 1225 | # cat /sys/class/net/bonding_masters |
| 1226 | |
| 1227 | NOTE: due to 4K size limitation of sysfs files, this list may be |
| 1228 | truncated if you have more than a few hundred bonds. This is unlikely |
| 1229 | to occur under normal operating conditions. |
| 1230 | |
| 1231 | Adding and Removing Slaves |
| 1232 | -------------------------- |
| 1233 | Interfaces may be enslaved to a bond using the file |
| 1234 | /sys/class/net/<bond>/bonding/slaves. The semantics for this file |
| 1235 | are the same as for the bonding_masters file. |
| 1236 | |
| 1237 | To enslave interface eth0 to bond bond0: |
| 1238 | # ifconfig bond0 up |
| 1239 | # echo +eth0 > /sys/class/net/bond0/bonding/slaves |
| 1240 | |
| 1241 | To free slave eth0 from bond bond0: |
| 1242 | # echo -eth0 > /sys/class/net/bond0/bonding/slaves |
| 1243 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1244 | When an interface is enslaved to a bond, symlinks between the |
| 1245 | two are created in the sysfs filesystem. In this case, you would get |
| 1246 | /sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and |
| 1247 | /sys/class/net/eth0/master pointing to /sys/class/net/bond0. |
| 1248 | |
| 1249 | This means that you can tell quickly whether or not an |
| 1250 | interface is enslaved by looking for the master symlink. Thus: |
| 1251 | # echo -eth0 > /sys/class/net/eth0/master/bonding/slaves |
| 1252 | will free eth0 from whatever bond it is enslaved to, regardless of |
| 1253 | the name of the bond interface. |
| 1254 | |
| 1255 | Changing a Bond's Configuration |
| 1256 | ------------------------------- |
| 1257 | Each bond may be configured individually by manipulating the |
| 1258 | files located in /sys/class/net/<bond name>/bonding |
| 1259 | |
| 1260 | The names of these files correspond directly with the command- |
Paolo Ornati | 670e9f3 | 2006-10-03 22:57:56 +0200 | [diff] [blame] | 1261 | line parameters described elsewhere in this file, and, with the |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1262 | exception of arp_ip_target, they accept the same values. To see the |
| 1263 | current setting, simply cat the appropriate file. |
| 1264 | |
| 1265 | A few examples will be given here; for specific usage |
| 1266 | guidelines for each parameter, see the appropriate section in this |
| 1267 | document. |
| 1268 | |
| 1269 | To configure bond0 for balance-alb mode: |
| 1270 | # ifconfig bond0 down |
| 1271 | # echo 6 > /sys/class/net/bond0/bonding/mode |
| 1272 | - or - |
| 1273 | # echo balance-alb > /sys/class/net/bond0/bonding/mode |
| 1274 | NOTE: The bond interface must be down before the mode can be |
| 1275 | changed. |
| 1276 | |
| 1277 | To enable MII monitoring on bond0 with a 1 second interval: |
| 1278 | # echo 1000 > /sys/class/net/bond0/bonding/miimon |
| 1279 | NOTE: If ARP monitoring is enabled, it will disabled when MII |
| 1280 | monitoring is enabled, and vice-versa. |
| 1281 | |
| 1282 | To add ARP targets: |
| 1283 | # echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target |
| 1284 | # echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target |
Brian Haley | 5a31bec | 2009-04-13 00:11:30 -0700 | [diff] [blame] | 1285 | NOTE: up to 16 target addresses may be specified. |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1286 | |
| 1287 | To remove an ARP target: |
| 1288 | # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target |
| 1289 | |
| 1290 | Example Configuration |
| 1291 | --------------------- |
| 1292 | We begin with the same example that is shown in section 3.3, |
| 1293 | executed with sysfs, and without using ifenslave. |
| 1294 | |
| 1295 | To make a simple bond of two e100 devices (presumed to be eth0 |
| 1296 | and eth1), and have it persist across reboots, edit the appropriate |
| 1297 | file (/etc/init.d/boot.local or /etc/rc.d/rc.local), and add the |
| 1298 | following: |
| 1299 | |
| 1300 | modprobe bonding |
| 1301 | modprobe e100 |
| 1302 | echo balance-alb > /sys/class/net/bond0/bonding/mode |
| 1303 | ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up |
| 1304 | echo 100 > /sys/class/net/bond0/bonding/miimon |
| 1305 | echo +eth0 > /sys/class/net/bond0/bonding/slaves |
| 1306 | echo +eth1 > /sys/class/net/bond0/bonding/slaves |
| 1307 | |
| 1308 | To add a second bond, with two e1000 interfaces in |
| 1309 | active-backup mode, using ARP monitoring, add the following lines to |
| 1310 | your init script: |
| 1311 | |
| 1312 | modprobe e1000 |
| 1313 | echo +bond1 > /sys/class/net/bonding_masters |
| 1314 | echo active-backup > /sys/class/net/bond1/bonding/mode |
| 1315 | ifconfig bond1 192.168.2.1 netmask 255.255.255.0 up |
| 1316 | echo +192.168.2.100 /sys/class/net/bond1/bonding/arp_ip_target |
| 1317 | echo 2000 > /sys/class/net/bond1/bonding/arp_interval |
| 1318 | echo +eth2 > /sys/class/net/bond1/bonding/slaves |
| 1319 | echo +eth3 > /sys/class/net/bond1/bonding/slaves |
| 1320 | |
| 1321 | |
| 1322 | 4. Querying Bonding Configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1323 | ================================= |
| 1324 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1325 | 4.1 Bonding Configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1326 | ------------------------- |
| 1327 | |
| 1328 | Each bonding device has a read-only file residing in the |
| 1329 | /proc/net/bonding directory. The file contents include information |
| 1330 | about the bonding configuration, options and state of each slave. |
| 1331 | |
| 1332 | For example, the contents of /proc/net/bonding/bond0 after the |
| 1333 | driver is loaded with parameters of mode=0 and miimon=1000 is |
| 1334 | generally as follows: |
| 1335 | |
| 1336 | Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004) |
| 1337 | Bonding Mode: load balancing (round-robin) |
| 1338 | Currently Active Slave: eth0 |
| 1339 | MII Status: up |
| 1340 | MII Polling Interval (ms): 1000 |
| 1341 | Up Delay (ms): 0 |
| 1342 | Down Delay (ms): 0 |
| 1343 | |
| 1344 | Slave Interface: eth1 |
| 1345 | MII Status: up |
| 1346 | Link Failure Count: 1 |
| 1347 | |
| 1348 | Slave Interface: eth0 |
| 1349 | MII Status: up |
| 1350 | Link Failure Count: 1 |
| 1351 | |
| 1352 | The precise format and contents will change depending upon the |
| 1353 | bonding configuration, state, and version of the bonding driver. |
| 1354 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1355 | 4.2 Network configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1356 | ------------------------- |
| 1357 | |
| 1358 | The network configuration can be inspected using the ifconfig |
| 1359 | command. Bonding devices will have the MASTER flag set; Bonding slave |
| 1360 | devices will have the SLAVE flag set. The ifconfig output does not |
| 1361 | contain information on which slaves are associated with which masters. |
| 1362 | |
| 1363 | In the example below, the bond0 interface is the master |
| 1364 | (MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of |
| 1365 | bond0 have the same MAC address (HWaddr) as bond0 for all modes except |
| 1366 | TLB and ALB that require a unique MAC address for each slave. |
| 1367 | |
| 1368 | # /sbin/ifconfig |
| 1369 | bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 |
| 1370 | inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0 |
| 1371 | UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 |
| 1372 | RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0 |
| 1373 | TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0 |
| 1374 | collisions:0 txqueuelen:0 |
| 1375 | |
| 1376 | eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1377 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 |
| 1378 | RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0 |
| 1379 | TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0 |
| 1380 | collisions:0 txqueuelen:100 |
| 1381 | Interrupt:10 Base address:0x1080 |
| 1382 | |
| 1383 | eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1384 | UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 |
| 1385 | RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0 |
| 1386 | TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0 |
| 1387 | collisions:0 txqueuelen:100 |
| 1388 | Interrupt:9 Base address:0x1400 |
| 1389 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1390 | 5. Switch Configuration |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1391 | ======================= |
| 1392 | |
| 1393 | For this section, "switch" refers to whatever system the |
| 1394 | bonded devices are directly connected to (i.e., where the other end of |
| 1395 | the cable plugs into). This may be an actual dedicated switch device, |
| 1396 | or it may be another regular system (e.g., another computer running |
| 1397 | Linux), |
| 1398 | |
| 1399 | The active-backup, balance-tlb and balance-alb modes do not |
| 1400 | require any specific configuration of the switch. |
| 1401 | |
| 1402 | The 802.3ad mode requires that the switch have the appropriate |
| 1403 | ports configured as an 802.3ad aggregation. The precise method used |
| 1404 | to configure this varies from switch to switch, but, for example, a |
| 1405 | Cisco 3550 series switch requires that the appropriate ports first be |
| 1406 | grouped together in a single etherchannel instance, then that |
| 1407 | etherchannel is set to mode "lacp" to enable 802.3ad (instead of |
| 1408 | standard EtherChannel). |
| 1409 | |
| 1410 | The balance-rr, balance-xor and broadcast modes generally |
| 1411 | require that the switch have the appropriate ports grouped together. |
| 1412 | The nomenclature for such a group differs between switches, it may be |
| 1413 | called an "etherchannel" (as in the Cisco example, above), a "trunk |
| 1414 | group" or some other similar variation. For these modes, each switch |
| 1415 | will also have its own configuration options for the switch's transmit |
| 1416 | policy to the bond. Typical choices include XOR of either the MAC or |
| 1417 | IP addresses. The transmit policy of the two peers does not need to |
| 1418 | match. For these three modes, the bonding mode really selects a |
| 1419 | transmit policy for an EtherChannel group; all three will interoperate |
| 1420 | with another EtherChannel group. |
| 1421 | |
| 1422 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1423 | 6. 802.1q VLAN Support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1424 | ====================== |
| 1425 | |
| 1426 | It is possible to configure VLAN devices over a bond interface |
| 1427 | using the 8021q driver. However, only packets coming from the 8021q |
| 1428 | driver and passing through bonding will be tagged by default. Self |
| 1429 | generated packets, for example, bonding's learning packets or ARP |
| 1430 | packets generated by either ALB mode or the ARP monitor mechanism, are |
| 1431 | tagged internally by bonding itself. As a result, bonding must |
| 1432 | "learn" the VLAN IDs configured above it, and use those IDs to tag |
| 1433 | self generated packets. |
| 1434 | |
| 1435 | For reasons of simplicity, and to support the use of adapters |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1436 | that can do VLAN hardware acceleration offloading, the bonding |
| 1437 | interface declares itself as fully hardware offloading capable, it gets |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1438 | the add_vid/kill_vid notifications to gather the necessary |
| 1439 | information, and it propagates those actions to the slaves. In case |
| 1440 | of mixed adapter types, hardware accelerated tagged packets that |
| 1441 | should go through an adapter that is not offloading capable are |
| 1442 | "un-accelerated" by the bonding driver so the VLAN tag sits in the |
| 1443 | regular location. |
| 1444 | |
| 1445 | VLAN interfaces *must* be added on top of a bonding interface |
| 1446 | only after enslaving at least one slave. The bonding interface has a |
| 1447 | hardware address of 00:00:00:00:00:00 until the first slave is added. |
| 1448 | If the VLAN interface is created prior to the first enslavement, it |
| 1449 | would pick up the all-zeroes hardware address. Once the first slave |
| 1450 | is attached to the bond, the bond device itself will pick up the |
| 1451 | slave's hardware address, which is then available for the VLAN device. |
| 1452 | |
| 1453 | Also, be aware that a similar problem can occur if all slaves |
| 1454 | are released from a bond that still has one or more VLAN interfaces on |
| 1455 | top of it. When a new slave is added, the bonding interface will |
| 1456 | obtain its hardware address from the first slave, which might not |
| 1457 | match the hardware address of the VLAN interfaces (which was |
| 1458 | ultimately copied from an earlier slave). |
| 1459 | |
| 1460 | There are two methods to insure that the VLAN device operates |
| 1461 | with the correct hardware address if all slaves are removed from a |
| 1462 | bond interface: |
| 1463 | |
| 1464 | 1. Remove all VLAN interfaces then recreate them |
| 1465 | |
| 1466 | 2. Set the bonding interface's hardware address so that it |
| 1467 | matches the hardware address of the VLAN interfaces. |
| 1468 | |
| 1469 | Note that changing a VLAN interface's HW address would set the |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1470 | underlying device -- i.e. the bonding interface -- to promiscuous |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1471 | mode, which might not be what you want. |
| 1472 | |
| 1473 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1474 | 7. Link Monitoring |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1475 | ================== |
| 1476 | |
| 1477 | The bonding driver at present supports two schemes for |
| 1478 | monitoring a slave device's link state: the ARP monitor and the MII |
| 1479 | monitor. |
| 1480 | |
| 1481 | At the present time, due to implementation restrictions in the |
| 1482 | bonding driver itself, it is not possible to enable both ARP and MII |
| 1483 | monitoring simultaneously. |
| 1484 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1485 | 7.1 ARP Monitor Operation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1486 | ------------------------- |
| 1487 | |
| 1488 | The ARP monitor operates as its name suggests: it sends ARP |
| 1489 | queries to one or more designated peer systems on the network, and |
| 1490 | uses the response as an indication that the link is operating. This |
| 1491 | gives some assurance that traffic is actually flowing to and from one |
| 1492 | or more peers on the local network. |
| 1493 | |
| 1494 | The ARP monitor relies on the device driver itself to verify |
| 1495 | that traffic is flowing. In particular, the driver must keep up to |
| 1496 | date the last receive time, dev->last_rx, and transmit start time, |
| 1497 | dev->trans_start. If these are not updated by the driver, then the |
| 1498 | ARP monitor will immediately fail any slaves using that driver, and |
| 1499 | those slaves will stay down. If networking monitoring (tcpdump, etc) |
| 1500 | shows the ARP requests and replies on the network, then it may be that |
| 1501 | your device driver is not updating last_rx and trans_start. |
| 1502 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1503 | 7.2 Configuring Multiple ARP Targets |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1504 | ------------------------------------ |
| 1505 | |
| 1506 | While ARP monitoring can be done with just one target, it can |
| 1507 | be useful in a High Availability setup to have several targets to |
| 1508 | monitor. In the case of just one target, the target itself may go |
| 1509 | down or have a problem making it unresponsive to ARP requests. Having |
| 1510 | an additional target (or several) increases the reliability of the ARP |
| 1511 | monitoring. |
| 1512 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1513 | Multiple ARP targets must be separated by commas as follows: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1514 | |
| 1515 | # example options for ARP monitoring with three targets |
| 1516 | alias bond0 bonding |
| 1517 | options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9 |
| 1518 | |
| 1519 | For just a single target the options would resemble: |
| 1520 | |
| 1521 | # example options for ARP monitoring with one target |
| 1522 | alias bond0 bonding |
| 1523 | options bond0 arp_interval=60 arp_ip_target=192.168.0.100 |
| 1524 | |
| 1525 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1526 | 7.3 MII Monitor Operation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1527 | ------------------------- |
| 1528 | |
| 1529 | The MII monitor monitors only the carrier state of the local |
| 1530 | network interface. It accomplishes this in one of three ways: by |
| 1531 | depending upon the device driver to maintain its carrier state, by |
| 1532 | querying the device's MII registers, or by making an ethtool query to |
| 1533 | the device. |
| 1534 | |
| 1535 | If the use_carrier module parameter is 1 (the default value), |
| 1536 | then the MII monitor will rely on the driver for carrier state |
| 1537 | information (via the netif_carrier subsystem). As explained in the |
| 1538 | use_carrier parameter information, above, if the MII monitor fails to |
| 1539 | detect carrier loss on the device (e.g., when the cable is physically |
| 1540 | disconnected), it may be that the driver does not support |
| 1541 | netif_carrier. |
| 1542 | |
| 1543 | If use_carrier is 0, then the MII monitor will first query the |
| 1544 | device's (via ioctl) MII registers and check the link state. If that |
| 1545 | request fails (not just that it returns carrier down), then the MII |
| 1546 | monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain |
| 1547 | the same information. If both methods fail (i.e., the driver either |
| 1548 | does not support or had some error in processing both the MII register |
| 1549 | and ethtool requests), then the MII monitor will assume the link is |
| 1550 | up. |
| 1551 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1552 | 8. Potential Sources of Trouble |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1553 | =============================== |
| 1554 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1555 | 8.1 Adventures in Routing |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1556 | ------------------------- |
| 1557 | |
| 1558 | When bonding is configured, it is important that the slave |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1559 | devices not have routes that supersede routes of the master (or, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1560 | generally, not have routes at all). For example, suppose the bonding |
| 1561 | device bond0 has two slaves, eth0 and eth1, and the routing table is |
| 1562 | as follows: |
| 1563 | |
| 1564 | Kernel IP routing table |
| 1565 | Destination Gateway Genmask Flags MSS Window irtt Iface |
| 1566 | 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0 |
| 1567 | 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth1 |
| 1568 | 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 bond0 |
| 1569 | 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo |
| 1570 | |
| 1571 | This routing configuration will likely still update the |
| 1572 | receive/transmit times in the driver (needed by the ARP monitor), but |
| 1573 | may bypass the bonding driver (because outgoing traffic to, in this |
| 1574 | case, another host on network 10 would use eth0 or eth1 before bond0). |
| 1575 | |
| 1576 | The ARP monitor (and ARP itself) may become confused by this |
| 1577 | configuration, because ARP requests (generated by the ARP monitor) |
| 1578 | will be sent on one interface (bond0), but the corresponding reply |
| 1579 | will arrive on a different interface (eth0). This reply looks to ARP |
| 1580 | as an unsolicited ARP reply (because ARP matches replies on an |
| 1581 | interface basis), and is discarded. The MII monitor is not affected |
| 1582 | by the state of the routing table. |
| 1583 | |
| 1584 | The solution here is simply to insure that slaves do not have |
| 1585 | routes of their own, and if for some reason they must, those routes do |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1586 | not supersede routes of their master. This should generally be the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1587 | case, but unusual configurations or errant manual or automatic static |
| 1588 | route additions may cause trouble. |
| 1589 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1590 | 8.2 Ethernet Device Renaming |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1591 | ---------------------------- |
| 1592 | |
| 1593 | On systems with network configuration scripts that do not |
| 1594 | associate physical devices directly with network interface names (so |
| 1595 | that the same physical device always has the same "ethX" name), it may |
| 1596 | be necessary to add some special logic to either /etc/modules.conf or |
| 1597 | /etc/modprobe.conf (depending upon which is installed on the system). |
| 1598 | |
| 1599 | For example, given a modules.conf containing the following: |
| 1600 | |
| 1601 | alias bond0 bonding |
| 1602 | options bond0 mode=some-mode miimon=50 |
| 1603 | alias eth0 tg3 |
| 1604 | alias eth1 tg3 |
| 1605 | alias eth2 e1000 |
| 1606 | alias eth3 e1000 |
| 1607 | |
| 1608 | If neither eth0 and eth1 are slaves to bond0, then when the |
| 1609 | bond0 interface comes up, the devices may end up reordered. This |
| 1610 | happens because bonding is loaded first, then its slave device's |
| 1611 | drivers are loaded next. Since no other drivers have been loaded, |
| 1612 | when the e1000 driver loads, it will receive eth0 and eth1 for its |
| 1613 | devices, but the bonding configuration tries to enslave eth2 and eth3 |
| 1614 | (which may later be assigned to the tg3 devices). |
| 1615 | |
| 1616 | Adding the following: |
| 1617 | |
| 1618 | add above bonding e1000 tg3 |
| 1619 | |
| 1620 | causes modprobe to load e1000 then tg3, in that order, when |
| 1621 | bonding is loaded. This command is fully documented in the |
| 1622 | modules.conf manual page. |
| 1623 | |
| 1624 | On systems utilizing modprobe.conf (or modprobe.conf.local), |
| 1625 | an equivalent problem can occur. In this case, the following can be |
| 1626 | added to modprobe.conf (or modprobe.conf.local, as appropriate), as |
| 1627 | follows (all on one line; it has been split here for clarity): |
| 1628 | |
| 1629 | install bonding /sbin/modprobe tg3; /sbin/modprobe e1000; |
| 1630 | /sbin/modprobe --ignore-install bonding |
| 1631 | |
| 1632 | This will, when loading the bonding module, rather than |
| 1633 | performing the normal action, instead execute the provided command. |
| 1634 | This command loads the device drivers in the order needed, then calls |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1635 | modprobe with --ignore-install to cause the normal action to then take |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1636 | place. Full documentation on this can be found in the modprobe.conf |
| 1637 | and modprobe manual pages. |
| 1638 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1639 | 8.3. Painfully Slow Or No Failed Link Detection By Miimon |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1640 | --------------------------------------------------------- |
| 1641 | |
| 1642 | By default, bonding enables the use_carrier option, which |
| 1643 | instructs bonding to trust the driver to maintain carrier state. |
| 1644 | |
| 1645 | As discussed in the options section, above, some drivers do |
| 1646 | not support the netif_carrier_on/_off link state tracking system. |
| 1647 | With use_carrier enabled, bonding will always see these links as up, |
| 1648 | regardless of their actual state. |
| 1649 | |
| 1650 | Additionally, other drivers do support netif_carrier, but do |
| 1651 | not maintain it in real time, e.g., only polling the link state at |
| 1652 | some fixed interval. In this case, miimon will detect failures, but |
| 1653 | only after some long period of time has expired. If it appears that |
| 1654 | miimon is very slow in detecting link failures, try specifying |
| 1655 | use_carrier=0 to see if that improves the failure detection time. If |
| 1656 | it does, then it may be that the driver checks the carrier state at a |
| 1657 | fixed interval, but does not cache the MII register values (so the |
| 1658 | use_carrier=0 method of querying the registers directly works). If |
| 1659 | use_carrier=0 does not improve the failover, then the driver may cache |
| 1660 | the registers, or the problem may be elsewhere. |
| 1661 | |
| 1662 | Also, remember that miimon only checks for the device's |
| 1663 | carrier state. It has no way to determine the state of devices on or |
| 1664 | beyond other ports of a switch, or if a switch is refusing to pass |
| 1665 | traffic while still maintaining carrier on. |
| 1666 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1667 | 9. SNMP agents |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1668 | =============== |
| 1669 | |
| 1670 | If running SNMP agents, the bonding driver should be loaded |
| 1671 | before any network drivers participating in a bond. This requirement |
Tobias Klauser | d533f67 | 2005-09-10 00:26:46 -0700 | [diff] [blame] | 1672 | is due to the interface index (ipAdEntIfIndex) being associated to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1673 | the first interface found with a given IP address. That is, there is |
| 1674 | only one ipAdEntIfIndex for each IP address. For example, if eth0 and |
| 1675 | eth1 are slaves of bond0 and the driver for eth0 is loaded before the |
| 1676 | bonding driver, the interface for the IP address will be associated |
| 1677 | with the eth0 interface. This configuration is shown below, the IP |
| 1678 | address 192.168.1.1 has an interface index of 2 which indexes to eth0 |
| 1679 | in the ifDescr table (ifDescr.2). |
| 1680 | |
| 1681 | interfaces.ifTable.ifEntry.ifDescr.1 = lo |
| 1682 | interfaces.ifTable.ifEntry.ifDescr.2 = eth0 |
| 1683 | interfaces.ifTable.ifEntry.ifDescr.3 = eth1 |
| 1684 | interfaces.ifTable.ifEntry.ifDescr.4 = eth2 |
| 1685 | interfaces.ifTable.ifEntry.ifDescr.5 = eth3 |
| 1686 | interfaces.ifTable.ifEntry.ifDescr.6 = bond0 |
| 1687 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5 |
| 1688 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2 |
| 1689 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4 |
| 1690 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1 |
| 1691 | |
| 1692 | This problem is avoided by loading the bonding driver before |
| 1693 | any network drivers participating in a bond. Below is an example of |
| 1694 | loading the bonding driver first, the IP address 192.168.1.1 is |
| 1695 | correctly associated with ifDescr.2. |
| 1696 | |
| 1697 | interfaces.ifTable.ifEntry.ifDescr.1 = lo |
| 1698 | interfaces.ifTable.ifEntry.ifDescr.2 = bond0 |
| 1699 | interfaces.ifTable.ifEntry.ifDescr.3 = eth0 |
| 1700 | interfaces.ifTable.ifEntry.ifDescr.4 = eth1 |
| 1701 | interfaces.ifTable.ifEntry.ifDescr.5 = eth2 |
| 1702 | interfaces.ifTable.ifEntry.ifDescr.6 = eth3 |
| 1703 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6 |
| 1704 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2 |
| 1705 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5 |
| 1706 | ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1 |
| 1707 | |
| 1708 | While some distributions may not report the interface name in |
| 1709 | ifDescr, the association between the IP address and IfIndex remains |
| 1710 | and SNMP functions such as Interface_Scan_Next will report that |
| 1711 | association. |
| 1712 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1713 | 10. Promiscuous mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | ==================== |
| 1715 | |
| 1716 | When running network monitoring tools, e.g., tcpdump, it is |
| 1717 | common to enable promiscuous mode on the device, so that all traffic |
| 1718 | is seen (instead of seeing only traffic destined for the local host). |
| 1719 | The bonding driver handles promiscuous mode changes to the bonding |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1720 | master device (e.g., bond0), and propagates the setting to the slave |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1721 | devices. |
| 1722 | |
| 1723 | For the balance-rr, balance-xor, broadcast, and 802.3ad modes, |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1724 | the promiscuous mode setting is propagated to all slaves. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1725 | |
| 1726 | For the active-backup, balance-tlb and balance-alb modes, the |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1727 | promiscuous mode setting is propagated only to the active slave. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1728 | |
| 1729 | For balance-tlb mode, the active slave is the slave currently |
| 1730 | receiving inbound traffic. |
| 1731 | |
| 1732 | For balance-alb mode, the active slave is the slave used as a |
| 1733 | "primary." This slave is used for mode-specific control traffic, for |
| 1734 | sending to peers that are unassigned or if the load is unbalanced. |
| 1735 | |
| 1736 | For the active-backup, balance-tlb and balance-alb modes, when |
| 1737 | the active slave changes (e.g., due to a link failure), the |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1738 | promiscuous setting will be propagated to the new active slave. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1739 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1740 | 11. Configuring Bonding for High Availability |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1741 | ============================================= |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1742 | |
| 1743 | High Availability refers to configurations that provide |
| 1744 | maximum network availability by having redundant or backup devices, |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1745 | links or switches between the host and the rest of the world. The |
| 1746 | goal is to provide the maximum availability of network connectivity |
| 1747 | (i.e., the network always works), even though other configurations |
| 1748 | could provide higher throughput. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1749 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1750 | 11.1 High Availability in a Single Switch Topology |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1751 | -------------------------------------------------- |
| 1752 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1753 | If two hosts (or a host and a single switch) are directly |
| 1754 | connected via multiple physical links, then there is no availability |
| 1755 | penalty to optimizing for maximum bandwidth. In this case, there is |
| 1756 | only one switch (or peer), so if it fails, there is no alternative |
| 1757 | access to fail over to. Additionally, the bonding load balance modes |
| 1758 | support link monitoring of their members, so if individual links fail, |
| 1759 | the load will be rebalanced across the remaining devices. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1760 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1761 | See Section 13, "Configuring Bonding for Maximum Throughput" |
| 1762 | for information on configuring bonding with one peer device. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1763 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1764 | 11.2 High Availability in a Multiple Switch Topology |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1765 | ---------------------------------------------------- |
| 1766 | |
| 1767 | With multiple switches, the configuration of bonding and the |
| 1768 | network changes dramatically. In multiple switch topologies, there is |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1769 | a trade off between network availability and usable bandwidth. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1770 | |
| 1771 | Below is a sample network, configured to maximize the |
| 1772 | availability of the network: |
| 1773 | |
| 1774 | | | |
| 1775 | |port3 port3| |
| 1776 | +-----+----+ +-----+----+ |
| 1777 | | |port2 ISL port2| | |
| 1778 | | switch A +--------------------------+ switch B | |
| 1779 | | | | | |
| 1780 | +-----+----+ +-----++---+ |
| 1781 | |port1 port1| |
| 1782 | | +-------+ | |
| 1783 | +-------------+ host1 +---------------+ |
| 1784 | eth0 +-------+ eth1 |
| 1785 | |
| 1786 | In this configuration, there is a link between the two |
| 1787 | switches (ISL, or inter switch link), and multiple ports connecting to |
| 1788 | the outside world ("port3" on each switch). There is no technical |
| 1789 | reason that this could not be extended to a third switch. |
| 1790 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1791 | 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1792 | ------------------------------------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1793 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1794 | In a topology such as the example above, the active-backup and |
| 1795 | broadcast modes are the only useful bonding modes when optimizing for |
| 1796 | availability; the other modes require all links to terminate on the |
| 1797 | same peer for them to behave rationally. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1798 | |
| 1799 | active-backup: This is generally the preferred mode, particularly if |
| 1800 | the switches have an ISL and play together well. If the |
| 1801 | network configuration is such that one switch is specifically |
| 1802 | a backup switch (e.g., has lower capacity, higher cost, etc), |
| 1803 | then the primary option can be used to insure that the |
| 1804 | preferred link is always used when it is available. |
| 1805 | |
| 1806 | broadcast: This mode is really a special purpose mode, and is suitable |
| 1807 | only for very specific needs. For example, if the two |
| 1808 | switches are not connected (no ISL), and the networks beyond |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1809 | them are totally independent. In this case, if it is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1810 | necessary for some specific one-way traffic to reach both |
| 1811 | independent networks, then the broadcast mode may be suitable. |
| 1812 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1813 | 11.2.2 HA Link Monitoring Selection for Multiple Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1814 | ---------------------------------------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1815 | |
| 1816 | The choice of link monitoring ultimately depends upon your |
| 1817 | switch. If the switch can reliably fail ports in response to other |
| 1818 | failures, then either the MII or ARP monitors should work. For |
| 1819 | example, in the above example, if the "port3" link fails at the remote |
| 1820 | end, the MII monitor has no direct means to detect this. The ARP |
| 1821 | monitor could be configured with a target at the remote end of port3, |
| 1822 | thus detecting that failure without switch support. |
| 1823 | |
| 1824 | In general, however, in a multiple switch topology, the ARP |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1825 | monitor can provide a higher level of reliability in detecting end to |
| 1826 | end connectivity failures (which may be caused by the failure of any |
| 1827 | individual component to pass traffic for any reason). Additionally, |
| 1828 | the ARP monitor should be configured with multiple targets (at least |
| 1829 | one for each switch in the network). This will insure that, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1830 | regardless of which switch is active, the ARP monitor has a suitable |
| 1831 | target to query. |
| 1832 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1833 | Note, also, that of late many switches now support a functionality |
| 1834 | generally referred to as "trunk failover." This is a feature of the |
| 1835 | switch that causes the link state of a particular switch port to be set |
| 1836 | down (or up) when the state of another switch port goes down (or up). |
Matt LaPlante | 19f5946 | 2009-04-27 15:06:31 +0200 | [diff] [blame] | 1837 | Its purpose is to propagate link failures from logically "exterior" ports |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1838 | to the logically "interior" ports that bonding is able to monitor via |
| 1839 | miimon. Availability and configuration for trunk failover varies by |
| 1840 | switch, but this can be a viable alternative to the ARP monitor when using |
| 1841 | suitable switches. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1842 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1843 | 12. Configuring Bonding for Maximum Throughput |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1844 | ============================================== |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1845 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1846 | 12.1 Maximizing Throughput in a Single Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1847 | ------------------------------------------------------ |
| 1848 | |
| 1849 | In a single switch configuration, the best method to maximize |
| 1850 | throughput depends upon the application and network environment. The |
| 1851 | various load balancing modes each have strengths and weaknesses in |
| 1852 | different environments, as detailed below. |
| 1853 | |
| 1854 | For this discussion, we will break down the topologies into |
| 1855 | two categories. Depending upon the destination of most traffic, we |
| 1856 | categorize them into either "gatewayed" or "local" configurations. |
| 1857 | |
| 1858 | In a gatewayed configuration, the "switch" is acting primarily |
| 1859 | as a router, and the majority of traffic passes through this router to |
| 1860 | other networks. An example would be the following: |
| 1861 | |
| 1862 | |
| 1863 | +----------+ +----------+ |
| 1864 | | |eth0 port1| | to other networks |
| 1865 | | Host A +---------------------+ router +-------------------> |
| 1866 | | +---------------------+ | Hosts B and C are out |
| 1867 | | |eth1 port2| | here somewhere |
| 1868 | +----------+ +----------+ |
| 1869 | |
| 1870 | The router may be a dedicated router device, or another host |
| 1871 | acting as a gateway. For our discussion, the important point is that |
| 1872 | the majority of traffic from Host A will pass through the router to |
| 1873 | some other network before reaching its final destination. |
| 1874 | |
| 1875 | In a gatewayed network configuration, although Host A may |
| 1876 | communicate with many other systems, all of its traffic will be sent |
| 1877 | and received via one other peer on the local network, the router. |
| 1878 | |
| 1879 | Note that the case of two systems connected directly via |
| 1880 | multiple physical links is, for purposes of configuring bonding, the |
| 1881 | same as a gatewayed configuration. In that case, it happens that all |
| 1882 | traffic is destined for the "gateway" itself, not some other network |
| 1883 | beyond the gateway. |
| 1884 | |
| 1885 | In a local configuration, the "switch" is acting primarily as |
| 1886 | a switch, and the majority of traffic passes through this switch to |
| 1887 | reach other stations on the same network. An example would be the |
| 1888 | following: |
| 1889 | |
| 1890 | +----------+ +----------+ +--------+ |
| 1891 | | |eth0 port1| +-------+ Host B | |
| 1892 | | Host A +------------+ switch |port3 +--------+ |
| 1893 | | +------------+ | +--------+ |
| 1894 | | |eth1 port2| +------------------+ Host C | |
| 1895 | +----------+ +----------+port4 +--------+ |
| 1896 | |
| 1897 | |
| 1898 | Again, the switch may be a dedicated switch device, or another |
| 1899 | host acting as a gateway. For our discussion, the important point is |
| 1900 | that the majority of traffic from Host A is destined for other hosts |
| 1901 | on the same local network (Hosts B and C in the above example). |
| 1902 | |
| 1903 | In summary, in a gatewayed configuration, traffic to and from |
| 1904 | the bonded device will be to the same MAC level peer on the network |
| 1905 | (the gateway itself, i.e., the router), regardless of its final |
| 1906 | destination. In a local configuration, traffic flows directly to and |
| 1907 | from the final destinations, thus, each destination (Host B, Host C) |
| 1908 | will be addressed directly by their individual MAC addresses. |
| 1909 | |
| 1910 | This distinction between a gatewayed and a local network |
| 1911 | configuration is important because many of the load balancing modes |
| 1912 | available use the MAC addresses of the local network source and |
| 1913 | destination to make load balancing decisions. The behavior of each |
| 1914 | mode is described below. |
| 1915 | |
| 1916 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 1917 | 12.1.1 MT Bonding Mode Selection for Single Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1918 | ----------------------------------------------------------- |
| 1919 | |
| 1920 | This configuration is the easiest to set up and to understand, |
| 1921 | although you will have to decide which bonding mode best suits your |
| 1922 | needs. The trade offs for each mode are detailed below: |
| 1923 | |
| 1924 | balance-rr: This mode is the only mode that will permit a single |
| 1925 | TCP/IP connection to stripe traffic across multiple |
| 1926 | interfaces. It is therefore the only mode that will allow a |
| 1927 | single TCP/IP stream to utilize more than one interface's |
| 1928 | worth of throughput. This comes at a cost, however: the |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1929 | striping generally results in peer systems receiving packets out |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1930 | of order, causing TCP/IP's congestion control system to kick |
| 1931 | in, often by retransmitting segments. |
| 1932 | |
| 1933 | It is possible to adjust TCP/IP's congestion limits by |
| 1934 | altering the net.ipv4.tcp_reordering sysctl parameter. The |
| 1935 | usual default value is 3, and the maximum useful value is 127. |
| 1936 | For a four interface balance-rr bond, expect that a single |
| 1937 | TCP/IP stream will utilize no more than approximately 2.3 |
| 1938 | interface's worth of throughput, even after adjusting |
| 1939 | tcp_reordering. |
| 1940 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 1941 | Note that the fraction of packets that will be delivered out of |
| 1942 | order is highly variable, and is unlikely to be zero. The level |
| 1943 | of reordering depends upon a variety of factors, including the |
| 1944 | networking interfaces, the switch, and the topology of the |
| 1945 | configuration. Speaking in general terms, higher speed network |
| 1946 | cards produce more reordering (due to factors such as packet |
| 1947 | coalescing), and a "many to many" topology will reorder at a |
| 1948 | higher rate than a "many slow to one fast" configuration. |
| 1949 | |
| 1950 | Many switches do not support any modes that stripe traffic |
| 1951 | (instead choosing a port based upon IP or MAC level addresses); |
| 1952 | for those devices, traffic for a particular connection flowing |
| 1953 | through the switch to a balance-rr bond will not utilize greater |
| 1954 | than one interface's worth of bandwidth. |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 1955 | |
| 1956 | If you are utilizing protocols other than TCP/IP, UDP for |
| 1957 | example, and your application can tolerate out of order |
| 1958 | delivery, then this mode can allow for single stream datagram |
| 1959 | performance that scales near linearly as interfaces are added |
| 1960 | to the bond. |
| 1961 | |
| 1962 | This mode requires the switch to have the appropriate ports |
| 1963 | configured for "etherchannel" or "trunking." |
| 1964 | |
| 1965 | active-backup: There is not much advantage in this network topology to |
| 1966 | the active-backup mode, as the inactive backup devices are all |
| 1967 | connected to the same peer as the primary. In this case, a |
| 1968 | load balancing mode (with link monitoring) will provide the |
| 1969 | same level of network availability, but with increased |
| 1970 | available bandwidth. On the plus side, active-backup mode |
| 1971 | does not require any configuration of the switch, so it may |
| 1972 | have value if the hardware available does not support any of |
| 1973 | the load balance modes. |
| 1974 | |
| 1975 | balance-xor: This mode will limit traffic such that packets destined |
| 1976 | for specific peers will always be sent over the same |
| 1977 | interface. Since the destination is determined by the MAC |
| 1978 | addresses involved, this mode works best in a "local" network |
| 1979 | configuration (as described above), with destinations all on |
| 1980 | the same local network. This mode is likely to be suboptimal |
| 1981 | if all your traffic is passed through a single router (i.e., a |
| 1982 | "gatewayed" network configuration, as described above). |
| 1983 | |
| 1984 | As with balance-rr, the switch ports need to be configured for |
| 1985 | "etherchannel" or "trunking." |
| 1986 | |
| 1987 | broadcast: Like active-backup, there is not much advantage to this |
| 1988 | mode in this type of network topology. |
| 1989 | |
| 1990 | 802.3ad: This mode can be a good choice for this type of network |
| 1991 | topology. The 802.3ad mode is an IEEE standard, so all peers |
| 1992 | that implement 802.3ad should interoperate well. The 802.3ad |
| 1993 | protocol includes automatic configuration of the aggregates, |
| 1994 | so minimal manual configuration of the switch is needed |
| 1995 | (typically only to designate that some set of devices is |
| 1996 | available for 802.3ad). The 802.3ad standard also mandates |
| 1997 | that frames be delivered in order (within certain limits), so |
| 1998 | in general single connections will not see misordering of |
| 1999 | packets. The 802.3ad mode does have some drawbacks: the |
| 2000 | standard mandates that all devices in the aggregate operate at |
| 2001 | the same speed and duplex. Also, as with all bonding load |
| 2002 | balance modes other than balance-rr, no single connection will |
| 2003 | be able to utilize more than a single interface's worth of |
| 2004 | bandwidth. |
| 2005 | |
| 2006 | Additionally, the linux bonding 802.3ad implementation |
| 2007 | distributes traffic by peer (using an XOR of MAC addresses), |
| 2008 | so in a "gatewayed" configuration, all outgoing traffic will |
| 2009 | generally use the same device. Incoming traffic may also end |
| 2010 | up on a single device, but that is dependent upon the |
| 2011 | balancing policy of the peer's 8023.ad implementation. In a |
| 2012 | "local" configuration, traffic will be distributed across the |
| 2013 | devices in the bond. |
| 2014 | |
| 2015 | Finally, the 802.3ad mode mandates the use of the MII monitor, |
| 2016 | therefore, the ARP monitor is not available in this mode. |
| 2017 | |
| 2018 | balance-tlb: The balance-tlb mode balances outgoing traffic by peer. |
| 2019 | Since the balancing is done according to MAC address, in a |
| 2020 | "gatewayed" configuration (as described above), this mode will |
| 2021 | send all traffic across a single device. However, in a |
| 2022 | "local" network configuration, this mode balances multiple |
| 2023 | local network peers across devices in a vaguely intelligent |
| 2024 | manner (not a simple XOR as in balance-xor or 802.3ad mode), |
| 2025 | so that mathematically unlucky MAC addresses (i.e., ones that |
| 2026 | XOR to the same value) will not all "bunch up" on a single |
| 2027 | interface. |
| 2028 | |
| 2029 | Unlike 802.3ad, interfaces may be of differing speeds, and no |
| 2030 | special switch configuration is required. On the down side, |
| 2031 | in this mode all incoming traffic arrives over a single |
| 2032 | interface, this mode requires certain ethtool support in the |
| 2033 | network device driver of the slave interfaces, and the ARP |
| 2034 | monitor is not available. |
| 2035 | |
| 2036 | balance-alb: This mode is everything that balance-tlb is, and more. |
| 2037 | It has all of the features (and restrictions) of balance-tlb, |
| 2038 | and will also balance incoming traffic from local network |
| 2039 | peers (as described in the Bonding Module Options section, |
| 2040 | above). |
| 2041 | |
| 2042 | The only additional down side to this mode is that the network |
| 2043 | device driver must support changing the hardware address while |
| 2044 | the device is open. |
| 2045 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2046 | 12.1.2 MT Link Monitoring for Single Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2047 | ---------------------------------------------------- |
| 2048 | |
| 2049 | The choice of link monitoring may largely depend upon which |
| 2050 | mode you choose to use. The more advanced load balancing modes do not |
| 2051 | support the use of the ARP monitor, and are thus restricted to using |
| 2052 | the MII monitor (which does not provide as high a level of end to end |
| 2053 | assurance as the ARP monitor). |
| 2054 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2055 | 12.2 Maximum Throughput in a Multiple Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2056 | ----------------------------------------------------- |
| 2057 | |
| 2058 | Multiple switches may be utilized to optimize for throughput |
| 2059 | when they are configured in parallel as part of an isolated network |
| 2060 | between two or more systems, for example: |
| 2061 | |
| 2062 | +-----------+ |
| 2063 | | Host A | |
| 2064 | +-+---+---+-+ |
| 2065 | | | | |
| 2066 | +--------+ | +---------+ |
| 2067 | | | | |
| 2068 | +------+---+ +-----+----+ +-----+----+ |
| 2069 | | Switch A | | Switch B | | Switch C | |
| 2070 | +------+---+ +-----+----+ +-----+----+ |
| 2071 | | | | |
| 2072 | +--------+ | +---------+ |
| 2073 | | | | |
| 2074 | +-+---+---+-+ |
| 2075 | | Host B | |
| 2076 | +-----------+ |
| 2077 | |
| 2078 | In this configuration, the switches are isolated from one |
| 2079 | another. One reason to employ a topology such as this is for an |
| 2080 | isolated network with many hosts (a cluster configured for high |
| 2081 | performance, for example), using multiple smaller switches can be more |
| 2082 | cost effective than a single larger switch, e.g., on a network with 24 |
| 2083 | hosts, three 24 port switches can be significantly less expensive than |
| 2084 | a single 72 port switch. |
| 2085 | |
| 2086 | If access beyond the network is required, an individual host |
| 2087 | can be equipped with an additional network device connected to an |
| 2088 | external network; this host then additionally acts as a gateway. |
| 2089 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2090 | 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2091 | ------------------------------------------------------------- |
| 2092 | |
| 2093 | In actual practice, the bonding mode typically employed in |
| 2094 | configurations of this type is balance-rr. Historically, in this |
| 2095 | network configuration, the usual caveats about out of order packet |
| 2096 | delivery are mitigated by the use of network adapters that do not do |
| 2097 | any kind of packet coalescing (via the use of NAPI, or because the |
| 2098 | device itself does not generate interrupts until some number of |
| 2099 | packets has arrived). When employed in this fashion, the balance-rr |
| 2100 | mode allows individual connections between two hosts to effectively |
| 2101 | utilize greater than one interface's bandwidth. |
| 2102 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2103 | 12.2.2 MT Link Monitoring for Multiple Switch Topology |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2104 | ------------------------------------------------------ |
| 2105 | |
| 2106 | Again, in actual practice, the MII monitor is most often used |
| 2107 | in this configuration, as performance is given preference over |
| 2108 | availability. The ARP monitor will function in this topology, but its |
| 2109 | advantages over the MII monitor are mitigated by the volume of probes |
| 2110 | needed as the number of systems involved grows (remember that each |
| 2111 | host in the network is configured with bonding). |
| 2112 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2113 | 13. Switch Behavior Issues |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2114 | ========================== |
| 2115 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2116 | 13.1 Link Establishment and Failover Delays |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2117 | ------------------------------------------- |
| 2118 | |
| 2119 | Some switches exhibit undesirable behavior with regard to the |
| 2120 | timing of link up and down reporting by the switch. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2121 | |
| 2122 | First, when a link comes up, some switches may indicate that |
| 2123 | the link is up (carrier available), but not pass traffic over the |
| 2124 | interface for some period of time. This delay is typically due to |
| 2125 | some type of autonegotiation or routing protocol, but may also occur |
| 2126 | during switch initialization (e.g., during recovery after a switch |
| 2127 | failure). If you find this to be a problem, specify an appropriate |
| 2128 | value to the updelay bonding module option to delay the use of the |
| 2129 | relevant interface(s). |
| 2130 | |
| 2131 | Second, some switches may "bounce" the link state one or more |
| 2132 | times while a link is changing state. This occurs most commonly while |
| 2133 | the switch is initializing. Again, an appropriate updelay value may |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2134 | help. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2135 | |
| 2136 | Note that when a bonding interface has no active links, the |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2137 | driver will immediately reuse the first link that goes up, even if the |
| 2138 | updelay parameter has been specified (the updelay is ignored in this |
| 2139 | case). If there are slave interfaces waiting for the updelay timeout |
| 2140 | to expire, the interface that first went into that state will be |
| 2141 | immediately reused. This reduces down time of the network if the |
| 2142 | value of updelay has been overestimated, and since this occurs only in |
| 2143 | cases with no connectivity, there is no additional penalty for |
| 2144 | ignoring the updelay. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2145 | |
| 2146 | In addition to the concerns about switch timings, if your |
| 2147 | switches take a long time to go into backup mode, it may be desirable |
| 2148 | to not activate a backup interface immediately after a link goes down. |
| 2149 | Failover may be delayed via the downdelay bonding module option. |
| 2150 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2151 | 13.2 Duplicated Incoming Packets |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2152 | -------------------------------- |
| 2153 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 2154 | NOTE: Starting with version 3.0.2, the bonding driver has logic to |
| 2155 | suppress duplicate packets, which should largely eliminate this problem. |
| 2156 | The following description is kept for reference. |
| 2157 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2158 | It is not uncommon to observe a short burst of duplicated |
| 2159 | traffic when the bonding device is first used, or after it has been |
| 2160 | idle for some period of time. This is most easily observed by issuing |
| 2161 | a "ping" to some other host on the network, and noticing that the |
| 2162 | output from ping flags duplicates (typically one per slave). |
| 2163 | |
| 2164 | For example, on a bond in active-backup mode with five slaves |
| 2165 | all connected to one switch, the output may appear as follows: |
| 2166 | |
| 2167 | # ping -n 10.0.4.2 |
| 2168 | PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data. |
| 2169 | 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms |
| 2170 | 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!) |
| 2171 | 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!) |
| 2172 | 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!) |
| 2173 | 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!) |
| 2174 | 64 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms |
| 2175 | 64 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms |
| 2176 | 64 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms |
| 2177 | |
| 2178 | This is not due to an error in the bonding driver, rather, it |
| 2179 | is a side effect of how many switches update their MAC forwarding |
| 2180 | tables. Initially, the switch does not associate the MAC address in |
| 2181 | the packet with a particular switch port, and so it may send the |
| 2182 | traffic to all ports until its MAC forwarding table is updated. Since |
| 2183 | the interfaces attached to the bond may occupy multiple ports on a |
| 2184 | single switch, when the switch (temporarily) floods the traffic to all |
| 2185 | ports, the bond device receives multiple copies of the same packet |
| 2186 | (one per slave device). |
| 2187 | |
| 2188 | The duplicated packet behavior is switch dependent, some |
| 2189 | switches exhibit this, and some do not. On switches that display this |
| 2190 | behavior, it can be induced by clearing the MAC forwarding table (on |
| 2191 | most Cisco switches, the privileged command "clear mac address-table |
| 2192 | dynamic" will accomplish this). |
| 2193 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2194 | 14. Hardware Specific Considerations |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2195 | ==================================== |
| 2196 | |
| 2197 | This section contains additional information for configuring |
| 2198 | bonding on specific hardware platforms, or for interfacing bonding |
| 2199 | with particular switches or other devices. |
| 2200 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2201 | 14.1 IBM BladeCenter |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2202 | -------------------- |
| 2203 | |
| 2204 | This applies to the JS20 and similar systems. |
| 2205 | |
| 2206 | On the JS20 blades, the bonding driver supports only |
| 2207 | balance-rr, active-backup, balance-tlb and balance-alb modes. This is |
| 2208 | largely due to the network topology inside the BladeCenter, detailed |
| 2209 | below. |
| 2210 | |
| 2211 | JS20 network adapter information |
| 2212 | -------------------------------- |
| 2213 | |
| 2214 | All JS20s come with two Broadcom Gigabit Ethernet ports |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2215 | integrated on the planar (that's "motherboard" in IBM-speak). In the |
| 2216 | BladeCenter chassis, the eth0 port of all JS20 blades is hard wired to |
| 2217 | I/O Module #1; similarly, all eth1 ports are wired to I/O Module #2. |
| 2218 | An add-on Broadcom daughter card can be installed on a JS20 to provide |
| 2219 | two more Gigabit Ethernet ports. These ports, eth2 and eth3, are |
| 2220 | wired to I/O Modules 3 and 4, respectively. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2221 | |
| 2222 | Each I/O Module may contain either a switch or a passthrough |
| 2223 | module (which allows ports to be directly connected to an external |
| 2224 | switch). Some bonding modes require a specific BladeCenter internal |
| 2225 | network topology in order to function; these are detailed below. |
| 2226 | |
| 2227 | Additional BladeCenter-specific networking information can be |
| 2228 | found in two IBM Redbooks (www.ibm.com/redbooks): |
| 2229 | |
| 2230 | "IBM eServer BladeCenter Networking Options" |
| 2231 | "IBM eServer BladeCenter Layer 2-7 Network Switching" |
| 2232 | |
| 2233 | BladeCenter networking configuration |
| 2234 | ------------------------------------ |
| 2235 | |
| 2236 | Because a BladeCenter can be configured in a very large number |
| 2237 | of ways, this discussion will be confined to describing basic |
| 2238 | configurations. |
| 2239 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2240 | Normally, Ethernet Switch Modules (ESMs) are used in I/O |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2241 | modules 1 and 2. In this configuration, the eth0 and eth1 ports of a |
| 2242 | JS20 will be connected to different internal switches (in the |
| 2243 | respective I/O modules). |
| 2244 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2245 | A passthrough module (OPM or CPM, optical or copper, |
| 2246 | passthrough module) connects the I/O module directly to an external |
| 2247 | switch. By using PMs in I/O module #1 and #2, the eth0 and eth1 |
| 2248 | interfaces of a JS20 can be redirected to the outside world and |
| 2249 | connected to a common external switch. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2250 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2251 | Depending upon the mix of ESMs and PMs, the network will |
| 2252 | appear to bonding as either a single switch topology (all PMs) or as a |
| 2253 | multiple switch topology (one or more ESMs, zero or more PMs). It is |
| 2254 | also possible to connect ESMs together, resulting in a configuration |
| 2255 | much like the example in "High Availability in a Multiple Switch |
| 2256 | Topology," above. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2257 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2258 | Requirements for specific modes |
| 2259 | ------------------------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2260 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2261 | The balance-rr mode requires the use of passthrough modules |
| 2262 | for devices in the bond, all connected to an common external switch. |
| 2263 | That switch must be configured for "etherchannel" or "trunking" on the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2264 | appropriate ports, as is usual for balance-rr. |
| 2265 | |
| 2266 | The balance-alb and balance-tlb modes will function with |
| 2267 | either switch modules or passthrough modules (or a mix). The only |
| 2268 | specific requirement for these modes is that all network interfaces |
| 2269 | must be able to reach all destinations for traffic sent over the |
| 2270 | bonding device (i.e., the network must converge at some point outside |
| 2271 | the BladeCenter). |
| 2272 | |
| 2273 | The active-backup mode has no additional requirements. |
| 2274 | |
| 2275 | Link monitoring issues |
| 2276 | ---------------------- |
| 2277 | |
| 2278 | When an Ethernet Switch Module is in place, only the ARP |
| 2279 | monitor will reliably detect link loss to an external switch. This is |
| 2280 | nothing unusual, but examination of the BladeCenter cabinet would |
| 2281 | suggest that the "external" network ports are the ethernet ports for |
| 2282 | the system, when it fact there is a switch between these "external" |
| 2283 | ports and the devices on the JS20 system itself. The MII monitor is |
| 2284 | only able to detect link failures between the ESM and the JS20 system. |
| 2285 | |
| 2286 | When a passthrough module is in place, the MII monitor does |
| 2287 | detect failures to the "external" port, which is then directly |
| 2288 | connected to the JS20 system. |
| 2289 | |
| 2290 | Other concerns |
| 2291 | -------------- |
| 2292 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2293 | The Serial Over LAN (SoL) link is established over the primary |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2294 | ethernet (eth0) only, therefore, any loss of link to eth0 will result |
| 2295 | in losing your SoL connection. It will not fail over with other |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2296 | network traffic, as the SoL system is beyond the control of the |
| 2297 | bonding driver. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2298 | |
| 2299 | It may be desirable to disable spanning tree on the switch |
| 2300 | (either the internal Ethernet Switch Module, or an external switch) to |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2301 | avoid fail-over delay issues when using bonding. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2302 | |
| 2303 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2304 | 15. Frequently Asked Questions |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | ============================== |
| 2306 | |
| 2307 | 1. Is it SMP safe? |
| 2308 | |
| 2309 | Yes. The old 2.0.xx channel bonding patch was not SMP safe. |
| 2310 | The new driver was designed to be SMP safe from the start. |
| 2311 | |
| 2312 | 2. What type of cards will work with it? |
| 2313 | |
| 2314 | Any Ethernet type cards (you can even mix cards - a Intel |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2315 | EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes, |
| 2316 | devices need not be of the same speed. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2317 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 2318 | Starting with version 3.2.1, bonding also supports Infiniband |
| 2319 | slaves in active-backup mode. |
| 2320 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2321 | 3. How many bonding devices can I have? |
| 2322 | |
| 2323 | There is no limit. |
| 2324 | |
| 2325 | 4. How many slaves can a bonding device have? |
| 2326 | |
| 2327 | This is limited only by the number of network interfaces Linux |
| 2328 | supports and/or the number of network cards you can place in your |
| 2329 | system. |
| 2330 | |
| 2331 | 5. What happens when a slave link dies? |
| 2332 | |
| 2333 | If link monitoring is enabled, then the failing device will be |
| 2334 | disabled. The active-backup mode will fail over to a backup link, and |
| 2335 | other modes will ignore the failed link. The link will continue to be |
| 2336 | monitored, and should it recover, it will rejoin the bond (in whatever |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2337 | manner is appropriate for the mode). See the sections on High |
| 2338 | Availability and the documentation for each mode for additional |
| 2339 | information. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2340 | |
| 2341 | Link monitoring can be enabled via either the miimon or |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2342 | arp_interval parameters (described in the module parameters section, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2343 | above). In general, miimon monitors the carrier state as sensed by |
| 2344 | the underlying network device, and the arp monitor (arp_interval) |
| 2345 | monitors connectivity to another host on the local network. |
| 2346 | |
| 2347 | If no link monitoring is configured, the bonding driver will |
| 2348 | be unable to detect link failures, and will assume that all links are |
| 2349 | always available. This will likely result in lost packets, and a |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2350 | resulting degradation of performance. The precise performance loss |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2351 | depends upon the bonding mode and network configuration. |
| 2352 | |
| 2353 | 6. Can bonding be used for High Availability? |
| 2354 | |
| 2355 | Yes. See the section on High Availability for details. |
| 2356 | |
| 2357 | 7. Which switches/systems does it work with? |
| 2358 | |
| 2359 | The full answer to this depends upon the desired mode. |
| 2360 | |
| 2361 | In the basic balance modes (balance-rr and balance-xor), it |
| 2362 | works with any system that supports etherchannel (also called |
| 2363 | trunking). Most managed switches currently available have such |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2364 | support, and many unmanaged switches as well. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2365 | |
| 2366 | The advanced balance modes (balance-tlb and balance-alb) do |
| 2367 | not have special switch requirements, but do need device drivers that |
| 2368 | support specific features (described in the appropriate section under |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2369 | module parameters, above). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2370 | |
Auke Kok | 6224e01 | 2006-06-08 11:15:35 -0700 | [diff] [blame] | 2371 | In 802.3ad mode, it works with systems that support IEEE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2372 | 802.3ad Dynamic Link Aggregation. Most managed and many unmanaged |
| 2373 | switches currently available support 802.3ad. |
| 2374 | |
| 2375 | The active-backup mode should work with any Layer-II switch. |
| 2376 | |
| 2377 | 8. Where does a bonding device get its MAC address from? |
| 2378 | |
Jay Vosburgh | 9a6c686 | 2007-11-13 20:25:48 -0800 | [diff] [blame] | 2379 | When using slave devices that have fixed MAC addresses, or when |
| 2380 | the fail_over_mac option is enabled, the bonding device's MAC address is |
| 2381 | the MAC address of the active slave. |
| 2382 | |
| 2383 | For other configurations, if not explicitly configured (with |
| 2384 | ifconfig or ip link), the MAC address of the bonding device is taken from |
| 2385 | its first slave device. This MAC address is then passed to all following |
| 2386 | slaves and remains persistent (even if the first slave is removed) until |
| 2387 | the bonding device is brought down or reconfigured. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2388 | |
| 2389 | If you wish to change the MAC address, you can set it with |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2390 | ifconfig or ip link: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | |
| 2392 | # ifconfig bond0 hw ether 00:11:22:33:44:55 |
| 2393 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2394 | # ip link set bond0 address 66:77:88:99:aa:bb |
| 2395 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2396 | The MAC address can be also changed by bringing down/up the |
| 2397 | device and then changing its slaves (or their order): |
| 2398 | |
| 2399 | # ifconfig bond0 down ; modprobe -r bonding |
| 2400 | # ifconfig bond0 .... up |
| 2401 | # ifenslave bond0 eth... |
| 2402 | |
| 2403 | This method will automatically take the address from the next |
| 2404 | slave that is added. |
| 2405 | |
| 2406 | To restore your slaves' MAC addresses, you need to detach them |
| 2407 | from the bond (`ifenslave -d bond0 eth0'). The bonding driver will |
| 2408 | then restore the MAC addresses that the slaves had before they were |
| 2409 | enslaved. |
| 2410 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2411 | 16. Resources and Links |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | ======================= |
| 2413 | |
| 2414 | The latest version of the bonding driver can be found in the latest |
| 2415 | version of the linux kernel, found on http://kernel.org |
| 2416 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2417 | The latest version of this document can be found in either the latest |
| 2418 | kernel source (named Documentation/networking/bonding.txt), or on the |
| 2419 | bonding sourceforge site: |
| 2420 | |
| 2421 | http://www.sourceforge.net/projects/bonding |
| 2422 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2423 | Discussions regarding the bonding driver take place primarily on the |
| 2424 | bonding-devel mailing list, hosted at sourceforge.net. If you have |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2425 | questions or problems, post them to the list. The list address is: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2426 | |
| 2427 | bonding-devel@lists.sourceforge.net |
| 2428 | |
Jay Vosburgh | 00354cf | 2005-07-21 12:18:02 -0700 | [diff] [blame] | 2429 | The administrative interface (to subscribe or unsubscribe) can |
| 2430 | be found at: |
| 2431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2432 | https://lists.sourceforge.net/lists/listinfo/bonding-devel |
| 2433 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2434 | Donald Becker's Ethernet Drivers and diag programs may be found at : |
| 2435 | - http://www.scyld.com/network/ |
| 2436 | |
| 2437 | You will also find a lot of information regarding Ethernet, NWay, MII, |
| 2438 | etc. at www.scyld.com. |
| 2439 | |
| 2440 | -- END -- |