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