快速业务通道

使用bonding技术实现双网卡绑定

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-05-13
在Linux系统中使用bonding技术,可以将两块网卡绑定为一个对外IP使用,以达到高可用或负载均衡的目的.以下简要介绍该技术的使用. 1.安装两块网卡
在linux系统下将两块网卡配置好,使其均能独立工作.可能会碰到驱动问题,自己想办法解决吧,无非是在内核配置里找或者找第三方的.
网卡不一定要一个型号,我用的一块是独立的,一块是集成的,也没什么问题. 2.编译内核
在内核中添加bonding的支持.
在原码目录下make menuconfig
选上device drivers -> network device support -> bonding driver support
一般来说2.4以上默认是选上的,我用的2.6.22
编译内核其他过程不再赘述 3.bonding配置
以下是截取源代码目录下/Documentation/networking/bonding.txt中的一段说明 3.2 Configuration with Initscripts Support
------------------------------------------ This section applies to distros using a version of initscripts with bonding support, for example, Red Hat Linux 9 or Red Hat Enterprise Linux version 3 or 4. On these systems, the network
initialization scripts have some knowledge of bonding, and can be configured to control bonding devices. These distros will not automatically load the network adapter driver unless the ethX device is configured with an IP address. Because of this constraint, users must manually configure a
network-script file for all physical adapters that will be members of a bondX link. Network script files are located in the directory: /etc/sysconfig/network-scripts The file name must be prefixed with "ifcfg-eth" and suffixed with the adapter''s physical adapter number. For example, the script for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.Place the following text in the file:DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none The DEVICE= line will be different for every ethX device and must correspond with the name of the file, i.e., ifcfg-eth1 must have a device line of DEVICE=eth1. The setting of the MASTER= line will also depend on the final bonding interface name chosen for your bond. As with other network devices, these typically start at 0, and go up one for each device, i.e., the first bonding instance is bond0, the second is bond1, and so on. Next, create a bond network script. The file name for this script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is the number of the bond. For bond0 the file is named "ifcfg-bond0",
for bond1 it is named "ifcfg-bond1", and so on. Within that file, place the following text: DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no Be sure to change the networking specific lines (IPADDR, NETMASK, NETWORK and BROADCAST) to match your network configuration. Finally, it is necessary to edit /etc/modules.conf (or /etc/modprobe.conf, depending upon your distro) to load the bonding module with your desired options when the bond0 interface is brought
up. The following lines in /etc/modules.conf (or modprobe.conf) will load the bonding module, and select its options: alias bond0 bo

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号