Whamcloud - gitweb
FIX: removed redundant anchors
[doc/manual.git] / SettingUpBonding.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <chapter version="5.0" xml:lang="en-US" xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" xml:id='settingupbonding'>
3   <info>
4     <title xml:id='settingupbonding.title'>Setting Up Network Interface Bonding</title>
5   </info>
6
7   <para>This chapter describes how to use multiple network interfaces in parallel to increase bandwidth and/or redundancy. Topics include:</para>
8
9   <itemizedlist>
10       <listitem>
11           <para>
12               <xref linkend='dbdoclet.50438258_95824'/>
13           </para>
14       </listitem>
15       <listitem>
16           <para>
17               <xref linkend='dbdoclet.50438258_29107'/>
18           </para>
19       </listitem>
20       <listitem>
21           <para>
22               <xref linkend='dbdoclet.50438258_25353'/>
23           </para>
24       </listitem>
25       <listitem>
26           <para>
27               <xref linkend='dbdoclet.50438258_26899'/>
28           </para>
29       </listitem>
30       <listitem>
31           <para>
32               <xref linkend='dbdoclet.50438258_54769'/>
33           </para>
34       </listitem>
35       <listitem>
36           <para>
37               <xref linkend='dbdoclet.50438258_92244'/>
38           </para>
39       </listitem>
40   </itemizedlist>
41
42   <note><para>Using network interface bonding is optional.</para></note>
43
44
45     <section xml:id="dbdoclet.50438258_95824">
46       <title>7.1 Network Interface Bonding Overview</title>
47       <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>
48       <para>Several different types of bonding are available in Linux. All these types are referred to as 'modes', and use the bonding kernel module.</para>
49       <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 'mode 4' or '802.3ad.'</para>
50     </section>
51     <section xml:id="dbdoclet.50438258_29107">
52       <title>7.2 Requirements</title>
53       <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>
54       <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>
55       <para>To verify that your interface works with ethtool, run:</para>
56       <screen># which ethtool
57 /sbin/ethtool
58  
59 # ethtool eth0
60 Settings for eth0:
61            Supported ports: [ TP MII ]
62            Supported link modes:   10baseT/Half 10baseT/Full/ 
63                                    100baseT/Half 100baseT/Full
64            Supports auto-negotiation: Yes
65            Advertised link modes:  10baseT/Half 10baseT/Full
66                                    100baseT/Half 100baseT/Full
67            Advertised auto-negotiation: Yes
68            Speed: 100Mb/s
69            Duplex: Full
70            Port: MII
71            PHYAD: 1
72            Transceiver: internal
73            Auto-negotiation: on
74            Supports Wake-on: pumbg
75            Wake-on: d
76            Current message level: 0x00000001 (1)
77            Link detected: yes
78  
79 # ethtool eth1
80  
81 Settings for eth1:
82    Supported ports: [ TP MII ]
83    Supported link modes:   10baseT/Half 10baseT/Full
84                            100baseT/Half 100baseT/Full
85    Supports auto-negotiation: Yes
86    Advertised link modes:  10baseT/Half 10baseT/Full
87    100baseT/Half 100baseT/Full
88    Advertised auto-negotiation: Yes
89    Speed: 100Mb/s
90    Duplex: Full
91    Port: MII
92    PHYAD: 32
93    Transceiver: internal
94    Auto-negotiation: on
95    Supports Wake-on: pumbg
96    Wake-on: d
97    Current message level: 0x00000007 (7)
98    Link detected: yes
99    To quickly check whether your kernel supports bonding, run:     
100    # grep ifenslave /sbin/ifup
101    # which ifenslave
102    /sbin/ifenslave
103 </screen>
104     </section>
105     <section xml:id="dbdoclet.50438258_25353">
106       <title>7.3 Bonding Module Parameters</title>
107       <para>Bonding module parameters control various aspects of bonding.</para>
108       <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>
109       <screen>$ xmit_hash_policy=layer3+4
110 </screen>
111       <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>
112       <screen>$ miimon=100
113 </screen>
114       <para>For a busy network, increase the timeout.</para>
115     </section>
116     <section xml:id="dbdoclet.50438258_26899">
117       <title>7.4 Setting Up Bonding</title>
118       <para>To set up bonding:</para>
119
120       <orderedlist>
121           <listitem>
122       <para>Create a virtual &apos;bond&apos; interface by creating a configuration file in:</para>
123       <screen>/etc/sysconfig/network-scripts/ # vi /etc/sysconfig/ network-scripts/ifcfg-\
124 bond0
125 </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
136 </screen>
137           </listitem>
138           <listitem>
139       <para> Attach one or more slave interfaces to the bond interface. Modify the eth0 and eth1 configuration files (using a VI text editor).</para>
140       <orderedlist>
141           <listitem>
142       <para>Use the VI text editor to open the eth0 configuration file.</para>
143       <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth0
144 </screen>
145           </listitem>
146           <listitem>
147       <para>Modify/append the eth0 file as follows:</para>
148       <screen>DEVICE=eth0
149 USERCTL=no
150 ONBOOT=yes
151 MASTER=bond0
152 SLAVE=yes
153 BOOTPROTO=none
154 </screen>
155           </listitem>
156           <listitem>
157       <para>Use the VI text editor to open the eth1 configuration file.</para>
158       <screen># vi /etc/sysconfig/network-scripts/ifcfg-eth1
159 </screen>
160           </listitem>
161           <listitem>
162       <para>Modify/append the eth1 file as follows:</para>
163       <screen>DEVICE=eth1
164 USERCTL=no
165 ONBOOT=yes
166 MASTER=bond0
167 SLAVE=yes
168 BOOTPROTO=none
169 </screen>
170           </listitem>
171           </orderedlist>
172           </listitem>
173           <listitem>
174       <para>Set up the bond interface and its options in /etc/modprobe.conf. Start the slave interfaces by your normal network method.</para>
175       <screen># vi /etc/modprobe.conf
176 </screen>
177       <orderedlist>
178           <listitem>
179       <para>Append the following lines to the file.</para>
180       <screen>alias bond0 bonding
181 options bond0 mode=balance-alb miimon=100
182 </screen>
183           </listitem>
184           <listitem>
185       <para>Load the bonding module.</para>
186       <screen># modprobe bonding
187 # ifconfig bond0 up
188 # ifenslave bond0 eth0 eth1
189 </screen>
190           </listitem>
191           </orderedlist>
192           </listitem>
193           <listitem>
194       <para>Start/restart the slave interfaces (using your normal network method).</para>
195
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></note>
198
199       <para>The examples below are from RedHat systems. For setup use: /etc/sysconfig/networking-scripts/ifcfg-* 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>Check /proc/net/bonding to determine status on bonding. There should be a file there for each bond interface.</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>Use ethtool or ifconfig to check the interface state. ifconfig lists the first bonded interface as 'bond0.'</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
257
258       <section remap="h3">
259         <title>7.4.1 Examples</title>
260         <para>This is an example showing modprobe.conf entries for bonding Ethernet interfaces eth1 and eth2 to bond0:</para>
261         <screen># cat /etc/modprobe.conf
262 alias eth0 8139too
263 alias scsi_hostadapter sata_via
264 alias scsi_hostadapter1 usb-storage
265 alias snd-card-0 snd-via82xx
266 options snd-card-0 index=0
267 options snd-via82xx index=0
268 alias bond0 bonding
269 options bond0 mode=balance-alb miimon=100
270 options lnet networks=tcp
271 alias eth1 via-rhine
272  
273 # cat /etc/sysconfig/network-scripts/ifcfg-bond0
274 DEVICE=bond0
275 BOOTPROTO=none
276 NETMASK=255.255.255.0
277 IPADDR=192.168.10.79 # (Assign here the IP of the bonded interface.)
278 ONBOOT=yes
279 USERCTL=no
280  
281 ifcfg-ethx 
282 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
283 TYPE=Ethernet
284 DEVICE=eth0
285 HWADDR=4c:00:10:ac:61:e0
286 BOOTPROTO=none
287 ONBOOT=yes
288 USERCTL=no
289 IPV6INIT=no
290 PEERDNS=yes
291 MASTER=bond0
292 SLAVE=yes
293 </screen>
294         <para>In the following example, the bond0 interface is the master (MASTER) while eth0 and eth1 are slaves (SLAVE).</para>
295         <informaltable frame="none">
296           <tgroup cols="1">
297             <colspec colname="c1" colwidth="100*"/>
298             <tbody>
299               <row>
300                 <entry><para><emphasis role="bold">Note -</emphasis>All slaves of bond0 have the same MAC address (Hwaddr) - bond0. All modes, except TLB and ALB, have this MAC address. TLB and ALB require a unique MAC address for each slave.</para></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><listitem>
342           <para> In the Linux kernel source tree, see documentation/networking/bonding.txt</para>
343         </listitem>
344 <listitem>
345           <para><link xl:href="http://linux-ip.net/html/ether-bonding.html">http://linux-ip.net/html/ether-bonding.html</link></para>
346         </listitem>
347 <listitem>
348           <para><link xl:href="http://www.sourceforge.net/projects/bonding">http://www.sourceforge.net/projects/bonding</link></para>
349         </listitem>
350 <listitem>
351           <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>
352         </listitem>
353 </itemizedlist>
354       <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>
355       <screen> 
356 </screen>
357     </section>
358 </chapter>