1 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- This document was created with Syntext Serna Free. -->
3 <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="settingupbonding">
5 <title xml:id="settingupbonding.title">Setting Up Network Interface Bonding</title>
7 <para>This chapter describes how to use multiple network interfaces in parallel to increase bandwidth and/or redundancy. Topics include:</para>
11 <xref linkend="dbdoclet.50438258_95824"/>
16 <xref linkend="dbdoclet.50438258_29107"/>
21 <xref linkend="dbdoclet.50438258_25353"/>
26 <xref linkend="dbdoclet.50438258_26899"/>
31 <xref linkend="dbdoclet.50438258_54769"/>
36 <xref linkend="dbdoclet.50438258_92244"/>
41 <para>Using network interface bonding is optional.</para>
43 <section xml:id="dbdoclet.50438258_95824">
44 <title>7.1 Network Interface Bonding Overview</title>
45 <para>Bonding, also known as link aggregation, trunking and port trunking, is a method of aggregating multiple physical network links into a single logical link for increased bandwidth.</para>
46 <para>Several different types of bonding are available in Linux. All these types are referred to as 'modes', and use the bonding kernel module.</para>
47 <para>Modes 0 to 3 allow load balancing and fault tolerance by using multiple interfaces. Mode 4 aggregates a group of interfaces into a single virtual interface where all members of the group share the same speed and duplex settings. This mode is described under IEEE spec 802.3ad, and it is referred to as either 'mode 4' or '802.3ad.'</para>
49 <section xml:id="dbdoclet.50438258_29107">
50 <title>7.2 Requirements</title>
51 <para>The most basic requirement for successful bonding is that both endpoints of the connection must be capable of bonding. In a normal case, the non-server endpoint is a switch. (Two systems connected via crossover cables can also use bonding.) Any switch used must explicitly handle 802.3ad Dynamic Link Aggregation.</para>
52 <para>The kernel must also be configured with bonding. All supported Lustre kernels have bonding functionality. The network driver for the interfaces to be bonded must have the ethtool functionality to determine slave speed and duplex settings. All recent network drivers implement it.</para>
53 <para>To verify that your interface works with ethtool, run:</para>
54 <screen># which ethtool
59 Supported ports: [ TP MII ]
60 Supported link modes: 10baseT/Half 10baseT/Full/
61 100baseT/Half 100baseT/Full
62 Supports auto-negotiation: Yes
63 Advertised link modes: 10baseT/Half 10baseT/Full
64 100baseT/Half 100baseT/Full
65 Advertised auto-negotiation: Yes
72 Supports Wake-on: pumbg
74 Current message level: 0x00000001 (1)
80 Supported ports: [ TP MII ]
81 Supported link modes: 10baseT/Half 10baseT/Full
82 100baseT/Half 100baseT/Full
83 Supports auto-negotiation: Yes
84 Advertised link modes: 10baseT/Half 10baseT/Full
85 100baseT/Half 100baseT/Full
86 Advertised auto-negotiation: Yes
93 Supports Wake-on: pumbg
95 Current message level: 0x00000007 (7)
97 To quickly check whether your kernel supports bonding, run:
98 # grep ifenslave /sbin/ifup
103 <section xml:id="dbdoclet.50438258_25353">
104 <title>7.3 Bonding Module Parameters</title>
105 <para>Bonding module parameters control various aspects of bonding.</para>
106 <para>Outgoing traffic is mapped across the slave interfaces according to the transmit hash policy. For Lustre, we recommend that you set the xmit_hash_policy option to the layer3+4 option for bonding. This policy uses upper layer protocol information if available to generate the hash. This allows traffic to a particular network peer to span multiple slaves, although a single connection does not span multiple slaves.</para>
107 <screen>$ xmit_hash_policy=layer3+4
109 <para>The miimon option enables users to monitor the link status. (The parameter is a time interval in milliseconds.) It makes an interface failure transparent to avoid serious network degradation during link failures. A reasonable default setting is 100 milliseconds; run:</para>
112 <para>For a busy network, increase the timeout.</para>
114 <section xml:id="dbdoclet.50438258_26899">
115 <title>7.4 Setting Up Bonding</title>
116 <para>To set up bonding:</para>
119 <para><emphasis role="bold">Create a virtual 'bond' interface by creating a configuration file in:</emphasis></para>
120 <screen>/etc/sysconfig/network-scripts/ # vi /etc/sysconfig/ network-scripts/ifcfg-\
125 <para><emphasis role="bold">Append the following lines to the file.</emphasis></para>
127 IPADDR=192.168.10.79 # Use the free IP Address of your network
129 NETMASK=255.255.255.0
136 <para><emphasis role="bold">Attach one or more slave interfaces to the bond interface. Modify the eth0 and eth1 configuration files (using a VI text editor).</emphasis></para>
139 <para><emphasis role="bold">Use the VI text editor to open the eth0 configuration file.</emphasis></para>
140 <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth0
144 <para><emphasis role="bold">Modify/append the eth0 file as follows:</emphasis></para>
154 <para><emphasis role="bold">Use the VI text editor to open the eth1 configuration file.</emphasis></para>
155 <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth1
159 <para><emphasis role="bold">Modify/append the eth1 file as follows:</emphasis></para>
171 <para><emphasis role="bold">Set up the bond interface and its options in /etc/modprobe.conf. Start the slave interfaces by your normal network method.</emphasis></para>
172 <screen># vi /etc/modprobe.conf
176 <para><emphasis role="bold">Append the following lines to the file.</emphasis></para>
177 <screen>alias bond0 bonding
178 options bond0 mode=balance-alb miimon=100
182 <para><emphasis role="bold">Load the bonding module.</emphasis></para>
183 <screen># modprobe bonding
185 # ifenslave bond0 eth0 eth1
191 <para><emphasis role="bold">Start/restart the slave interfaces (using your normal network method).</emphasis></para>
193 <para>You must modprobe the bonding module for each bonded interface. If you wish to create bond0 and bond1, two entries in modprobe.conf are required.</para>
195 <para>The examples below are from RedHat systems. For setup use: <literal>/etc/sysconfig/networking-scripts/ifcfg-*</literal> The website referenced below includes detailed instructions for other configuration methods, instructions to use DHCP with bonding, and other setup details. We strongly recommend you use this website.</para>
196 <para><link xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding">http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link></para>
199 <para><emphasis role="bold">Check /proc/net/bonding to determine status on bonding. There should be a file there for each bond interface.</emphasis></para>
200 <screen># cat /proc/net/bonding/bond0
201 Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)
203 Bonding Mode: load balancing (round-robin)
205 MII Polling Interval (ms): 0
209 Slave Interface: eth0
211 Link Failure Count: 0
212 Permanent HW addr: 4c:00:10:ac:61:e0
214 Slave Interface: eth1
216 Link Failure Count: 0
217 Permanent HW addr: 00:14:2a:7c:40:1d
221 <para><emphasis role="bold">Use ethtool or ifconfig to check the interface state. ifconfig lists the first bonded interface as 'bond0.'</emphasis></para>
223 bond0 Link encap:Ethernet HWaddr 4C:00:10:AC:61:E0
224 inet addr:192.168.10.79 Bcast:192.168.10.255 \ Mask:255.255.255.0
225 inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
226 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
227 RX packets:3091 errors:0 dropped:0 overruns:0 frame:0
228 TX packets:880 errors:0 dropped:0 overruns:0 carrier:0
229 collisions:0 txqueuelen:0
230 RX bytes:314203 (306.8 KiB) TX bytes:129834 (126.7 KiB)
232 eth0 Link encap:Ethernet HWaddr 4C:00:10:AC:61:E0
233 inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
234 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
235 RX packets:1581 errors:0 dropped:0 overruns:0 frame:0
236 TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
237 collisions:0 txqueuelen:1000
238 RX bytes:162084 (158.2 KiB) TX bytes:67245 (65.6 KiB)
239 Interrupt:193 Base address:0x8c00
241 eth1 Link encap:Ethernet HWaddr 4C:00:10:AC:61:E0
242 inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
243 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
244 RX packets:1513 errors:0 dropped:0 overruns:0 frame:0
245 TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
246 collisions:0 txqueuelen:1000
247 RX bytes:152299 (148.7 KiB) TX bytes:64517 (63.0 KiB)
248 Interrupt:185 Base address:0x6000
253 <title>7.4.1 Examples</title>
254 <para>This is an example showing <literal>modprobe.conf</literal> entries for bonding Ethernet interfaces <literal>eth1</literal> and <literal>eth2</literal> to <literal>bond0</literal>:</para>
255 <screen># cat /etc/modprobe.conf
257 alias scsi_hostadapter sata_via
258 alias scsi_hostadapter1 usb-storage
259 alias snd-card-0 snd-via82xx
260 options snd-card-0 index=0
261 options snd-via82xx index=0
263 options bond0 mode=balance-alb miimon=100
264 options lnet networks=tcp
267 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
270 NETMASK=255.255.255.0
271 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
276 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
279 HWADDR=4c:00:10:ac:61:e0
288 <para>In the following example, the <literal>bond0</literal> interface is the master (MASTER) while <literal>eth0</literal> and <literal>eth1</literal> are slaves (SLAVE).</para>
289 <informaltable frame="none">
291 <colspec colname="c1" colwidth="100*"/>
295 <para><emphasis role="bold">Note -</emphasis>All slaves of <literal>bond0</literal> have the same MAC address (Hwaddr) - <literal>bond0</literal>. All modes, except TLB and ALB, have this MAC address. TLB and ALB require a unique MAC address for each slave.</para>
301 <screen>$ /sbin/ifconfig
303 bond0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
304 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
305 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
306 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
307 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
308 collisions:0 txqueuelen:0
310 eth0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
311 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
312 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
313 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
314 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
315 collisions:0 txqueuelen:100
316 Interrupt:10 Base address:0x1080
318 eth1Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
319 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
320 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
321 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
322 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
323 collisions:0 txqueuelen:100
324 Interrupt:9 Base address:0x1400
328 <section xml:id="dbdoclet.50438258_54769">
329 <title>7.5 Configuring Lustre with Bonding</title>
330 <para>Lustre uses the IP address of the bonded interfaces and requires no special configuration. It treats the bonded interface as a regular TCP/IP interface. If needed, specify bond0 using the Lustre networks parameter in /etc/modprobe.</para>
331 <screen>options lnet networks=tcp(bond0)
334 <section xml:id="dbdoclet.50438258_92244">
335 <title>7.6 Bonding References</title>
336 <para>We recommend the following bonding references:</para>
339 <para>In the Linux kernel source tree, see documentation/networking/bonding.txt</para>
342 <para><link xl:href="http://linux-ip.net/html/ether-bonding.html">http://linux-ip.net/html/ether-bonding.html</link></para>
345 <para><link xl:href="http://www.sourceforge.net/projects/bonding">http://www.sourceforge.net/projects/bonding</link></para>
348 <para>Linux Foundation bonding website: <link xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding">http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link></para>
351 <para>This is the most extensive reference and we highly recommend it. This website includes explanations of more complicated setups, including the use of DHCP with bonding.</para>