Chinaunix首页 | 论坛 | 博客
  • 博客访问: 476163
  • 博文数量: 86
  • 博客积分: 4052
  • 博客等级: 上校
  • 技术积分: 914
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-01 15:21
个人简介

If you don’t like this government, it won’t last forever.

文章分类

全部博文(86)

文章存档

2016年(2)

2015年(1)

2014年(4)

2013年(4)

2008年(4)

2007年(53)

2006年(17)

2005年(1)

我的朋友

分类: LINUX

2007-09-27 15:56:56

                          linux下多网卡Bonding

将多块网卡虚拟成为一块网卡,使它们具有相同的IP地址。这项技术其实在SUN和Cisco的产品中已经存在,分别称为Trunking和etherchannel技术,在Linux中,这种技术称为Bonding。
因为Bonding在内核2.4.x中已经包含了,我们只需要在编译的时候把网络设备选项中的Bonding driver support选中就可以了。然后,重新编译核心,重新启动计算机,执行如下命令:


ismod bonding
ifconfig eth0 down
ifconfig eth1 down
ifconfig bond0 10.10.8.86 netmask 255.255.255.0 up
ifenslave bond0 eth0 eth1
route add default gw 10.10.8.1



现在两块网卡已经能像一块网卡一样工作了。这样可以提高集群节点间的数据传输速度。当然,最好把这几句命令写成一个脚本,再由/etc/rc.d/rc.local调用,以便一开机就生效。
Bonding技术对于服务器来说是个比较好的选择,在没有千兆网卡时,用两三块100bps的网卡作Bonding,可大大提高服务器到交换机之间的带宽,但是需要在交换机上将连接Bonding网卡的两个端口映射为同一个虚拟接口。
 
加载模块:
Modprobe bonding

以下是bond0,eth0,eth1的配置信息
/etc/sysconfig/network-script/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.1.199
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
/etc/sysconfig/network-script/ifcfg-eth1
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
PEERDNS=no
TYPE=Ethernet
/etc/sysconfig/network-script/ifcfg-eth0
DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
PEERDNS=no
TYPE=Ethernet

模块加载文件的配置
/etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1

在开机启动的脚本增加
/etc/rc.d/rc.local
ifenslave bond0 eth0 eth1
阅读(1511) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-03-04 23:32:50

多谢刚好用到