📄 867.html
字号:
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=100
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=98
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=79
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=103
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=26
border=0></TD>
<TD><IMG height=1 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR>
<TR>
<TD colSpan=3><A title=linux知识宝库
href="index.html" tppabs="http://www.linuxhero.com/docs/index.html"><IMG height=83
src="images/header_r1_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c1.gif" width=472 border=0
name=header_r1_c1></A></TD>
<TD colSpan=3>
<form action="http://www.linuxhero.com/docs/search.html" method=get>
<table
style="BORDER-RIGHT: #c4c4c4 1px solid; BORDER-TOP: #c4c4c4 1px solid; BORDER-LEFT: #c4c4c4 1px solid; BORDER-BOTTOM: #c4c4c4 1px solid"
cellspacing=0 cellpadding=3 width="95%" border=0 align="center">
<tbody>
<tr>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif">
<div align=center><font class=normalfont>搜索文章:
<input type=hidden value=result name=action2>
<input type=radio checked value=title name=type>标题
<input type=radio value=content name=type>内容
<input type=image src="images/button_go.gif" tppabs="http://www.linuxhero.com/docs/images/button_go.gif" border=0 name=image2>
</font></div>
</td>
</tr>
<tr>
<td noWrap>
<div align="center">
<input maxlength=100 size=30 name=keyword2>
</div>
</td>
</tr></tbody>
</table>
</form>
</TD>
<TD rowSpan=2><IMG src="images/header_r1_c7.gif" tppabs="http://www.linuxhero.com/docs/images/header_r1_c7.gif" width=26 border=0 name=header_r1_c7></TD>
<TD><IMG height=83 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1 border=0></TD></TR>
<TR>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif"><IMG height=22
src="images/header_r2_c1.gif" tppabs="http://www.linuxhero.com/docs/images/header_r2_c1.gif" width=296 border=0
name=header_r2_c1></TD>
<TD background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colSpan=5>
<DIV align=right><FONT class=normalfont>当前位置:
<A href="index.html" tppabs="http://www.linuxhero.com/docs/index.html">本站首页</A>
<font color="#FF6699">>></font>
<A href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</A> | <A href="copyright.html" tppabs="http://www.linuxhero.com/docs/copyright.html">版权说明</A></font></DIV>
</TD>
<TD><IMG height=22 src="images/spacer.gif" tppabs="http://www.linuxhero.com/docs/images/spacer.gif" width=1
border=0></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=10 cellPadding=0 width="100%" bgColor=#ffffff
border=0>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
<TR>
<TD vAlign=top align=middle width="60%">
<TABLE cellSpacing=0 cellPadding=0 width="100%"
background="images/back.gif" tppabs="http://www.linuxhero.com/docs/images/back.gif" border=0>
<TBODY>
<TR>
<TD vAlign=top width="80%">
<DIV align=center>
<FORM action="search.html" tppabs="http://www.linuxhero.com/docs/search.html" method=get>
</FORM>
<TABLE cellSpacing=0 cellPadding=0 width="95%"
border=0><TBODY>
<TR>
<TD background="images/bgi.gif" tppabs="http://www.linuxhero.com/docs/images/bgi.gif"
height=30></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=3 width="95%"
align=center border=0>
<TBODY>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=3 width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top>
<p><FONT class=normalfont><B><font color=blue>双网卡单IP</font></B></FONT><BR><FONT class=smallfont color=#ff9900>2004-04-23 15:18 pm</FONT><BR><FONT class=normalfont>作者:作者<br>来自:Linux知识宝库<br>联系方式:无名<br><br>我以前关心过这个事情,当时因为LINUX网关流量不大,没实际做捆绑,还有就是不知道对交换机设置有没有要求。<br>
<br>
将多块网卡虚拟成为一块网卡,使其具有相同的IP地址,来实现提升主机的网络吞吐量或者是提高可用性,这种技术被称作bonding。这项技术其实在sun和cisco中已经存在,分别称为Trunking和etherchannel技术,在Linux中,这种技术称为bonding。 <br>
bonding驱动最早来自于Donald Becker的beowulf对kernel2.0的补丁。但是已经有了很大的改进和变化,最早来自于extreme-linux和beowulf的工具已经不适用于现在版本的驱动了。 <br>
对于新版本的驱动,请参考本文最后的链结地址。 <br>
1、安装 <br>
1) 编译带有bonding driver的内核 <br>
对于最新版本的bonding驱动,使用内核2.2.18或以上版本(否则需要对内核打补丁)。 <br>
使用make menuconfig/xconfig/config来编译内核,并在"Network device support"部分选择 "Bonding driver support",这里推荐配置该驱动为模块方式,因为目前这是传递给参数给驱动并配置多个bonding设备的唯一方法。 <br>
编译和安装新的内核和模块: <br>
make dep;make clean;make bzImage;make modules;make modules_install; <br>
2) 获取并安装用户管理工具 <br>
这个版本的bonding驱动需要新的ifenslave程序。来自extreme-linux和beowulf的原始工具程序不能在这里使用。内核 2.2.18及其以上版本在Documentation/network中包含文件ifenslave.c。对于更老的内核,请参考文章最后的资源链结部分的内容。 <br>
安装ifenslave.c: <br>
# gcc -O2 -s -o ifenslave ifenslave.c# cp ifenslave /sbin/ifenslave <br>
3) 配置系统 <br>
参考下一部分关于模块参数的内容。首先需要在/etc/conf.modules中添加如下内容: <br>
alias bond0 bonding <br>
使用标准的发布技术来定义bond0这个网络接口,例如在redhat发布中,在/etc/sysconfig/network-scripts目录中添加ifcfg-bond0文件: <br>
DEVICE=bond0IPADDR=192.168.1.1NETMASK=255.255.255.0NETWORK=192.168.1.0BROADCAST=192.168.1.255ONBOOT=yesBOOTPROTO=noneUSERCTL=no <br>
所有属于bond的接口动必须被定义为SLAVE或MASTER。例如,在Redhat中,如果希望定义eth0和eth1定义为属于接口bond0的一部分,那么它们的配置文件(ifcfg-eth0, ifcfg-eth1,等)间如下所示: <br>
DEVICE=eth0USERCTL=noONBOOT=yesMASTER=bond0SLAVE=yesBOOTPROTO=none <br>
。 <br>
如果管理工具支持可以重新启动网络子系统或者仅仅启动bonding设备,否则重新启动机器。(对于redhat发布,使用`ifup bond0'或`/etc/rc.d/init.d/network restart') <br>
如果你的发布提供的管理工具不支持在网络接口配置中定义master/slave,则需要使用下面的命令手工配置bonding设备: <br>
# /sbin/ifconfig bond0 192.168.1.1 up# /sbin/ifenslave bond0 eth0# /sbin/ifenslave bond0 eth1 <br>
当然也可以将这些命令定义为一个脚本,以方便执行。 <br>
4) 模块参数 <br>
下面的模块参数可能被传递: <br>
mode= <br>
可能的值为0(默认的轮转模式round robin policy),或者1(热备份模式),参考下面的HA部分来得到更多的相关信息。 <br>
miimon= <br>
整数值,定义MII链路监测频率(单位为频率)。默认值为0,表示关闭链路监测。如果希望使用链路监测,一个合适的值为100。参考HA部分得到更多信息。 <br>
downdelay= <br>
在发现链路故障时,这里规定的整数值定义disable一个链路的延迟(单位为毫秒)。必须是miimon的整数倍。默认值为0。参考HA部分得到更多信息。 <br>
updelay= <br>
侦测到"link up"状态时,这里规定的整数值定义了enable一个链路的延迟。必须是miimon的整数倍。默认值为0。参考HA部分得到更多信息。 <br>
如果需要定义多个bonding设备,驱动必须被多次加载。例如,对于有两个bonding设备的情况,/etc/conf.modlues必须包含如下内容: <br>
alias bond0 bondingalias bond1 bonding <br>
options bond0 miimon=100options bond1 -o bonding1 miimon=100 <br>
5) 测试配置 <br>
可以通过ifconfig命令来监测配置和传输策略,例如对于轮转策略,你应该得到如下信息: <br>
[root]# /sbin/ifconfigbond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0collisions:0 txqueuelen:0 <br>
eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0collisions:0 txqueuelen:100 Interrupt:10 Base address:0x1080 <br>
eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:100 Interrupt:9 Base address:0x1400 <br>
问题: <br>
1. bonding会不会和SMP冲突? <br>
不会,老的2.0.xx版本配合SMP使用会发生冲突,而新的内核不会发生问题。 <br>
2. 哪种类型的网卡可以用作bonding? <br>
任何类型的网卡(甚至可以使用混合类型的网卡-一个Intel的therExpress PRO/100和a 3com 3c905b),甚至可以将两个Gigabit以太网卡bond在一起使用。 <br>
3. 我可以拥有多少个bonding设备? <br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -