Whamcloud - gitweb
6c082667712deb94938e9aa4eace708c0a68d2ae
[doc/manual.git] / SettingUpBonding.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- This document was created with Syntext Serna Free. --><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">
3   <title xml:id="settingupbonding.title">Setting Up Network Interface Bonding</title>
4   <para>This chapter describes how to use multiple network interfaces in parallel to increase bandwidth and/or redundancy. Topics include:</para>
5   <itemizedlist>
6     <listitem>
7       <para>
8               <xref linkend="dbdoclet.50438258_95824"/>
9           </para>
10     </listitem>
11     <listitem>
12       <para>
13               <xref linkend="dbdoclet.50438258_29107"/>
14           </para>
15     </listitem>
16     <listitem>
17       <para>
18               <xref linkend="dbdoclet.50438258_25353"/>
19           </para>
20     </listitem>
21     <listitem>
22       <para>
23               <xref linkend="dbdoclet.50438258_26899"/>
24           </para>
25     </listitem>
26     <listitem>
27       <para>
28               <xref linkend="dbdoclet.50438258_54769"/>
29           </para>
30     </listitem>
31     <listitem>
32       <para>
33               <xref linkend="dbdoclet.50438258_92244"/>
34           </para>
35     </listitem>
36   </itemizedlist>
37   <note>
38     <para>Using network interface bonding is optional.</para>
39   </note>
40   <section xml:id="dbdoclet.50438258_95824">
41     <title>Network Interface Bonding Overview</title>
42     <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>
43     <para>Several different types of bonding are available in Linux. All these types are referred to as &apos;modes&apos;, and use the bonding kernel module.</para>
44     <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 &apos;mode 4&apos; or &apos;802.3ad.&apos;</para>
45   </section>
46   <section xml:id="dbdoclet.50438258_29107">
47     <title>Requirements</title>
48     <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>
49     <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>
50     <para>To verify that your interface works with ethtool, run:</para>
51     <screen># which ethtool
52 /sbin/ethtool
53  
54 # ethtool eth0
55 Settings for eth0:
56            Supported ports: [ TP MII ]
57            Supported link modes:   10baseT/Half 10baseT/Full
58                                    100baseT/Half 100baseT/Full
59            Supports auto-negotiation: Yes
60            Advertised link modes:  10baseT/Half 10baseT/Full
61                                    100baseT/Half 100baseT/Full
62            Advertised auto-negotiation: Yes
63            Speed: 100Mb/s
64            Duplex: Full
65            Port: MII
66            PHYAD: 1
67            Transceiver: internal
68            Auto-negotiation: on
69            Supports Wake-on: pumbg
70            Wake-on: d
71            Current message level: 0x00000001 (1)
72            Link detected: yes
73  
74 # ethtool eth1
75  
76 Settings for eth1:
77    Supported ports: [ TP MII ]
78    Supported link modes:   10baseT/Half 10baseT/Full
79                            100baseT/Half 100baseT/Full
80    Supports auto-negotiation: Yes
81    Advertised link modes:  10baseT/Half 10baseT/Full
82    100baseT/Half 100baseT/Full
83    Advertised auto-negotiation: Yes
84    Speed: 100Mb/s
85    Duplex: Full
86    Port: MII
87    PHYAD: 32
88    Transceiver: internal
89    Auto-negotiation: on
90    Supports Wake-on: pumbg
91    Wake-on: d
92    Current message level: 0x00000007 (7)
93    Link detected: yes
94    To quickly check whether your kernel supports bonding, run:     
95    # grep ifenslave /sbin/ifup
96    # which ifenslave
97    /sbin/ifenslave
98 </screen>
99   </section>
100   <section xml:id="dbdoclet.50438258_25353">
101     <title>Bonding Module Parameters</title>
102     <para>Bonding module parameters control various aspects of bonding.</para>
103     <para>Outgoing traffic is mapped across the slave interfaces according to the transmit hash policy. For Lustre, we recommend that you set the <literal>xmit_hash_policy</literal> 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>
104     <screen>$ xmit_hash_policy=layer3+4</screen>
105     <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>
106     <screen>$ miimon=100</screen>
107     <para>For a busy network, increase the timeout.</para>
108   </section>
109   <section xml:id="dbdoclet.50438258_26899">
110     <title>Setting Up Bonding</title>
111     <para>To set up bonding:</para>
112     <orderedlist>
113       <listitem>
114         <para>Create a virtual &apos;bond&apos; interface by creating a configuration file in:</para>
115         <screen>/etc/sysconfig/network-scripts/ # vi /etc/sysconfig/ network-scripts/ifcfg-\
116 bond0</screen>
117       </listitem>
118       <listitem>
119         <para>Append the following lines to the file.</para>
120         <screen>DEVICE=bond0
121 IPADDR=192.168.10.79 # Use the free IP Address of your network
122 NETWORK=192.168.10.0
123 NETMASK=255.255.255.0
124 USERCTL=no
125 BOOTPROTO=none
126 ONBOOT=yes</screen>
127       </listitem>
128       <listitem>
129         <para>Attach one or more slave interfaces to the bond interface. Modify the eth0 and eth1 configuration files (using a VI text editor).</para>
130         <orderedlist>
131           <listitem>
132             <para>Use the VI text editor to open the eth0 configuration file.</para>
133             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth0</screen>
134           </listitem>
135           <listitem>
136             <para>Modify/append the eth0 file as follows:</para>
137             <screen>DEVICE=eth0
138 USERCTL=no
139 ONBOOT=yes
140 MASTER=bond0
141 SLAVE=yes
142 BOOTPROTO=none</screen>
143           </listitem>
144           <listitem>
145             <para>Use the VI text editor to open the eth1 configuration file.</para>
146             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth1</screen>
147           </listitem>
148           <listitem>
149             <para>Modify/append the eth1 file as follows:</para>
150             <screen>DEVICE=eth1
151 USERCTL=no
152 ONBOOT=yes
153 MASTER=bond0
154 SLAVE=yes
155 BOOTPROTO=none
156 </screen>
157           </listitem>
158         </orderedlist>
159       </listitem>
160       <listitem>
161         <para>Set up the bond interface and its options in /etc/modprobe.conf. Start the slave interfaces by your normal network method.</para>
162         <screen># vi /etc/modprobe.conf
163 </screen>
164         <orderedlist>
165           <listitem>
166             <para>Append the following lines to the file.</para>
167             <screen>alias bond0 bonding
168 options bond0 mode=balance-alb miimon=100
169 </screen>
170           </listitem>
171           <listitem>
172             <para>Load the bonding module.</para>
173             <screen># modprobe bonding
174 # ifconfig bond0 up
175 # ifenslave bond0 eth0 eth1
176 </screen>
177           </listitem>
178         </orderedlist>
179       </listitem>
180       <listitem>
181         <para>Start/restart the slave interfaces (using your normal network method).</para>
182         <note>
183           <para>You must <literal>modprobe</literal> the bonding module for each bonded interface. If you wish to create bond0 and bond1, two entries in <literal>modprobe.conf</literal> are required.</para>
184         </note>
185         <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>
186         <para><link xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding">http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link></para>
187       </listitem>
188       <listitem>
189         <para>Check /proc/net/bonding to determine status on bonding. There should be a file there for each bond interface.</para>
190         <screen># cat /proc/net/bonding/bond0
191 Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)
192  
193 Bonding Mode: load balancing (round-robin)
194 MII Status: up
195 MII Polling Interval (ms): 0
196 Up Delay (ms): 0
197 Down Delay (ms): 0
198  
199 Slave Interface: eth0
200 MII Status: up
201 Link Failure Count: 0
202 Permanent HW addr: 4c:00:10:ac:61:e0
203  
204 Slave Interface: eth1
205 MII Status: up
206 Link Failure Count: 0
207 Permanent HW addr: 00:14:2a:7c:40:1d
208 </screen>
209       </listitem>
210       <listitem>
211         <para>Use ethtool or ifconfig to check the interface state. ifconfig lists the first bonded interface as &apos;bond0.&apos;</para>
212         <screen>ifconfig
213 bond0      Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
214    inet addr:192.168.10.79  Bcast:192.168.10.255 \     Mask:255.255.255.0
215    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
216    UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500 Metric:1
217    RX packets:3091 errors:0 dropped:0 overruns:0 frame:0
218    TX packets:880 errors:0 dropped:0 overruns:0 carrier:0
219    collisions:0 txqueuelen:0
220    RX bytes:314203 (306.8 KiB)  TX bytes:129834 (126.7 KiB)
221  
222 eth0       Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
223    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
224    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500 Metric:1
225    RX packets:1581 errors:0 dropped:0 overruns:0 frame:0
226    TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
227    collisions:0 txqueuelen:1000
228    RX bytes:162084 (158.2 KiB)  TX bytes:67245 (65.6 KiB)
229    Interrupt:193 Base address:0x8c00
230  
231 eth1       Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
232    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
233    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500 Metric:1
234    RX packets:1513 errors:0 dropped:0 overruns:0 frame:0
235    TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
236    collisions:0 txqueuelen:1000
237    RX bytes:152299 (148.7 KiB)  TX bytes:64517 (63.0 KiB)
238    Interrupt:185 Base address:0x6000
239 </screen>
240       </listitem>
241     </orderedlist>
242     <section remap="h3">
243       <title>Examples</title>
244       <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>
245       <screen># cat /etc/modprobe.conf
246 alias eth0 8139too
247 alias scsi_hostadapter sata_via
248 alias scsi_hostadapter1 usb-storage
249 alias snd-card-0 snd-via82xx
250 options snd-card-0 index=0
251 options snd-via82xx index=0
252 alias bond0 bonding
253 options bond0 mode=balance-alb miimon=100
254 options lnet networks=tcp
255 alias eth1 via-rhine
256  
257 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
258 DEVICE=bond0
259 BOOTPROTO=none
260 NETMASK=255.255.255.0
261 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
262 ONBOOT=yes
263 USERCTL=no
264  
265 ifcfg-ethx 
266 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
267 TYPE=Ethernet
268 DEVICE=eth0
269 HWADDR=4c:00:10:ac:61:e0
270 BOOTPROTO=none
271 ONBOOT=yes
272 USERCTL=no
273 IPV6INIT=no
274 PEERDNS=yes
275 MASTER=bond0
276 SLAVE=yes
277 </screen>
278       <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>
279       <note>
280         <para>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>
281       </note>
282       <screen>$ /sbin/ifconfig
283  
284 bond0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
285 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
286 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500  Metric:1
287 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
288 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
289 collisions:0 txqueuelen:0
290  
291 eth0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
292 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
293 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1
294 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
295 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
296 collisions:0 txqueuelen:100
297 Interrupt:10 Base address:0x1080
298  
299 eth1Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
300 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
301 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1
302 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
303 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
304 collisions:0 txqueuelen:100
305 Interrupt:9 Base address:0x1400</screen>
306     </section>
307   </section>
308   <section xml:id="dbdoclet.50438258_54769">
309     <title>Configuring Lustre with Bonding</title>
310     <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>
311     <screen>options lnet networks=tcp(bond0)</screen>
312   </section>
313   <section xml:id="dbdoclet.50438258_92244">
314     <title>Bonding References</title>
315     <para>We recommend the following bonding references:</para>
316     <itemizedlist>
317       <listitem>
318         <para>In the Linux kernel source tree, see documentation/networking/bonding.txt</para>
319       </listitem>
320       <listitem>
321         <para><link xl:href="http://linux-ip.net/html/ether-bonding.html">http://linux-ip.net/html/ether-bonding.html</link></para>
322       </listitem>
323       <listitem>
324         <para><link xl:href="http://www.sourceforge.net/projects/bonding">http://www.sourceforge.net/projects/bonding</link></para>
325       </listitem>
326       <listitem>
327         <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>
328       </listitem>
329     </itemizedlist>
330     <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>
331   </section>
332 </chapter>