Whamcloud - gitweb
FIX: validation
[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           <para><emphasis role="bold">Append the following lines to the file.</emphasis></para>
126         <screen>DEVICE=bond0
127 IPADDR=192.168.10.79 # Use the free IP Address of your network
128 NETWORK=192.168.10.0
129 NETMASK=255.255.255.0
130 USERCTL=no
131 BOOTPROTO=none
132 ONBOOT=yes
133 </screen>
134       </listitem>
135       <listitem>
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>
137         <orderedlist>
138           <listitem>
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
141 </screen>
142           </listitem>
143           <listitem>
144             <para><emphasis role="bold">Modify/append the eth0 file as follows:</emphasis></para>
145             <screen>DEVICE=eth0
146 USERCTL=no
147 ONBOOT=yes
148 MASTER=bond0
149 SLAVE=yes
150 BOOTPROTO=none
151 </screen>
152           </listitem>
153           <listitem>
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
156 </screen>
157           </listitem>
158           <listitem>
159             <para><emphasis role="bold">Modify/append the eth1 file as follows:</emphasis></para>
160             <screen>DEVICE=eth1
161 USERCTL=no
162 ONBOOT=yes
163 MASTER=bond0
164 SLAVE=yes
165 BOOTPROTO=none
166 </screen>
167           </listitem>
168         </orderedlist>
169       </listitem>
170       <listitem>
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
173 </screen>
174         <orderedlist>
175           <listitem>
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
179 </screen>
180           </listitem>
181           <listitem>
182             <para><emphasis role="bold">Load the bonding module.</emphasis></para>
183             <screen># modprobe bonding
184 # ifconfig bond0 up
185 # ifenslave bond0 eth0 eth1
186 </screen>
187           </listitem>
188         </orderedlist>
189       </listitem>
190       <listitem>
191           <para><emphasis role="bold">Start/restart the slave interfaces (using your normal network method).</emphasis></para>
192         <note>
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>
194         </note>
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>
197       </listitem>
198       <listitem>
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)
202  
203 Bonding Mode: load balancing (round-robin)
204 MII Status: up
205 MII Polling Interval (ms): 0
206 Up Delay (ms): 0
207 Down Delay (ms): 0
208  
209 Slave Interface: eth0
210 MII Status: up
211 Link Failure Count: 0
212 Permanent HW addr: 4c:00:10:ac:61:e0
213  
214 Slave Interface: eth1
215 MII Status: up
216 Link Failure Count: 0
217 Permanent HW addr: 00:14:2a:7c:40:1d
218 </screen>
219       </listitem>
220       <listitem>
221         <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>
222         <screen>ifconfig
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)
231  
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
240  
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
249 </screen>
250       </listitem>
251     </orderedlist>
252     <section remap="h3">
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
256 alias eth0 8139too
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
262 alias bond0 bonding
263 options bond0 mode=balance-alb miimon=100
264 options lnet networks=tcp
265 alias eth1 via-rhine
266  
267 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
268 DEVICE=bond0
269 BOOTPROTO=none
270 NETMASK=255.255.255.0
271 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
272 ONBOOT=yes
273 USERCTL=no
274  
275 ifcfg-ethx 
276 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
277 TYPE=Ethernet
278 DEVICE=eth0
279 HWADDR=4c:00:10:ac:61:e0
280 BOOTPROTO=none
281 ONBOOT=yes
282 USERCTL=no
283 IPV6INIT=no
284 PEERDNS=yes
285 MASTER=bond0
286 SLAVE=yes
287 </screen>
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">
290         <tgroup cols="1">
291           <colspec colname="c1" colwidth="100*"/>
292           <tbody>
293             <row>
294               <entry>
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>
296               </entry>
297             </row>
298           </tbody>
299         </tgroup>
300       </informaltable>
301       <screen>$ /sbin/ifconfig
302  
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
309  
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
317  
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
325 </screen>
326     </section>
327   </section>
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)
332 </screen>
333   </section>
334   <section xml:id="dbdoclet.50438258_92244">
335     <title>7.6 Bonding References</title>
336     <para>We recommend the following bonding references:</para>
337     <itemizedlist>
338       <listitem>
339         <para>In the Linux kernel source tree, see documentation/networking/bonding.txt</para>
340       </listitem>
341       <listitem>
342         <para><link xl:href="http://linux-ip.net/html/ether-bonding.html">http://linux-ip.net/html/ether-bonding.html</link></para>
343       </listitem>
344       <listitem>
345         <para><link xl:href="http://www.sourceforge.net/projects/bonding">http://www.sourceforge.net/projects/bonding</link></para>
346       </listitem>
347       <listitem>
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>
349       </listitem>
350     </itemizedlist>
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>
352     <screen> 
353 </screen>
354   </section>
355 </chapter>