bonding.txt 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618
  1. Linux Ethernet Bonding Driver HOWTO
  2. Initial release : Thomas Davis <tadavis at lbl.gov>
  3. Corrections, HA extensions : 2000/10/03-15 :
  4. - Willy Tarreau <willy at meta-x.org>
  5. - Constantine Gavrilov <const-g at xpert.com>
  6. - Chad N. Tindel <ctindel at ieee dot org>
  7. - Janice Girouard <girouard at us dot ibm dot com>
  8. - Jay Vosburgh <fubar at us dot ibm dot com>
  9. Reorganized and updated Feb 2005 by Jay Vosburgh
  10. Note :
  11. ------
  12. The bonding driver originally came from Donald Becker's beowulf patches for
  13. kernel 2.0. It has changed quite a bit since, and the original tools from
  14. extreme-linux and beowulf sites will not work with this version of the driver.
  15. For new versions of the driver, patches for older kernels and the updated
  16. userspace tools, please follow the links at the end of this file.
  17. Table of Contents
  18. =================
  19. 1. Bonding Driver Installation
  20. 2. Bonding Driver Options
  21. 3. Configuring Bonding Devices
  22. 3.1 Configuration with sysconfig support
  23. 3.2 Configuration with initscripts support
  24. 3.3 Configuring Bonding Manually
  25. 3.4 Configuring Multiple Bonds
  26. 5. Querying Bonding Configuration
  27. 5.1 Bonding Configuration
  28. 5.2 Network Configuration
  29. 6. Switch Configuration
  30. 7. 802.1q VLAN Support
  31. 8. Link Monitoring
  32. 8.1 ARP Monitor Operation
  33. 8.2 Configuring Multiple ARP Targets
  34. 8.3 MII Monitor Operation
  35. 9. Potential Trouble Sources
  36. 9.1 Adventures in Routing
  37. 9.2 Ethernet Device Renaming
  38. 9.3 Painfully Slow Or No Failed Link Detection By Miimon
  39. 10. SNMP agents
  40. 11. Promiscuous mode
  41. 12. High Availability Information
  42. 12.1 High Availability in a Single Switch Topology
  43. 12.1.1 Bonding Mode Selection for Single Switch Topology
  44. 12.1.2 Link Monitoring for Single Switch Topology
  45. 12.2 High Availability in a Multiple Switch Topology
  46. 12.2.1 Bonding Mode Selection for Multiple Switch Topology
  47. 12.2.2 Link Monitoring for Multiple Switch Topology
  48. 12.3 Switch Behavior Issues for High Availability
  49. 13. Hardware Specific Considerations
  50. 13.1 IBM BladeCenter
  51. 14. Frequently Asked Questions
  52. 15. Resources and Links
  53. 1. Bonding Driver Installation
  54. ==============================
  55. Most popular distro kernels ship with the bonding driver
  56. already available as a module and the ifenslave user level control
  57. program installed and ready for use. If your distro does not, or you
  58. have need to compile bonding from source (e.g., configuring and
  59. installing a mainline kernel from kernel.org), you'll need to perform
  60. the following steps:
  61. 1.1 Configure and build the kernel with bonding
  62. -----------------------------------------------
  63. The latest version of the bonding driver is available in the
  64. drivers/net/bonding subdirectory of the most recent kernel source
  65. (which is available on http://kernel.org).
  66. Prior to the 2.4.11 kernel, the bonding driver was maintained
  67. largely outside the kernel tree; patches for some earlier kernels are
  68. available on the bonding sourceforge site, although those patches are
  69. still several years out of date. Most users will want to use either
  70. the most recent kernel from kernel.org or whatever kernel came with
  71. their distro.
  72. Configure kernel with "make menuconfig" (or "make xconfig" or
  73. "make config"), then select "Bonding driver support" in the "Network
  74. device support" section. It is recommended that you configure the
  75. driver as module since it is currently the only way to pass parameters
  76. to the driver or configure more than one bonding device.
  77. Build and install the new kernel and modules, then proceed to
  78. step 2.
  79. 1.2 Install ifenslave Control Utility
  80. -------------------------------------
  81. The ifenslave user level control program is included in the
  82. kernel source tree, in the file Documentation/networking/ifenslave.c.
  83. It is generally recommended that you use the ifenslave that
  84. corresponds to the kernel that you are using (either from the same
  85. source tree or supplied with the distro), however, ifenslave
  86. executables from older kernels should function (but features newer
  87. than the ifenslave release are not supported). Running an ifenslave
  88. that is newer than the kernel is not supported, and may or may not
  89. work.
  90. To install ifenslave, do the following:
  91. # gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
  92. # cp ifenslave /sbin/ifenslave
  93. If your kernel source is not in "/usr/src/linux," then replace
  94. "/usr/src/linux/include" in the above with the location of your kernel
  95. source include directory.
  96. You may wish to back up any existing /sbin/ifenslave, or, for
  97. testing or informal use, tag the ifenslave to the kernel version
  98. (e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
  99. IMPORTANT NOTE:
  100. If you omit the "-I" or specify an incorrect directory, you
  101. may end up with an ifenslave that is incompatible with the kernel
  102. you're trying to build it for. Some distros (e.g., Red Hat from 7.1
  103. onwards) do not have /usr/include/linux symbolically linked to the
  104. default kernel source include directory.
  105. 2. Bonding Driver Options
  106. =========================
  107. Options for the bonding driver are supplied as parameters to
  108. the bonding module at load time. They may be given as command line
  109. arguments to the insmod or modprobe command, but are usually specified
  110. in either the /etc/modprobe.conf configuration file, or in a
  111. distro-specific configuration file (some of which are detailed in the
  112. next section).
  113. The available bonding driver parameters are listed below. If a
  114. parameter is not specified the default value is used. When initially
  115. configuring a bond, it is recommended "tail -f /var/log/messages" be
  116. run in a separate window to watch for bonding driver error messages.
  117. It is critical that either the miimon or arp_interval and
  118. arp_ip_target parameters be specified, otherwise serious network
  119. degradation will occur during link failures. Very few devices do not
  120. support at least miimon, so there is really no reason not to use it.
  121. Options with textual values will accept either the text name
  122. or, for backwards compatibility, the option value. E.g.,
  123. "mode=802.3ad" and "mode=4" set the same mode.
  124. The parameters are as follows:
  125. arp_interval
  126. Specifies the ARP monitoring frequency in milli-seconds. If
  127. ARP monitoring is used in a load-balancing mode (mode 0 or 2),
  128. the switch should be configured in a mode that evenly
  129. distributes packets across all links - such as round-robin. If
  130. the switch is configured to distribute the packets in an XOR
  131. fashion, all replies from the ARP targets will be received on
  132. the same link which could cause the other team members to
  133. fail. ARP monitoring should not be used in conjunction with
  134. miimon. A value of 0 disables ARP monitoring. The default
  135. value is 0.
  136. arp_ip_target
  137. Specifies the ip addresses to use when arp_interval is > 0.
  138. These are the targets of the ARP request sent to determine the
  139. health of the link to the targets. Specify these values in
  140. ddd.ddd.ddd.ddd format. Multiple ip adresses must be
  141. seperated by a comma. At least one IP address must be given
  142. for ARP monitoring to function. The maximum number of targets
  143. that can be specified is 16. The default value is no IP
  144. addresses.
  145. downdelay
  146. Specifies the time, in milliseconds, to wait before disabling
  147. a slave after a link failure has been detected. This option
  148. is only valid for the miimon link monitor. The downdelay
  149. value should be a multiple of the miimon value; if not, it
  150. will be rounded down to the nearest multiple. The default
  151. value is 0.
  152. lacp_rate
  153. Option specifying the rate in which we'll ask our link partner
  154. to transmit LACPDU packets in 802.3ad mode. Possible values
  155. are:
  156. slow or 0
  157. Request partner to transmit LACPDUs every 30 seconds (default)
  158. fast or 1
  159. Request partner to transmit LACPDUs every 1 second
  160. max_bonds
  161. Specifies the number of bonding devices to create for this
  162. instance of the bonding driver. E.g., if max_bonds is 3, and
  163. the bonding driver is not already loaded, then bond0, bond1
  164. and bond2 will be created. The default value is 1.
  165. miimon
  166. Specifies the frequency in milli-seconds that MII link
  167. monitoring will occur. A value of zero disables MII link
  168. monitoring. A value of 100 is a good starting point. The
  169. use_carrier option, below, affects how the link state is
  170. determined. See the High Availability section for additional
  171. information. The default value is 0.
  172. mode
  173. Specifies one of the bonding policies. The default is
  174. balance-rr (round robin). Possible values are:
  175. balance-rr or 0
  176. Round-robin policy: Transmit packets in sequential
  177. order from the first available slave through the
  178. last. This mode provides load balancing and fault
  179. tolerance.
  180. active-backup or 1
  181. Active-backup policy: Only one slave in the bond is
  182. active. A different slave becomes active if, and only
  183. if, the active slave fails. The bond's MAC address is
  184. externally visible on only one port (network adapter)
  185. to avoid confusing the switch. This mode provides
  186. fault tolerance. The primary option affects the
  187. behavior of this mode.
  188. balance-xor or 2
  189. XOR policy: Transmit based on [(source MAC address
  190. XOR'd with destination MAC address) modulo slave
  191. count]. This selects the same slave for each
  192. destination MAC address. This mode provides load
  193. balancing and fault tolerance.
  194. broadcast or 3
  195. Broadcast policy: transmits everything on all slave
  196. interfaces. This mode provides fault tolerance.
  197. 802.3ad or 4
  198. IEEE 802.3ad Dynamic link aggregation. Creates
  199. aggregation groups that share the same speed and
  200. duplex settings. Utilizes all slaves in the active
  201. aggregator according to the 802.3ad specification.
  202. Pre-requisites:
  203. 1. Ethtool support in the base drivers for retrieving
  204. the speed and duplex of each slave.
  205. 2. A switch that supports IEEE 802.3ad Dynamic link
  206. aggregation.
  207. Most switches will require some type of configuration
  208. to enable 802.3ad mode.
  209. balance-tlb or 5
  210. Adaptive transmit load balancing: channel bonding that
  211. does not require any special switch support. The
  212. outgoing traffic is distributed according to the
  213. current load (computed relative to the speed) on each
  214. slave. Incoming traffic is received by the current
  215. slave. If the receiving slave fails, another slave
  216. takes over the MAC address of the failed receiving
  217. slave.
  218. Prerequisite:
  219. Ethtool support in the base drivers for retrieving the
  220. speed of each slave.
  221. balance-alb or 6
  222. Adaptive load balancing: includes balance-tlb plus
  223. receive load balancing (rlb) for IPV4 traffic, and
  224. does not require any special switch support. The
  225. receive load balancing is achieved by ARP negotiation.
  226. The bonding driver intercepts the ARP Replies sent by
  227. the local system on their way out and overwrites the
  228. source hardware address with the unique hardware
  229. address of one of the slaves in the bond such that
  230. different peers use different hardware addresses for
  231. the server.
  232. Receive traffic from connections created by the server
  233. is also balanced. When the local system sends an ARP
  234. Request the bonding driver copies and saves the peer's
  235. IP information from the ARP packet. When the ARP
  236. Reply arrives from the peer, its hardware address is
  237. retrieved and the bonding driver initiates an ARP
  238. reply to this peer assigning it to one of the slaves
  239. in the bond. A problematic outcome of using ARP
  240. negotiation for balancing is that each time that an
  241. ARP request is broadcast it uses the hardware address
  242. of the bond. Hence, peers learn the hardware address
  243. of the bond and the balancing of receive traffic
  244. collapses to the current slave. This is handled by
  245. sending updates (ARP Replies) to all the peers with
  246. their individually assigned hardware address such that
  247. the traffic is redistributed. Receive traffic is also
  248. redistributed when a new slave is added to the bond
  249. and when an inactive slave is re-activated. The
  250. receive load is distributed sequentially (round robin)
  251. among the group of highest speed slaves in the bond.
  252. When a link is reconnected or a new slave joins the
  253. bond the receive traffic is redistributed among all
  254. active slaves in the bond by intiating ARP Replies
  255. with the selected mac address to each of the
  256. clients. The updelay parameter (detailed below) must
  257. be set to a value equal or greater than the switch's
  258. forwarding delay so that the ARP Replies sent to the
  259. peers will not be blocked by the switch.
  260. Prerequisites:
  261. 1. Ethtool support in the base drivers for retrieving
  262. the speed of each slave.
  263. 2. Base driver support for setting the hardware
  264. address of a device while it is open. This is
  265. required so that there will always be one slave in the
  266. team using the bond hardware address (the
  267. curr_active_slave) while having a unique hardware
  268. address for each slave in the bond. If the
  269. curr_active_slave fails its hardware address is
  270. swapped with the new curr_active_slave that was
  271. chosen.
  272. primary
  273. A string (eth0, eth2, etc) specifying which slave is the
  274. primary device. The specified device will always be the
  275. active slave while it is available. Only when the primary is
  276. off-line will alternate devices be used. This is useful when
  277. one slave is preferred over another, e.g., when one slave has
  278. higher throughput than another.
  279. The primary option is only valid for active-backup mode.
  280. updelay
  281. Specifies the time, in milliseconds, to wait before enabling a
  282. slave after a link recovery has been detected. This option is
  283. only valid for the miimon link monitor. The updelay value
  284. should be a multiple of the miimon value; if not, it will be
  285. rounded down to the nearest multiple. The default value is 0.
  286. use_carrier
  287. Specifies whether or not miimon should use MII or ETHTOOL
  288. ioctls vs. netif_carrier_ok() to determine the link
  289. status. The MII or ETHTOOL ioctls are less efficient and
  290. utilize a deprecated calling sequence within the kernel. The
  291. netif_carrier_ok() relies on the device driver to maintain its
  292. state with netif_carrier_on/off; at this writing, most, but
  293. not all, device drivers support this facility.
  294. If bonding insists that the link is up when it should not be,
  295. it may be that your network device driver does not support
  296. netif_carrier_on/off. The default state for netif_carrier is
  297. "carrier on," so if a driver does not support netif_carrier,
  298. it will appear as if the link is always up. In this case,
  299. setting use_carrier to 0 will cause bonding to revert to the
  300. MII / ETHTOOL ioctl method to determine the link state.
  301. A value of 1 enables the use of netif_carrier_ok(), a value of
  302. 0 will use the deprecated MII / ETHTOOL ioctls. The default
  303. value is 1.
  304. 3. Configuring Bonding Devices
  305. ==============================
  306. There are, essentially, two methods for configuring bonding:
  307. with support from the distro's network initialization scripts, and
  308. without. Distros generally use one of two packages for the network
  309. initialization scripts: initscripts or sysconfig. Recent versions of
  310. these packages have support for bonding, while older versions do not.
  311. We will first describe the options for configuring bonding for
  312. distros using versions of initscripts and sysconfig with full or
  313. partial support for bonding, then provide information on enabling
  314. bonding without support from the network initialization scripts (i.e.,
  315. older versions of initscripts or sysconfig).
  316. If you're unsure whether your distro uses sysconfig or
  317. initscripts, or don't know if it's new enough, have no fear.
  318. Determining this is fairly straightforward.
  319. First, issue the command:
  320. $ rpm -qf /sbin/ifup
  321. It will respond with a line of text starting with either
  322. "initscripts" or "sysconfig," followed by some numbers. This is the
  323. package that provides your network initialization scripts.
  324. Next, to determine if your installation supports bonding,
  325. issue the command:
  326. $ grep ifenslave /sbin/ifup
  327. If this returns any matches, then your initscripts or
  328. sysconfig has support for bonding.
  329. 3.1 Configuration with sysconfig support
  330. ----------------------------------------
  331. This section applies to distros using a version of sysconfig
  332. with bonding support, for example, SuSE Linux Enterprise Server 9.
  333. SuSE SLES 9's networking configuration system does support
  334. bonding, however, at this writing, the YaST system configuration
  335. frontend does not provide any means to work with bonding devices.
  336. Bonding devices can be managed by hand, however, as follows.
  337. First, if they have not already been configured, configure the
  338. slave devices. On SLES 9, this is most easily done by running the
  339. yast2 sysconfig configuration utility. The goal is for to create an
  340. ifcfg-id file for each slave device. The simplest way to accomplish
  341. this is to configure the devices for DHCP. The name of the
  342. configuration file for each device will be of the form:
  343. ifcfg-id-xx:xx:xx:xx:xx:xx
  344. Where the "xx" portion will be replaced with the digits from
  345. the device's permanent MAC address.
  346. Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
  347. created, it is necessary to edit the configuration files for the slave
  348. devices (the MAC addresses correspond to those of the slave devices).
  349. Before editing, the file will contain muliple lines, and will look
  350. something like this:
  351. BOOTPROTO='dhcp'
  352. STARTMODE='on'
  353. USERCTL='no'
  354. UNIQUE='XNzu.WeZGOGF+4wE'
  355. _nm_name='bus-pci-0001:61:01.0'
  356. Change the BOOTPROTO and STARTMODE lines to the following:
  357. BOOTPROTO='none'
  358. STARTMODE='off'
  359. Do not alter the UNIQUE or _nm_name lines. Remove any other
  360. lines (USERCTL, etc).
  361. Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
  362. it's time to create the configuration file for the bonding device
  363. itself. This file is named ifcfg-bondX, where X is the number of the
  364. bonding device to create, starting at 0. The first such file is
  365. ifcfg-bond0, the second is ifcfg-bond1, and so on. The sysconfig
  366. network configuration system will correctly start multiple instances
  367. of bonding.
  368. The contents of the ifcfg-bondX file is as follows:
  369. BOOTPROTO="static"
  370. BROADCAST="10.0.2.255"
  371. IPADDR="10.0.2.10"
  372. NETMASK="255.255.0.0"
  373. NETWORK="10.0.2.0"
  374. REMOTE_IPADDR=""
  375. STARTMODE="onboot"
  376. BONDING_MASTER="yes"
  377. BONDING_MODULE_OPTS="mode=active-backup miimon=100"
  378. BONDING_SLAVE0="eth0"
  379. BONDING_SLAVE1="eth1"
  380. Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
  381. values with the appropriate values for your network.
  382. Note that configuring the bonding device with BOOTPROTO='dhcp'
  383. does not work; the scripts attempt to obtain the device address from
  384. DHCP prior to adding any of the slave devices. Without active slaves,
  385. the DHCP requests are not sent to the network.
  386. The STARTMODE specifies when the device is brought online.
  387. The possible values are:
  388. onboot: The device is started at boot time. If you're not
  389. sure, this is probably what you want.
  390. manual: The device is started only when ifup is called
  391. manually. Bonding devices may be configured this
  392. way if you do not wish them to start automatically
  393. at boot for some reason.
  394. hotplug: The device is started by a hotplug event. This is not
  395. a valid choice for a bonding device.
  396. off or ignore: The device configuration is ignored.
  397. The line BONDING_MASTER='yes' indicates that the device is a
  398. bonding master device. The only useful value is "yes."
  399. The contents of BONDING_MODULE_OPTS are supplied to the
  400. instance of the bonding module for this device. Specify the options
  401. for the bonding mode, link monitoring, and so on here. Do not include
  402. the max_bonds bonding parameter; this will confuse the configuration
  403. system if you have multiple bonding devices.
  404. Finally, supply one BONDING_SLAVEn="ethX" for each slave,
  405. where "n" is an increasing value, one for each slave, and "ethX" is
  406. the name of the slave device (eth0, eth1, etc).
  407. When all configuration files have been modified or created,
  408. networking must be restarted for the configuration changes to take
  409. effect. This can be accomplished via the following:
  410. # /etc/init.d/network restart
  411. Note that the network control script (/sbin/ifdown) will
  412. remove the bonding module as part of the network shutdown processing,
  413. so it is not necessary to remove the module by hand if, e.g., the
  414. module paramters have changed.
  415. Also, at this writing, YaST/YaST2 will not manage bonding
  416. devices (they do not show bonding interfaces on its list of network
  417. devices). It is necessary to edit the configuration file by hand to
  418. change the bonding configuration.
  419. Additional general options and details of the ifcfg file
  420. format can be found in an example ifcfg template file:
  421. /etc/sysconfig/network/ifcfg.template
  422. Note that the template does not document the various BONDING_
  423. settings described above, but does describe many of the other options.
  424. 3.2 Configuration with initscripts support
  425. ------------------------------------------
  426. This section applies to distros using a version of initscripts
  427. with bonding support, for example, Red Hat Linux 9 or Red Hat
  428. Enterprise Linux version 3. On these systems, the network
  429. initialization scripts have some knowledge of bonding, and can be
  430. configured to control bonding devices.
  431. These distros will not automatically load the network adapter
  432. driver unless the ethX device is configured with an IP address.
  433. Because of this constraint, users must manually configure a
  434. network-script file for all physical adapters that will be members of
  435. a bondX link. Network script files are located in the directory:
  436. /etc/sysconfig/network-scripts
  437. The file name must be prefixed with "ifcfg-eth" and suffixed
  438. with the adapter's physical adapter number. For example, the script
  439. for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
  440. Place the following text in the file:
  441. DEVICE=eth0
  442. USERCTL=no
  443. ONBOOT=yes
  444. MASTER=bond0
  445. SLAVE=yes
  446. BOOTPROTO=none
  447. The DEVICE= line will be different for every ethX device and
  448. must correspond with the name of the file, i.e., ifcfg-eth1 must have
  449. a device line of DEVICE=eth1. The setting of the MASTER= line will
  450. also depend on the final bonding interface name chosen for your bond.
  451. As with other network devices, these typically start at 0, and go up
  452. one for each device, i.e., the first bonding instance is bond0, the
  453. second is bond1, and so on.
  454. Next, create a bond network script. The file name for this
  455. script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
  456. the number of the bond. For bond0 the file is named "ifcfg-bond0",
  457. for bond1 it is named "ifcfg-bond1", and so on. Within that file,
  458. place the following text:
  459. DEVICE=bond0
  460. IPADDR=192.168.1.1
  461. NETMASK=255.255.255.0
  462. NETWORK=192.168.1.0
  463. BROADCAST=192.168.1.255
  464. ONBOOT=yes
  465. BOOTPROTO=none
  466. USERCTL=no
  467. Be sure to change the networking specific lines (IPADDR,
  468. NETMASK, NETWORK and BROADCAST) to match your network configuration.
  469. Finally, it is necessary to edit /etc/modules.conf to load the
  470. bonding module when the bond0 interface is brought up. The following
  471. sample lines in /etc/modules.conf will load the bonding module, and
  472. select its options:
  473. alias bond0 bonding
  474. options bond0 mode=balance-alb miimon=100
  475. Replace the sample parameters with the appropriate set of
  476. options for your configuration.
  477. Finally run "/etc/rc.d/init.d/network restart" as root. This
  478. will restart the networking subsystem and your bond link should be now
  479. up and running.
  480. 3.3 Configuring Bonding Manually
  481. --------------------------------
  482. This section applies to distros whose network initialization
  483. scripts (the sysconfig or initscripts package) do not have specific
  484. knowledge of bonding. One such distro is SuSE Linux Enterprise Server
  485. version 8.
  486. The general methodology for these systems is to place the
  487. bonding module parameters into /etc/modprobe.conf, then add modprobe
  488. and/or ifenslave commands to the system's global init script. The
  489. name of the global init script differs; for sysconfig, it is
  490. /etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
  491. For example, if you wanted to make a simple bond of two e100
  492. devices (presumed to be eth0 and eth1), and have it persist across
  493. reboots, edit the appropriate file (/etc/init.d/boot.local or
  494. /etc/rc.d/rc.local), and add the following:
  495. modprobe bonding -obond0 mode=balance-alb miimon=100
  496. modprobe e100
  497. ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
  498. ifenslave bond0 eth0
  499. ifenslave bond0 eth1
  500. Replace the example bonding module parameters and bond0
  501. network configuration (IP address, netmask, etc) with the appropriate
  502. values for your configuration. The above example loads the bonding
  503. module with the name "bond0," this simplifies the naming if multiple
  504. bonding modules are loaded (each successive instance of the module is
  505. given a different name, and the module instance names match the
  506. bonding interface names).
  507. Unfortunately, this method will not provide support for the
  508. ifup and ifdown scripts on the bond devices. To reload the bonding
  509. configuration, it is necessary to run the initialization script, e.g.,
  510. # /etc/init.d/boot.local
  511. or
  512. # /etc/rc.d/rc.local
  513. It may be desirable in such a case to create a separate script
  514. which only initializes the bonding configuration, then call that
  515. separate script from within boot.local. This allows for bonding to be
  516. enabled without re-running the entire global init script.
  517. To shut down the bonding devices, it is necessary to first
  518. mark the bonding device itself as being down, then remove the
  519. appropriate device driver modules. For our example above, you can do
  520. the following:
  521. # ifconfig bond0 down
  522. # rmmod bond0
  523. # rmmod e100
  524. Again, for convenience, it may be desirable to create a script
  525. with these commands.
  526. 3.4 Configuring Multiple Bonds
  527. ------------------------------
  528. This section contains information on configuring multiple
  529. bonding devices with differing options. If you require multiple
  530. bonding devices, but all with the same options, see the "max_bonds"
  531. module paramter, documented above.
  532. To create multiple bonding devices with differing options, it
  533. is necessary to load the bonding driver multiple times. Note that
  534. current versions of the sysconfig network initialization scripts
  535. handle this automatically; if your distro uses these scripts, no
  536. special action is needed. See the section Configuring Bonding
  537. Devices, above, if you're not sure about your network initialization
  538. scripts.
  539. To load multiple instances of the module, it is necessary to
  540. specify a different name for each instance (the module loading system
  541. requires that every loaded module, even multiple instances of the same
  542. module, have a unique name). This is accomplished by supplying
  543. multiple sets of bonding options in /etc/modprobe.conf, for example:
  544. alias bond0 bonding
  545. options bond0 -o bond0 mode=balance-rr miimon=100
  546. alias bond1 bonding
  547. options bond1 -o bond1 mode=balance-alb miimon=50
  548. will load the bonding module two times. The first instance is
  549. named "bond0" and creates the bond0 device in balance-rr mode with an
  550. miimon of 100. The second instance is named "bond1" and creates the
  551. bond1 device in balance-alb mode with an miimon of 50.
  552. This may be repeated any number of times, specifying a new and
  553. unique name in place of bond0 or bond1 for each instance.
  554. When the appropriate module paramters are in place, then
  555. configure bonding according to the instructions for your distro.
  556. 5. Querying Bonding Configuration
  557. =================================
  558. 5.1 Bonding Configuration
  559. -------------------------
  560. Each bonding device has a read-only file residing in the
  561. /proc/net/bonding directory. The file contents include information
  562. about the bonding configuration, options and state of each slave.
  563. For example, the contents of /proc/net/bonding/bond0 after the
  564. driver is loaded with parameters of mode=0 and miimon=1000 is
  565. generally as follows:
  566. Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
  567. Bonding Mode: load balancing (round-robin)
  568. Currently Active Slave: eth0
  569. MII Status: up
  570. MII Polling Interval (ms): 1000
  571. Up Delay (ms): 0
  572. Down Delay (ms): 0
  573. Slave Interface: eth1
  574. MII Status: up
  575. Link Failure Count: 1
  576. Slave Interface: eth0
  577. MII Status: up
  578. Link Failure Count: 1
  579. The precise format and contents will change depending upon the
  580. bonding configuration, state, and version of the bonding driver.
  581. 5.2 Network configuration
  582. -------------------------
  583. The network configuration can be inspected using the ifconfig
  584. command. Bonding devices will have the MASTER flag set; Bonding slave
  585. devices will have the SLAVE flag set. The ifconfig output does not
  586. contain information on which slaves are associated with which masters.
  587. In the example below, the bond0 interface is the master
  588. (MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
  589. bond0 have the same MAC address (HWaddr) as bond0 for all modes except
  590. TLB and ALB that require a unique MAC address for each slave.
  591. # /sbin/ifconfig
  592. bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
  593. inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
  594. UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
  595. RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
  596. TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
  597. collisions:0 txqueuelen:0
  598. eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
  599. inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
  600. UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
  601. RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
  602. TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
  603. collisions:0 txqueuelen:100
  604. Interrupt:10 Base address:0x1080
  605. eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
  606. inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
  607. UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
  608. RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
  609. TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
  610. collisions:0 txqueuelen:100
  611. Interrupt:9 Base address:0x1400
  612. 6. Switch Configuration
  613. =======================
  614. For this section, "switch" refers to whatever system the
  615. bonded devices are directly connected to (i.e., where the other end of
  616. the cable plugs into). This may be an actual dedicated switch device,
  617. or it may be another regular system (e.g., another computer running
  618. Linux),
  619. The active-backup, balance-tlb and balance-alb modes do not
  620. require any specific configuration of the switch.
  621. The 802.3ad mode requires that the switch have the appropriate
  622. ports configured as an 802.3ad aggregation. The precise method used
  623. to configure this varies from switch to switch, but, for example, a
  624. Cisco 3550 series switch requires that the appropriate ports first be
  625. grouped together in a single etherchannel instance, then that
  626. etherchannel is set to mode "lacp" to enable 802.3ad (instead of
  627. standard EtherChannel).
  628. The balance-rr, balance-xor and broadcast modes generally
  629. require that the switch have the appropriate ports grouped together.
  630. The nomenclature for such a group differs between switches, it may be
  631. called an "etherchannel" (as in the Cisco example, above), a "trunk
  632. group" or some other similar variation. For these modes, each switch
  633. will also have its own configuration options for the switch's transmit
  634. policy to the bond. Typical choices include XOR of either the MAC or
  635. IP addresses. The transmit policy of the two peers does not need to
  636. match. For these three modes, the bonding mode really selects a
  637. transmit policy for an EtherChannel group; all three will interoperate
  638. with another EtherChannel group.
  639. 7. 802.1q VLAN Support
  640. ======================
  641. It is possible to configure VLAN devices over a bond interface
  642. using the 8021q driver. However, only packets coming from the 8021q
  643. driver and passing through bonding will be tagged by default. Self
  644. generated packets, for example, bonding's learning packets or ARP
  645. packets generated by either ALB mode or the ARP monitor mechanism, are
  646. tagged internally by bonding itself. As a result, bonding must
  647. "learn" the VLAN IDs configured above it, and use those IDs to tag
  648. self generated packets.
  649. For reasons of simplicity, and to support the use of adapters
  650. that can do VLAN hardware acceleration offloding, the bonding
  651. interface declares itself as fully hardware offloaing capable, it gets
  652. the add_vid/kill_vid notifications to gather the necessary
  653. information, and it propagates those actions to the slaves. In case
  654. of mixed adapter types, hardware accelerated tagged packets that
  655. should go through an adapter that is not offloading capable are
  656. "un-accelerated" by the bonding driver so the VLAN tag sits in the
  657. regular location.
  658. VLAN interfaces *must* be added on top of a bonding interface
  659. only after enslaving at least one slave. The bonding interface has a
  660. hardware address of 00:00:00:00:00:00 until the first slave is added.
  661. If the VLAN interface is created prior to the first enslavement, it
  662. would pick up the all-zeroes hardware address. Once the first slave
  663. is attached to the bond, the bond device itself will pick up the
  664. slave's hardware address, which is then available for the VLAN device.
  665. Also, be aware that a similar problem can occur if all slaves
  666. are released from a bond that still has one or more VLAN interfaces on
  667. top of it. When a new slave is added, the bonding interface will
  668. obtain its hardware address from the first slave, which might not
  669. match the hardware address of the VLAN interfaces (which was
  670. ultimately copied from an earlier slave).
  671. There are two methods to insure that the VLAN device operates
  672. with the correct hardware address if all slaves are removed from a
  673. bond interface:
  674. 1. Remove all VLAN interfaces then recreate them
  675. 2. Set the bonding interface's hardware address so that it
  676. matches the hardware address of the VLAN interfaces.
  677. Note that changing a VLAN interface's HW address would set the
  678. underlying device -- i.e. the bonding interface -- to promiscouos
  679. mode, which might not be what you want.
  680. 8. Link Monitoring
  681. ==================
  682. The bonding driver at present supports two schemes for
  683. monitoring a slave device's link state: the ARP monitor and the MII
  684. monitor.
  685. At the present time, due to implementation restrictions in the
  686. bonding driver itself, it is not possible to enable both ARP and MII
  687. monitoring simultaneously.
  688. 8.1 ARP Monitor Operation
  689. -------------------------
  690. The ARP monitor operates as its name suggests: it sends ARP
  691. queries to one or more designated peer systems on the network, and
  692. uses the response as an indication that the link is operating. This
  693. gives some assurance that traffic is actually flowing to and from one
  694. or more peers on the local network.
  695. The ARP monitor relies on the device driver itself to verify
  696. that traffic is flowing. In particular, the driver must keep up to
  697. date the last receive time, dev->last_rx, and transmit start time,
  698. dev->trans_start. If these are not updated by the driver, then the
  699. ARP monitor will immediately fail any slaves using that driver, and
  700. those slaves will stay down. If networking monitoring (tcpdump, etc)
  701. shows the ARP requests and replies on the network, then it may be that
  702. your device driver is not updating last_rx and trans_start.
  703. 8.2 Configuring Multiple ARP Targets
  704. ------------------------------------
  705. While ARP monitoring can be done with just one target, it can
  706. be useful in a High Availability setup to have several targets to
  707. monitor. In the case of just one target, the target itself may go
  708. down or have a problem making it unresponsive to ARP requests. Having
  709. an additional target (or several) increases the reliability of the ARP
  710. monitoring.
  711. Multiple ARP targets must be seperated by commas as follows:
  712. # example options for ARP monitoring with three targets
  713. alias bond0 bonding
  714. options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
  715. For just a single target the options would resemble:
  716. # example options for ARP monitoring with one target
  717. alias bond0 bonding
  718. options bond0 arp_interval=60 arp_ip_target=192.168.0.100
  719. 8.3 MII Monitor Operation
  720. -------------------------
  721. The MII monitor monitors only the carrier state of the local
  722. network interface. It accomplishes this in one of three ways: by
  723. depending upon the device driver to maintain its carrier state, by
  724. querying the device's MII registers, or by making an ethtool query to
  725. the device.
  726. If the use_carrier module parameter is 1 (the default value),
  727. then the MII monitor will rely on the driver for carrier state
  728. information (via the netif_carrier subsystem). As explained in the
  729. use_carrier parameter information, above, if the MII monitor fails to
  730. detect carrier loss on the device (e.g., when the cable is physically
  731. disconnected), it may be that the driver does not support
  732. netif_carrier.
  733. If use_carrier is 0, then the MII monitor will first query the
  734. device's (via ioctl) MII registers and check the link state. If that
  735. request fails (not just that it returns carrier down), then the MII
  736. monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
  737. the same information. If both methods fail (i.e., the driver either
  738. does not support or had some error in processing both the MII register
  739. and ethtool requests), then the MII monitor will assume the link is
  740. up.
  741. 9. Potential Sources of Trouble
  742. ===============================
  743. 9.1 Adventures in Routing
  744. -------------------------
  745. When bonding is configured, it is important that the slave
  746. devices not have routes that supercede routes of the master (or,
  747. generally, not have routes at all). For example, suppose the bonding
  748. device bond0 has two slaves, eth0 and eth1, and the routing table is
  749. as follows:
  750. Kernel IP routing table
  751. Destination Gateway Genmask Flags MSS Window irtt Iface
  752. 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0
  753. 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth1
  754. 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 bond0
  755. 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
  756. This routing configuration will likely still update the
  757. receive/transmit times in the driver (needed by the ARP monitor), but
  758. may bypass the bonding driver (because outgoing traffic to, in this
  759. case, another host on network 10 would use eth0 or eth1 before bond0).
  760. The ARP monitor (and ARP itself) may become confused by this
  761. configuration, because ARP requests (generated by the ARP monitor)
  762. will be sent on one interface (bond0), but the corresponding reply
  763. will arrive on a different interface (eth0). This reply looks to ARP
  764. as an unsolicited ARP reply (because ARP matches replies on an
  765. interface basis), and is discarded. The MII monitor is not affected
  766. by the state of the routing table.
  767. The solution here is simply to insure that slaves do not have
  768. routes of their own, and if for some reason they must, those routes do
  769. not supercede routes of their master. This should generally be the
  770. case, but unusual configurations or errant manual or automatic static
  771. route additions may cause trouble.
  772. 9.2 Ethernet Device Renaming
  773. ----------------------------
  774. On systems with network configuration scripts that do not
  775. associate physical devices directly with network interface names (so
  776. that the same physical device always has the same "ethX" name), it may
  777. be necessary to add some special logic to either /etc/modules.conf or
  778. /etc/modprobe.conf (depending upon which is installed on the system).
  779. For example, given a modules.conf containing the following:
  780. alias bond0 bonding
  781. options bond0 mode=some-mode miimon=50
  782. alias eth0 tg3
  783. alias eth1 tg3
  784. alias eth2 e1000
  785. alias eth3 e1000
  786. If neither eth0 and eth1 are slaves to bond0, then when the
  787. bond0 interface comes up, the devices may end up reordered. This
  788. happens because bonding is loaded first, then its slave device's
  789. drivers are loaded next. Since no other drivers have been loaded,
  790. when the e1000 driver loads, it will receive eth0 and eth1 for its
  791. devices, but the bonding configuration tries to enslave eth2 and eth3
  792. (which may later be assigned to the tg3 devices).
  793. Adding the following:
  794. add above bonding e1000 tg3
  795. causes modprobe to load e1000 then tg3, in that order, when
  796. bonding is loaded. This command is fully documented in the
  797. modules.conf manual page.
  798. On systems utilizing modprobe.conf (or modprobe.conf.local),
  799. an equivalent problem can occur. In this case, the following can be
  800. added to modprobe.conf (or modprobe.conf.local, as appropriate), as
  801. follows (all on one line; it has been split here for clarity):
  802. install bonding /sbin/modprobe tg3; /sbin/modprobe e1000;
  803. /sbin/modprobe --ignore-install bonding
  804. This will, when loading the bonding module, rather than
  805. performing the normal action, instead execute the provided command.
  806. This command loads the device drivers in the order needed, then calls
  807. modprobe with --ingore-install to cause the normal action to then take
  808. place. Full documentation on this can be found in the modprobe.conf
  809. and modprobe manual pages.
  810. 9.3. Painfully Slow Or No Failed Link Detection By Miimon
  811. ---------------------------------------------------------
  812. By default, bonding enables the use_carrier option, which
  813. instructs bonding to trust the driver to maintain carrier state.
  814. As discussed in the options section, above, some drivers do
  815. not support the netif_carrier_on/_off link state tracking system.
  816. With use_carrier enabled, bonding will always see these links as up,
  817. regardless of their actual state.
  818. Additionally, other drivers do support netif_carrier, but do
  819. not maintain it in real time, e.g., only polling the link state at
  820. some fixed interval. In this case, miimon will detect failures, but
  821. only after some long period of time has expired. If it appears that
  822. miimon is very slow in detecting link failures, try specifying
  823. use_carrier=0 to see if that improves the failure detection time. If
  824. it does, then it may be that the driver checks the carrier state at a
  825. fixed interval, but does not cache the MII register values (so the
  826. use_carrier=0 method of querying the registers directly works). If
  827. use_carrier=0 does not improve the failover, then the driver may cache
  828. the registers, or the problem may be elsewhere.
  829. Also, remember that miimon only checks for the device's
  830. carrier state. It has no way to determine the state of devices on or
  831. beyond other ports of a switch, or if a switch is refusing to pass
  832. traffic while still maintaining carrier on.
  833. 10. SNMP agents
  834. ===============
  835. If running SNMP agents, the bonding driver should be loaded
  836. before any network drivers participating in a bond. This requirement
  837. is due to the the interface index (ipAdEntIfIndex) being associated to
  838. the first interface found with a given IP address. That is, there is
  839. only one ipAdEntIfIndex for each IP address. For example, if eth0 and
  840. eth1 are slaves of bond0 and the driver for eth0 is loaded before the
  841. bonding driver, the interface for the IP address will be associated
  842. with the eth0 interface. This configuration is shown below, the IP
  843. address 192.168.1.1 has an interface index of 2 which indexes to eth0
  844. in the ifDescr table (ifDescr.2).
  845. interfaces.ifTable.ifEntry.ifDescr.1 = lo
  846. interfaces.ifTable.ifEntry.ifDescr.2 = eth0
  847. interfaces.ifTable.ifEntry.ifDescr.3 = eth1
  848. interfaces.ifTable.ifEntry.ifDescr.4 = eth2
  849. interfaces.ifTable.ifEntry.ifDescr.5 = eth3
  850. interfaces.ifTable.ifEntry.ifDescr.6 = bond0
  851. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
  852. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
  853. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
  854. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
  855. This problem is avoided by loading the bonding driver before
  856. any network drivers participating in a bond. Below is an example of
  857. loading the bonding driver first, the IP address 192.168.1.1 is
  858. correctly associated with ifDescr.2.
  859. interfaces.ifTable.ifEntry.ifDescr.1 = lo
  860. interfaces.ifTable.ifEntry.ifDescr.2 = bond0
  861. interfaces.ifTable.ifEntry.ifDescr.3 = eth0
  862. interfaces.ifTable.ifEntry.ifDescr.4 = eth1
  863. interfaces.ifTable.ifEntry.ifDescr.5 = eth2
  864. interfaces.ifTable.ifEntry.ifDescr.6 = eth3
  865. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
  866. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
  867. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
  868. ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
  869. While some distributions may not report the interface name in
  870. ifDescr, the association between the IP address and IfIndex remains
  871. and SNMP functions such as Interface_Scan_Next will report that
  872. association.
  873. 11. Promiscuous mode
  874. ====================
  875. When running network monitoring tools, e.g., tcpdump, it is
  876. common to enable promiscuous mode on the device, so that all traffic
  877. is seen (instead of seeing only traffic destined for the local host).
  878. The bonding driver handles promiscuous mode changes to the bonding
  879. master device (e.g., bond0), and propogates the setting to the slave
  880. devices.
  881. For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
  882. the promiscuous mode setting is propogated to all slaves.
  883. For the active-backup, balance-tlb and balance-alb modes, the
  884. promiscuous mode setting is propogated only to the active slave.
  885. For balance-tlb mode, the active slave is the slave currently
  886. receiving inbound traffic.
  887. For balance-alb mode, the active slave is the slave used as a
  888. "primary." This slave is used for mode-specific control traffic, for
  889. sending to peers that are unassigned or if the load is unbalanced.
  890. For the active-backup, balance-tlb and balance-alb modes, when
  891. the active slave changes (e.g., due to a link failure), the
  892. promiscuous setting will be propogated to the new active slave.
  893. 12. High Availability Information
  894. =================================
  895. High Availability refers to configurations that provide
  896. maximum network availability by having redundant or backup devices,
  897. links and switches between the host and the rest of the world.
  898. There are currently two basic methods for configuring to
  899. maximize availability. They are dependent on the network topology and
  900. the primary goal of the configuration, but in general, a configuration
  901. can be optimized for maximum available bandwidth, or for maximum
  902. network availability.
  903. 12.1 High Availability in a Single Switch Topology
  904. --------------------------------------------------
  905. If two hosts (or a host and a switch) are directly connected
  906. via multiple physical links, then there is no network availability
  907. penalty for optimizing for maximum bandwidth: there is only one switch
  908. (or peer), so if it fails, you have no alternative access to fail over
  909. to.
  910. Example 1 : host to switch (or other host)
  911. +----------+ +----------+
  912. | |eth0 eth0| switch |
  913. | Host A +--------------------------+ or |
  914. | +--------------------------+ other |
  915. | |eth1 eth1| host |
  916. +----------+ +----------+
  917. 12.1.1 Bonding Mode Selection for single switch topology
  918. --------------------------------------------------------
  919. This configuration is the easiest to set up and to understand,
  920. although you will have to decide which bonding mode best suits your
  921. needs. The tradeoffs for each mode are detailed below:
  922. balance-rr: This mode is the only mode that will permit a single
  923. TCP/IP connection to stripe traffic across multiple
  924. interfaces. It is therefore the only mode that will allow a
  925. single TCP/IP stream to utilize more than one interface's
  926. worth of throughput. This comes at a cost, however: the
  927. striping often results in peer systems receiving packets out
  928. of order, causing TCP/IP's congestion control system to kick
  929. in, often by retransmitting segments.
  930. It is possible to adjust TCP/IP's congestion limits by
  931. altering the net.ipv4.tcp_reordering sysctl parameter. The
  932. usual default value is 3, and the maximum useful value is 127.
  933. For a four interface balance-rr bond, expect that a single
  934. TCP/IP stream will utilize no more than approximately 2.3
  935. interface's worth of throughput, even after adjusting
  936. tcp_reordering.
  937. If you are utilizing protocols other than TCP/IP, UDP for
  938. example, and your application can tolerate out of order
  939. delivery, then this mode can allow for single stream datagram
  940. performance that scales near linearly as interfaces are added
  941. to the bond.
  942. This mode requires the switch to have the appropriate ports
  943. configured for "etherchannel" or "trunking."
  944. active-backup: There is not much advantage in this network topology to
  945. the active-backup mode, as the inactive backup devices are all
  946. connected to the same peer as the primary. In this case, a
  947. load balancing mode (with link monitoring) will provide the
  948. same level of network availability, but with increased
  949. available bandwidth. On the plus side, it does not require
  950. any configuration of the switch.
  951. balance-xor: This mode will limit traffic such that packets destined
  952. for specific peers will always be sent over the same
  953. interface. Since the destination is determined by the MAC
  954. addresses involved, this may be desirable if you have a large
  955. network with many hosts. It is likely to be suboptimal if all
  956. your traffic is passed through a single router, however. As
  957. with balance-rr, the switch ports need to be configured for
  958. "etherchannel" or "trunking."
  959. broadcast: Like active-backup, there is not much advantage to this
  960. mode in this type of network topology.
  961. 802.3ad: This mode can be a good choice for this type of network
  962. topology. The 802.3ad mode is an IEEE standard, so all peers
  963. that implement 802.3ad should interoperate well. The 802.3ad
  964. protocol includes automatic configuration of the aggregates,
  965. so minimal manual configuration of the switch is needed
  966. (typically only to designate that some set of devices is
  967. usable for 802.3ad). The 802.3ad standard also mandates that
  968. frames be delivered in order (within certain limits), so in
  969. general single connections will not see misordering of
  970. packets. The 802.3ad mode does have some drawbacks: the
  971. standard mandates that all devices in the aggregate operate at
  972. the same speed and duplex. Also, as with all bonding load
  973. balance modes other than balance-rr, no single connection will
  974. be able to utilize more than a single interface's worth of
  975. bandwidth. Additionally, the linux bonding 802.3ad
  976. implementation distributes traffic by peer (using an XOR of
  977. MAC addresses), so in general all traffic to a particular
  978. destination will use the same interface. Finally, the 802.3ad
  979. mode mandates the use of the MII monitor, therefore, the ARP
  980. monitor is not available in this mode.
  981. balance-tlb: This mode is also a good choice for this type of
  982. topology. It has no special switch configuration
  983. requirements, and balances outgoing traffic by peer, in a
  984. vaguely intelligent manner (not a simple XOR as in balance-xor
  985. or 802.3ad mode), so that unlucky MAC addresses will not all
  986. "bunch up" on a single interface. Interfaces may be of
  987. differing speeds. On the down side, in this mode all incoming
  988. traffic arrives over a single interface, this mode requires
  989. certain ethtool support in the network device driver of the
  990. slave interfaces, and the ARP monitor is not available.
  991. balance-alb: This mode is everything that balance-tlb is, and more. It
  992. has all of the features (and restrictions) of balance-tlb, and
  993. will also balance incoming traffic from peers (as described in
  994. the Bonding Module Options section, above). The only extra
  995. down side to this mode is that the network device driver must
  996. support changing the hardware address while the device is
  997. open.
  998. 12.1.2 Link Monitoring for Single Switch Topology
  999. -------------------------------------------------
  1000. The choice of link monitoring may largely depend upon which
  1001. mode you choose to use. The more advanced load balancing modes do not
  1002. support the use of the ARP monitor, and are thus restricted to using
  1003. the MII monitor (which does not provide as high a level of assurance
  1004. as the ARP monitor).
  1005. 12.2 High Availability in a Multiple Switch Topology
  1006. ----------------------------------------------------
  1007. With multiple switches, the configuration of bonding and the
  1008. network changes dramatically. In multiple switch topologies, there is
  1009. a tradeoff between network availability and usable bandwidth.
  1010. Below is a sample network, configured to maximize the
  1011. availability of the network:
  1012. | |
  1013. |port3 port3|
  1014. +-----+----+ +-----+----+
  1015. | |port2 ISL port2| |
  1016. | switch A +--------------------------+ switch B |
  1017. | | | |
  1018. +-----+----+ +-----++---+
  1019. |port1 port1|
  1020. | +-------+ |
  1021. +-------------+ host1 +---------------+
  1022. eth0 +-------+ eth1
  1023. In this configuration, there is a link between the two
  1024. switches (ISL, or inter switch link), and multiple ports connecting to
  1025. the outside world ("port3" on each switch). There is no technical
  1026. reason that this could not be extended to a third switch.
  1027. 12.2.1 Bonding Mode Selection for Multiple Switch Topology
  1028. ----------------------------------------------------------
  1029. In a topology such as this, the active-backup and broadcast
  1030. modes are the only useful bonding modes; the other modes require all
  1031. links to terminate on the same peer for them to behave rationally.
  1032. active-backup: This is generally the preferred mode, particularly if
  1033. the switches have an ISL and play together well. If the
  1034. network configuration is such that one switch is specifically
  1035. a backup switch (e.g., has lower capacity, higher cost, etc),
  1036. then the primary option can be used to insure that the
  1037. preferred link is always used when it is available.
  1038. broadcast: This mode is really a special purpose mode, and is suitable
  1039. only for very specific needs. For example, if the two
  1040. switches are not connected (no ISL), and the networks beyond
  1041. them are totally independant. In this case, if it is
  1042. necessary for some specific one-way traffic to reach both
  1043. independent networks, then the broadcast mode may be suitable.
  1044. 12.2.2 Link Monitoring Selection for Multiple Switch Topology
  1045. -------------------------------------------------------------
  1046. The choice of link monitoring ultimately depends upon your
  1047. switch. If the switch can reliably fail ports in response to other
  1048. failures, then either the MII or ARP monitors should work. For
  1049. example, in the above example, if the "port3" link fails at the remote
  1050. end, the MII monitor has no direct means to detect this. The ARP
  1051. monitor could be configured with a target at the remote end of port3,
  1052. thus detecting that failure without switch support.
  1053. In general, however, in a multiple switch topology, the ARP
  1054. monitor can provide a higher level of reliability in detecting link
  1055. failures. Additionally, it should be configured with multiple targets
  1056. (at least one for each switch in the network). This will insure that,
  1057. regardless of which switch is active, the ARP monitor has a suitable
  1058. target to query.
  1059. 12.3 Switch Behavior Issues for High Availability
  1060. -------------------------------------------------
  1061. You may encounter issues with the timing of link up and down
  1062. reporting by the switch.
  1063. First, when a link comes up, some switches may indicate that
  1064. the link is up (carrier available), but not pass traffic over the
  1065. interface for some period of time. This delay is typically due to
  1066. some type of autonegotiation or routing protocol, but may also occur
  1067. during switch initialization (e.g., during recovery after a switch
  1068. failure). If you find this to be a problem, specify an appropriate
  1069. value to the updelay bonding module option to delay the use of the
  1070. relevant interface(s).
  1071. Second, some switches may "bounce" the link state one or more
  1072. times while a link is changing state. This occurs most commonly while
  1073. the switch is initializing. Again, an appropriate updelay value may
  1074. help, but note that if all links are down, then updelay is ignored
  1075. when any link becomes active (the slave closest to completing its
  1076. updelay is chosen).
  1077. Note that when a bonding interface has no active links, the
  1078. driver will immediately reuse the first link that goes up, even if
  1079. updelay parameter was specified. If there are slave interfaces
  1080. waiting for the updelay timeout to expire, the interface that first
  1081. went into that state will be immediately reused. This reduces down
  1082. time of the network if the value of updelay has been overestimated.
  1083. In addition to the concerns about switch timings, if your
  1084. switches take a long time to go into backup mode, it may be desirable
  1085. to not activate a backup interface immediately after a link goes down.
  1086. Failover may be delayed via the downdelay bonding module option.
  1087. 13. Hardware Specific Considerations
  1088. ====================================
  1089. This section contains additional information for configuring
  1090. bonding on specific hardware platforms, or for interfacing bonding
  1091. with particular switches or other devices.
  1092. 13.1 IBM BladeCenter
  1093. --------------------
  1094. This applies to the JS20 and similar systems.
  1095. On the JS20 blades, the bonding driver supports only
  1096. balance-rr, active-backup, balance-tlb and balance-alb modes. This is
  1097. largely due to the network topology inside the BladeCenter, detailed
  1098. below.
  1099. JS20 network adapter information
  1100. --------------------------------
  1101. All JS20s come with two Broadcom Gigabit Ethernet ports
  1102. integrated on the planar. In the BladeCenter chassis, the eth0 port
  1103. of all JS20 blades is hard wired to I/O Module #1; similarly, all eth1
  1104. ports are wired to I/O Module #2. An add-on Broadcom daughter card
  1105. can be installed on a JS20 to provide two more Gigabit Ethernet ports.
  1106. These ports, eth2 and eth3, are wired to I/O Modules 3 and 4,
  1107. respectively.
  1108. Each I/O Module may contain either a switch or a passthrough
  1109. module (which allows ports to be directly connected to an external
  1110. switch). Some bonding modes require a specific BladeCenter internal
  1111. network topology in order to function; these are detailed below.
  1112. Additional BladeCenter-specific networking information can be
  1113. found in two IBM Redbooks (www.ibm.com/redbooks):
  1114. "IBM eServer BladeCenter Networking Options"
  1115. "IBM eServer BladeCenter Layer 2-7 Network Switching"
  1116. BladeCenter networking configuration
  1117. ------------------------------------
  1118. Because a BladeCenter can be configured in a very large number
  1119. of ways, this discussion will be confined to describing basic
  1120. configurations.
  1121. Normally, Ethernet Switch Modules (ESM) are used in I/O
  1122. modules 1 and 2. In this configuration, the eth0 and eth1 ports of a
  1123. JS20 will be connected to different internal switches (in the
  1124. respective I/O modules).
  1125. An optical passthru module (OPM) connects the I/O module
  1126. directly to an external switch. By using OPMs in I/O module #1 and
  1127. #2, the eth0 and eth1 interfaces of a JS20 can be redirected to the
  1128. outside world and connected to a common external switch.
  1129. Depending upon the mix of ESM and OPM modules, the network
  1130. will appear to bonding as either a single switch topology (all OPM
  1131. modules) or as a multiple switch topology (one or more ESM modules,
  1132. zero or more OPM modules). It is also possible to connect ESM modules
  1133. together, resulting in a configuration much like the example in "High
  1134. Availability in a multiple switch topology."
  1135. Requirements for specifc modes
  1136. ------------------------------
  1137. The balance-rr mode requires the use of OPM modules for
  1138. devices in the bond, all connected to an common external switch. That
  1139. switch must be configured for "etherchannel" or "trunking" on the
  1140. appropriate ports, as is usual for balance-rr.
  1141. The balance-alb and balance-tlb modes will function with
  1142. either switch modules or passthrough modules (or a mix). The only
  1143. specific requirement for these modes is that all network interfaces
  1144. must be able to reach all destinations for traffic sent over the
  1145. bonding device (i.e., the network must converge at some point outside
  1146. the BladeCenter).
  1147. The active-backup mode has no additional requirements.
  1148. Link monitoring issues
  1149. ----------------------
  1150. When an Ethernet Switch Module is in place, only the ARP
  1151. monitor will reliably detect link loss to an external switch. This is
  1152. nothing unusual, but examination of the BladeCenter cabinet would
  1153. suggest that the "external" network ports are the ethernet ports for
  1154. the system, when it fact there is a switch between these "external"
  1155. ports and the devices on the JS20 system itself. The MII monitor is
  1156. only able to detect link failures between the ESM and the JS20 system.
  1157. When a passthrough module is in place, the MII monitor does
  1158. detect failures to the "external" port, which is then directly
  1159. connected to the JS20 system.
  1160. Other concerns
  1161. --------------
  1162. The Serial Over LAN link is established over the primary
  1163. ethernet (eth0) only, therefore, any loss of link to eth0 will result
  1164. in losing your SoL connection. It will not fail over with other
  1165. network traffic.
  1166. It may be desirable to disable spanning tree on the switch
  1167. (either the internal Ethernet Switch Module, or an external switch) to
  1168. avoid fail-over delays issues when using bonding.
  1169. 14. Frequently Asked Questions
  1170. ==============================
  1171. 1. Is it SMP safe?
  1172. Yes. The old 2.0.xx channel bonding patch was not SMP safe.
  1173. The new driver was designed to be SMP safe from the start.
  1174. 2. What type of cards will work with it?
  1175. Any Ethernet type cards (you can even mix cards - a Intel
  1176. EtherExpress PRO/100 and a 3com 3c905b, for example). They need not
  1177. be of the same speed.
  1178. 3. How many bonding devices can I have?
  1179. There is no limit.
  1180. 4. How many slaves can a bonding device have?
  1181. This is limited only by the number of network interfaces Linux
  1182. supports and/or the number of network cards you can place in your
  1183. system.
  1184. 5. What happens when a slave link dies?
  1185. If link monitoring is enabled, then the failing device will be
  1186. disabled. The active-backup mode will fail over to a backup link, and
  1187. other modes will ignore the failed link. The link will continue to be
  1188. monitored, and should it recover, it will rejoin the bond (in whatever
  1189. manner is appropriate for the mode). See the section on High
  1190. Availability for additional information.
  1191. Link monitoring can be enabled via either the miimon or
  1192. arp_interval paramters (described in the module paramters section,
  1193. above). In general, miimon monitors the carrier state as sensed by
  1194. the underlying network device, and the arp monitor (arp_interval)
  1195. monitors connectivity to another host on the local network.
  1196. If no link monitoring is configured, the bonding driver will
  1197. be unable to detect link failures, and will assume that all links are
  1198. always available. This will likely result in lost packets, and a
  1199. resulting degredation of performance. The precise performance loss
  1200. depends upon the bonding mode and network configuration.
  1201. 6. Can bonding be used for High Availability?
  1202. Yes. See the section on High Availability for details.
  1203. 7. Which switches/systems does it work with?
  1204. The full answer to this depends upon the desired mode.
  1205. In the basic balance modes (balance-rr and balance-xor), it
  1206. works with any system that supports etherchannel (also called
  1207. trunking). Most managed switches currently available have such
  1208. support, and many unmananged switches as well.
  1209. The advanced balance modes (balance-tlb and balance-alb) do
  1210. not have special switch requirements, but do need device drivers that
  1211. support specific features (described in the appropriate section under
  1212. module paramters, above).
  1213. In 802.3ad mode, it works with with systems that support IEEE
  1214. 802.3ad Dynamic Link Aggregation. Most managed and many unmanaged
  1215. switches currently available support 802.3ad.
  1216. The active-backup mode should work with any Layer-II switch.
  1217. 8. Where does a bonding device get its MAC address from?
  1218. If not explicitly configured with ifconfig, the MAC address of
  1219. the bonding device is taken from its first slave device. This MAC
  1220. address is then passed to all following slaves and remains persistent
  1221. (even if the the first slave is removed) until the bonding device is
  1222. brought down or reconfigured.
  1223. If you wish to change the MAC address, you can set it with
  1224. ifconfig:
  1225. # ifconfig bond0 hw ether 00:11:22:33:44:55
  1226. The MAC address can be also changed by bringing down/up the
  1227. device and then changing its slaves (or their order):
  1228. # ifconfig bond0 down ; modprobe -r bonding
  1229. # ifconfig bond0 .... up
  1230. # ifenslave bond0 eth...
  1231. This method will automatically take the address from the next
  1232. slave that is added.
  1233. To restore your slaves' MAC addresses, you need to detach them
  1234. from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
  1235. then restore the MAC addresses that the slaves had before they were
  1236. enslaved.
  1237. 15. Resources and Links
  1238. =======================
  1239. The latest version of the bonding driver can be found in the latest
  1240. version of the linux kernel, found on http://kernel.org
  1241. Discussions regarding the bonding driver take place primarily on the
  1242. bonding-devel mailing list, hosted at sourceforge.net. If you have
  1243. questions or problems, post them to the list.
  1244. bonding-devel@lists.sourceforge.net
  1245. https://lists.sourceforge.net/lists/listinfo/bonding-devel
  1246. There is also a project site on sourceforge.
  1247. http://www.sourceforge.net/projects/bonding
  1248. Donald Becker's Ethernet Drivers and diag programs may be found at :
  1249. - http://www.scyld.com/network/
  1250. You will also find a lot of information regarding Ethernet, NWay, MII,
  1251. etc. at www.scyld.com.
  1252. -- END --