- 论坛徽章:
- 0
|
A boring work related post this, but I need to keep it somewhere for a while and here is as good as any!
The first thing to do is to discover whether the network card supports miimon, ethtool monitoring or will you have to use arp-monitoring. This will determine the bonding module options that go into the /etc/modprobe.conf.local file. In VMWare using a vlance network card (which shows up in yast as an AMD PCNet - Fast 79C971 card), you can use miimon mode. To determine what capabilities the card in your test machine has, try running ‘ethtool eth0′ at the bash prompt. If you see something like
Settings for eth0
Current message level: 0x00000007 (7)
Link Detected: yes
then you can use miimon mode.
Configure the network card in yast, giving the first card the IP address that you want the bonded interface to have. Give the other network card(s) dummy IP addresses for now - we won’t be using the configuration so it doesn’t matter.
Next, go to a bash prompt and cd to /etc/sysconfig/network. In here there are various scripts and configuration files that control the network settings. The first step is to copy the ifcfg-id… file that you configured with an IP address to. The destination should be ifcfg-bond0 for the first bonded pair. Now that we have a template to start with, we need to discover the PCI bus IDs for the two ‘real’ NICs. At the prompt, type
grep bus-pci ifcfg-eth-id*
You should see somthing like this…
_nm_name='bus-pci-0000:00:11.0'
_nm_name='bus-pci-0000:00:12.0'
which are the addresses of the two physical cards. Using this information, we can now modify our ifcfg-bond0 file to tell it the card details to use. Add in a section like this at the end of the ifcfg-bond0 file.
BONDING_MASTER=yes
BONDING_SLAVE_0='bus-pci-0000:00:11.0'
BONDING_SLAVE_1='bus-pci-0000:00:12.0'
and save the file. The next step is to specify to the system which driver to load when bond0 if referenced. To do this, open the file /etc/modprobe.conf.local (NOT /etc/modprobe.config, that doesn’t survive a system upgrade) and add the lines
alias bond0 bonding
options bonding miimon=100 mode=0 use_carrier=0
This specifies that when we see bond0 being referenced, we need to load the bonding driver with the parameters outlined. The ‘miimon=100′ value tells the driver to use mii monitoring, watching every 100 milliseconds for a link failure. The ‘mode’ parameter specifies one of four bonding policies. The default is round-robin. Possible values are:
0 Round-robin policy: Transmit in a sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
1 Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond’s MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance.
2 XOR policy: Transmit based on [(source MAC address XOR’d with destination MAC address) modula slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
3 Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
If you are testing on VMware, you’ll find that the only working option is to use mode 1, since the emulated switch in VMware Workstation doesn’t seem to support anything else. In theory, it’s possbile to put the parameters in the ifcfg-bond0 file as a new line called BOND_MODULE_OPTS=’yadayada’ but with SLES 9 SP1 this doesn’t appear to work.
Now that we’ve built the configuration, we need to clear out the old ifcfg files that we don’t need. Just rm the ifcfg-eth-id* files in the /etc/sysconfig/network directory (after taking a backup!) and bounce the network.
rcnetwork restart
If all is well, you will see the bond0 interface appearing with the correct IP address and ‘as bonding master’, followed by two ‘enslaving eth’ lines. Verify the configuration using ifconfig and you’ll notice the MAC addresses for all the cards are identical, just as the IP addresses for eth0, eth1 and bond0 are identical.
If needed, you can repeat the process for a second bond, just modify the modprobe.conf.local with an ‘alias bond1 bonding’ line and carry on as before.
Update 9/3/2006:
Per kindly points out the default route requirements in the comments..
/etc/sysconfig/network/routes
adding:
default xx.xx.xx.x
adding that will aid in getting the bonded networkinterface to route outside the subnet.
Thanks Per!
-->
You can also
bookmark this
on del.icio.us or check the
cosmos
RSS feed for comments on this post.
|
TrackBack URI
7 Responses
Rogi
Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-104]March 6th, 2005 at 4:09 pm
No matter how many times I read this — it still makes no sense to me whatsoever.
Think I’ll stick with the cameras.
![]()
Pete
Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-105]March 7th, 2005 at 7:07 pm
Stick at it Rob, it took me the best part of a day to get that arrangement working. I trawled around t’internet looking at shitloads of pages to distill it down to that clear and concise summary!
![]()
Take it easy.
Pete
looby
Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-106]March 11th, 2005 at 12:56 pm
Yeah, not bad, I think you’re basically on the right track there.
:)
radix Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-107]June 2nd, 2005 at 4:51 pm
This article helped me to get bonded channels set up in mere minutes (6 minutes tops). Great job!
jam4ift
Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-108]November 30th, 2005 at 10:50 pm
This info is great
One question
How would I alter this config to support more than one IP address?
Thanks Again for the great Info
Per Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-315]March 9th, 2006 at 3:49 pm
Another helpful thing:
/etc/sysconfig/network/routes
adding:
default xx.xx.xx.x
adding that will aid in getting the bonded networkinterface to route outside the subnet.
Hope it helps!
pete
Says:
[/url]
after publication. }-->
[url=http://www.peteconnolly.co.uk/blog/wordpress/2005/03/04/network-interface-bonding-on-sles-9/#comment-317]March 9th, 2006 at 10:53 pm
Thanks for that Per, I’ll add it in to the article, with credit of course
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/18160/showart_107842.html |
|