Whamcloud - gitweb
LUDOC-394 manual: Remove extra 'held' word
[doc/manual.git] / SettingUpBonding.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <chapter xmlns="http://docbook.org/ns/docbook"
3  xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US"
4  xml:id="settingupbonding">
5   <title xml:id="settingupbonding.title">Setting Up Network Interface Bonding</title>
6   <para>This chapter describes how to use multiple network interfaces in parallel to increase bandwidth and/or redundancy. Topics include:</para>
7   <itemizedlist>
8     <listitem>
9       <para>
10               <xref linkend="dbdoclet.50438258_95824"/>
11           </para>
12     </listitem>
13     <listitem>
14       <para>
15               <xref linkend="dbdoclet.50438258_29107"/>
16           </para>
17     </listitem>
18     <listitem>
19       <para>
20               <xref linkend="dbdoclet.50438258_25353"/>
21           </para>
22     </listitem>
23     <listitem>
24       <para>
25               <xref linkend="dbdoclet.50438258_26899"/>
26           </para>
27     </listitem>
28     <listitem>
29       <para>
30               <xref linkend="dbdoclet.50438258_54769"/>
31           </para>
32     </listitem>
33     <listitem>
34       <para>
35               <xref linkend="dbdoclet.50438258_92244"/>
36           </para>
37     </listitem>
38   </itemizedlist>
39   <note>
40     <para>Using network interface bonding is optional.</para>
41   </note>
42   <section xml:id="dbdoclet.50438258_95824">
43     <title>Network Interface Bonding Overview</title>
44     <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>
45     <para>Several different types of bonding are available in the Linux distribution. All these
46       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>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>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
107       policy. We recommend that you set the <literal>xmit_hash_policy</literal> option to the
108       layer3+4 option for bonding. This policy uses upper layer protocol information if available to
109       generate the hash. This allows traffic to a particular network peer to span multiple slaves,
110       although a single connection does not span multiple slaves.</para>
111     <screen>$ xmit_hash_policy=layer3+4</screen>
112     <para>The <literal>miimon</literal> option enables users to monitor the link status. (The
113       parameter is a time interval in milliseconds.) It makes an interface failure transparent to
114       avoid serious network degradation during link failures. A reasonable default setting is 100
115       milliseconds; run:</para>
116     <screen>$ miimon=100</screen>
117     <para>For a busy network, increase the timeout.</para>
118   </section>
119   <section xml:id="dbdoclet.50438258_26899">
120     <title>Setting Up Bonding</title>
121     <para>To set up bonding:</para>
122     <orderedlist>
123       <listitem>
124         <para>Create a virtual &apos;bond&apos; interface by creating a configuration file:</para>
125         <screen># vi /etc/sysconfig/network-scripts/ifcfg-bond0</screen>
126       </listitem>
127       <listitem>
128         <para>Append the following lines to the file.</para>
129         <screen>DEVICE=bond0
130 IPADDR=192.168.10.79 # Use the free IP Address of your network
131 NETWORK=192.168.10.0
132 NETMASK=255.255.255.0
133 USERCTL=no
134 BOOTPROTO=none
135 ONBOOT=yes</screen>
136       </listitem>
137       <listitem>
138         <para>Attach one or more slave interfaces to the bond interface. Modify the eth0 and eth1 configuration files (using a VI text editor).</para>
139         <orderedlist>
140           <listitem>
141             <para>Use the VI text editor to open the eth0 configuration file.</para>
142             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth0</screen>
143           </listitem>
144           <listitem>
145             <para>Modify/append the eth0 file as follows:</para>
146             <screen>DEVICE=eth0
147 USERCTL=no
148 ONBOOT=yes
149 MASTER=bond0
150 SLAVE=yes
151 BOOTPROTO=none</screen>
152           </listitem>
153           <listitem>
154             <para>Use the VI text editor to open the eth1 configuration file.</para>
155             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth1</screen>
156           </listitem>
157           <listitem>
158             <para>Modify/append the eth1 file as follows:</para>
159             <screen>DEVICE=eth1
160 USERCTL=no
161 ONBOOT=yes
162 MASTER=bond0
163 SLAVE=yes
164 BOOTPROTO=none
165 </screen>
166           </listitem>
167         </orderedlist>
168       </listitem>
169       <listitem>
170         <para>Set up the bond interface and its options in <literal>/etc/modprobe.d/bond.conf</literal>. Start the slave interfaces by your normal network method.</para>
171         <screen># vi /etc/modprobe.d/bond.conf
172 </screen>
173         <orderedlist>
174           <listitem>
175             <para>Append the following lines to the file.</para>
176             <screen>alias bond0 bonding
177 options bond0 mode=balance-alb miimon=100
178 </screen>
179           </listitem>
180           <listitem>
181             <para>Load the bonding module.</para>
182             <screen># modprobe bonding
183 # ifconfig bond0 up
184 # ifenslave bond0 eth0 eth1
185 </screen>
186           </listitem>
187         </orderedlist>
188       </listitem>
189       <listitem>
190         <para>Start/restart the slave interfaces (using your normal network method).</para>
191         <note>
192           <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>bond.conf</literal> file are required.</para>
193         </note>
194         <para>The examples below are from systems running Red Hat Enterprise Linux. For setup use:
195             <literal>/etc/sysconfig/networking-scripts/ifcfg-*</literal> The website referenced
196           below includes detailed instructions for other configuration methods, instructions to use
197           DHCP with bonding, and other setup details. We strongly recommend you use this
198           website.</para>
199         <para><link xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding">http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link></para>
200       </listitem>
201       <listitem>
202         <para>Check /proc/net/bonding to determine status on bonding. There should be a file there for each bond interface.</para>
203         <screen># cat /proc/net/bonding/bond0
204 Ethernet Channel Bonding Driver: v3.0.3 (March 23, 2006)
205  
206 Bonding Mode: load balancing (round-robin)
207 MII Status: up
208 MII Polling Interval (ms): 0
209 Up Delay (ms): 0
210 Down Delay (ms): 0
211  
212 Slave Interface: eth0
213 MII Status: up
214 Link Failure Count: 0
215 Permanent HW addr: 4c:00:10:ac:61:e0
216  
217 Slave Interface: eth1
218 MII Status: up
219 Link Failure Count: 0
220 Permanent HW addr: 00:14:2a:7c:40:1d
221 </screen>
222       </listitem>
223       <listitem>
224         <para>Use ethtool or ifconfig to check the interface state. ifconfig lists the first bonded interface as &apos;bond0.&apos;</para>
225         <screen>ifconfig
226 bond0      Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
227    inet addr:192.168.10.79  Bcast:192.168.10.255 \     Mask:255.255.255.0
228    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
229    UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500 Metric:1
230    RX packets:3091 errors:0 dropped:0 overruns:0 frame:0
231    TX packets:880 errors:0 dropped:0 overruns:0 carrier:0
232    collisions:0 txqueuelen:0
233    RX bytes:314203 (306.8 KiB)  TX bytes:129834 (126.7 KiB)
234  
235 eth0       Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
236    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
237    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500 Metric:1
238    RX packets:1581 errors:0 dropped:0 overruns:0 frame:0
239    TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
240    collisions:0 txqueuelen:1000
241    RX bytes:162084 (158.2 KiB)  TX bytes:67245 (65.6 KiB)
242    Interrupt:193 Base address:0x8c00
243  
244 eth1       Link encap:Ethernet  HWaddr 4C:00:10:AC:61:E0
245    inet6 addr: fe80::4e00:10ff:feac:61e0/64 Scope:Link
246    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500 Metric:1
247    RX packets:1513 errors:0 dropped:0 overruns:0 frame:0
248    TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
249    collisions:0 txqueuelen:1000
250    RX bytes:152299 (148.7 KiB)  TX bytes:64517 (63.0 KiB)
251    Interrupt:185 Base address:0x6000
252 </screen>
253       </listitem>
254     </orderedlist>
255     <section remap="h3">
256       <title>Examples</title>
257       <para>This is an example showing <literal>bond.conf</literal> entries for bonding Ethernet interfaces <literal>eth1</literal> and <literal>eth2</literal> to <literal>bond0</literal>:</para>
258       <screen># cat /etc/modprobe.d/bond.conf
259 alias eth0 8139too
260 alias eth1 via-rhine
261 alias bond0 bonding
262 options bond0 mode=balance-alb miimon=100
263  
264 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
265 DEVICE=bond0
266 BOOTPROTO=none
267 NETMASK=255.255.255.0
268 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
269 ONBOOT=yes
270 USERCTL=no
271  
272 ifcfg-ethx 
273 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
274 TYPE=Ethernet
275 DEVICE=eth0
276 HWADDR=4c:00:10:ac:61:e0
277 BOOTPROTO=none
278 ONBOOT=yes
279 USERCTL=no
280 IPV6INIT=no
281 PEERDNS=yes
282 MASTER=bond0
283 SLAVE=yes
284 </screen>
285       <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>
286       <note>
287         <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>
288       </note>
289       <screen>$ /sbin/ifconfig
290  
291 bond0Link 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 MASTER MULTICAST MTU:1500  Metric:1
294 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
295 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
296 collisions:0 txqueuelen:0
297  
298 eth0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
299 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
300 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1
301 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
302 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
303 collisions:0 txqueuelen:100
304 Interrupt:10 Base address:0x1080
305  
306 eth1Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
307 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
308 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1
309 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
310 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
311 collisions:0 txqueuelen:100
312 Interrupt:9 Base address:0x1400</screen>
313     </section>
314   </section>
315   <section xml:id="dbdoclet.50438258_54769">
316     <title>Configuring a Lustre File System with Bonding</title>
317     <para>The Lustre software uses the IP address of the bonded interfaces and requires no special
318       configuration. The bonded interface is treated as a regular TCP/IP interface. If needed,
319       specify <literal>bond0</literal> using the Lustre <literal>networks</literal> parameter in
320         <literal>/etc/modprobe</literal>.</para>
321     <screen>options lnet networks=tcp(bond0)</screen>
322   </section>
323   <section xml:id="dbdoclet.50438258_92244">
324     <title>Bonding References</title>
325     <para>We recommend the following bonding references:</para>
326     <itemizedlist>
327       <listitem>
328         <para>In the Linux kernel source tree, see
329             <literal>documentation/networking/bonding.txt</literal></para>
330       </listitem>
331       <listitem>
332         <para><link xl:href="http://linux-ip.net/html/ether-bonding.html"
333             >http://linux-ip.net/html/ether-bonding.html</link>.</para>
334       </listitem>
335       <listitem>
336         <para><link xl:href="http://www.sourceforge.net/projects/bonding"
337             >http://www.sourceforge.net/projects/bonding</link>.</para>
338       </listitem>
339       <listitem>
340         <para>Linux Foundation bonding website: <link
341             xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding"
342             >http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link>. This
343           is the most extensive reference and we highly recommend it. This website includes
344           explanations of more complicated setups, including the use of DHCP with bonding.</para>
345       </listitem>
346     </itemizedlist>
347   </section>
348 </chapter>
349 <!--
350   vim:expandtab:shiftwidth=2:tabstop=8:
351   -->