Whamcloud - gitweb
LUDOC-11 osc: document tunable parameters
[doc/manual.git] / SettingUpBonding.xml
1 <?xml version='1.0' encoding='UTF-8'?><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">
2   <title xml:id="settingupbonding.title">Setting Up Network Interface Bonding</title>
3   <para>This chapter describes how to use multiple network interfaces in parallel to increase bandwidth and/or redundancy. Topics include:</para>
4   <itemizedlist>
5     <listitem>
6       <para>
7               <xref linkend="dbdoclet.50438258_95824"/>
8           </para>
9     </listitem>
10     <listitem>
11       <para>
12               <xref linkend="dbdoclet.50438258_29107"/>
13           </para>
14     </listitem>
15     <listitem>
16       <para>
17               <xref linkend="dbdoclet.50438258_25353"/>
18           </para>
19     </listitem>
20     <listitem>
21       <para>
22               <xref linkend="dbdoclet.50438258_26899"/>
23           </para>
24     </listitem>
25     <listitem>
26       <para>
27               <xref linkend="dbdoclet.50438258_54769"/>
28           </para>
29     </listitem>
30     <listitem>
31       <para>
32               <xref linkend="dbdoclet.50438258_92244"/>
33           </para>
34     </listitem>
35   </itemizedlist>
36   <note>
37     <para>Using network interface bonding is optional.</para>
38   </note>
39   <section xml:id="dbdoclet.50438258_95824">
40     <title>Network Interface Bonding Overview</title>
41     <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>
42     <para>Several different types of bonding are available in the Linux distribution. All these
43       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
104       policy. We recommend that you set the <literal>xmit_hash_policy</literal> option to the
105       layer3+4 option for bonding. This policy uses upper layer protocol information if available to
106       generate the hash. This allows traffic to a particular network peer to span multiple slaves,
107       although a single connection does not span multiple slaves.</para>
108     <screen>$ xmit_hash_policy=layer3+4</screen>
109     <para>The <literal>miimon</literal> option enables users to monitor the link status. (The
110       parameter is a time interval in milliseconds.) It makes an interface failure transparent to
111       avoid serious network degradation during link failures. A reasonable default setting is 100
112       milliseconds; run:</para>
113     <screen>$ miimon=100</screen>
114     <para>For a busy network, increase the timeout.</para>
115   </section>
116   <section xml:id="dbdoclet.50438258_26899">
117     <title>Setting Up Bonding</title>
118     <para>To set up bonding:</para>
119     <orderedlist>
120       <listitem>
121         <para>Create a virtual &apos;bond&apos; interface by creating a configuration file:</para>
122         <screen># vi /etc/sysconfig/network-scripts/ifcfg-bond0</screen>
123       </listitem>
124       <listitem>
125         <para>Append the following lines to the file.</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</screen>
133       </listitem>
134       <listitem>
135         <para>Attach one or more slave interfaces to the bond interface. Modify the eth0 and eth1 configuration files (using a VI text editor).</para>
136         <orderedlist>
137           <listitem>
138             <para>Use the VI text editor to open the eth0 configuration file.</para>
139             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth0</screen>
140           </listitem>
141           <listitem>
142             <para>Modify/append the eth0 file as follows:</para>
143             <screen>DEVICE=eth0
144 USERCTL=no
145 ONBOOT=yes
146 MASTER=bond0
147 SLAVE=yes
148 BOOTPROTO=none</screen>
149           </listitem>
150           <listitem>
151             <para>Use the VI text editor to open the eth1 configuration file.</para>
152             <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth1</screen>
153           </listitem>
154           <listitem>
155             <para>Modify/append the eth1 file as follows:</para>
156             <screen>DEVICE=eth1
157 USERCTL=no
158 ONBOOT=yes
159 MASTER=bond0
160 SLAVE=yes
161 BOOTPROTO=none
162 </screen>
163           </listitem>
164         </orderedlist>
165       </listitem>
166       <listitem>
167         <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>
168         <screen># vi /etc/modprobe.d/bond.conf
169 </screen>
170         <orderedlist>
171           <listitem>
172             <para>Append the following lines to the file.</para>
173             <screen>alias bond0 bonding
174 options bond0 mode=balance-alb miimon=100
175 </screen>
176           </listitem>
177           <listitem>
178             <para>Load the bonding module.</para>
179             <screen># modprobe bonding
180 # ifconfig bond0 up
181 # ifenslave bond0 eth0 eth1
182 </screen>
183           </listitem>
184         </orderedlist>
185       </listitem>
186       <listitem>
187         <para>Start/restart the slave interfaces (using your normal network method).</para>
188         <note>
189           <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>
190         </note>
191         <para>The examples below are from systems running Red Hat Enterprise Linux. For setup use:
192             <literal>/etc/sysconfig/networking-scripts/ifcfg-*</literal> The website referenced
193           below includes detailed instructions for other configuration methods, instructions to use
194           DHCP with bonding, and other setup details. We strongly recommend you use this
195           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>Check /proc/net/bonding to determine status on bonding. There should be a file there for each bond interface.</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>Use ethtool or ifconfig to check the interface state. ifconfig lists the first bonded interface as &apos;bond0.&apos;</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>Examples</title>
254       <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>
255       <screen># cat /etc/modprobe.d/bond.conf
256 alias eth0 8139too
257 alias eth1 via-rhine
258 alias bond0 bonding
259 options bond0 mode=balance-alb miimon=100
260  
261 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
262 DEVICE=bond0
263 BOOTPROTO=none
264 NETMASK=255.255.255.0
265 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
266 ONBOOT=yes
267 USERCTL=no
268  
269 ifcfg-ethx 
270 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
271 TYPE=Ethernet
272 DEVICE=eth0
273 HWADDR=4c:00:10:ac:61:e0
274 BOOTPROTO=none
275 ONBOOT=yes
276 USERCTL=no
277 IPV6INIT=no
278 PEERDNS=yes
279 MASTER=bond0
280 SLAVE=yes
281 </screen>
282       <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>
283       <note>
284         <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>
285       </note>
286       <screen>$ /sbin/ifconfig
287  
288 bond0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
289 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
290 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500  Metric:1
291 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
292 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
293 collisions:0 txqueuelen:0
294  
295 eth0Link encap:EthernetHwaddr 00:C0:F0:1F:37:B4
296 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
297 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500  Metric:1
298 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
299 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
300 collisions:0 txqueuelen:100
301 Interrupt:10 Base address:0x1080
302  
303 eth1Link 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 SLAVE MULTICAST MTU:1500  Metric:1
306 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
307 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
308 collisions:0 txqueuelen:100
309 Interrupt:9 Base address:0x1400</screen>
310     </section>
311   </section>
312   <section xml:id="dbdoclet.50438258_54769">
313     <title>Configuring a Lustre File System with Bonding</title>
314     <para>The Lustre software uses the IP address of the bonded interfaces and requires no special
315       configuration. The bonded interface is treated as a regular TCP/IP interface. If needed,
316       specify <literal>bond0</literal> using the Lustre <literal>networks</literal> parameter in
317         <literal>/etc/modprobe</literal>.</para>
318     <screen>options lnet networks=tcp(bond0)</screen>
319   </section>
320   <section xml:id="dbdoclet.50438258_92244">
321     <title>Bonding References</title>
322     <para>We recommend the following bonding references:</para>
323     <itemizedlist>
324       <listitem>
325         <para>In the Linux kernel source tree, see
326             <literal>documentation/networking/bonding.txt</literal></para>
327       </listitem>
328       <listitem>
329         <para><link xl:href="http://linux-ip.net/html/ether-bonding.html"
330             >http://linux-ip.net/html/ether-bonding.html</link>.</para>
331       </listitem>
332       <listitem>
333         <para><link xl:href="http://www.sourceforge.net/projects/bonding"
334             >http://www.sourceforge.net/projects/bonding</link>.</para>
335       </listitem>
336       <listitem>
337         <para>Linux Foundation bonding website: <link
338             xl:href="http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding"
339             >http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding</link>. This
340           is the most extensive reference and we highly recommend it. This website includes
341           explanations of more complicated setups, including the use of DHCP with bonding.</para>
342       </listitem>
343     </itemizedlist>
344   </section>
345 </chapter>