免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123
最近访问板块 发新帖
楼主: cgweb
打印 上一主题 下一主题

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2003-12-04 09:17 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

搞定了,
關於雙網卡 負載均衡冗余
  1. [root@localhost root]# cat /etc/modules.conf
  2. alias eth0 8139too
  3. alias eth1 8139too
  4. alias bond0 bonding
  5. #=========================================#
  6. options bond0 miimon=100 mode=0
  7. #options bond0 miimon=100 mode=1
  8. #=========================================#
  9. alias usb-controller ehci-hcd
  10. alias sound-slot-0 i810_audio
  11. post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L >;/dev/null 2>;&1 || :
  12. pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -S >;/dev/null 2>;&1 || :
  13. alias usb-controller1 usb-uhci
  14. [root@localhost root]#
复制代码

mode=0雙網卡負載均衡
mode=1雙網卡冗余
++++++++++++
我的網卡配置
  1. [root@localhost root]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
  2. DEVICE=bond0
  3. ONBOOT=yes
  4. BOOTPROTO=static
  5. IPADDR=192.168.250.55
  6. NETMASK=255.255.255.0
  7. [root@localhost root]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
  8. DEVICE=eth0
  9. ONBOOT=yes
  10. BOOTPROTO=static
  11. IPADDR=0.0.0.0
  12. [root@localhost root]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
  13. DEVICE=eth1
  14. ONBOOT=yes
  15. BOOTPROTO=static
  16. IPADDR=0.0.0.0
  17. [root@localhost root]#
复制代码

mode=0
  1. [root@localhost root]# ifconfig
  2. bond0     Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F
  3.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  4.           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
  5.           RX packets:98050 errors:0 dropped:0 overruns:0 frame:0
  6.           TX packets:106613 errors:0 dropped:0 overruns:0 carrier:0
  7.           collisions:0 txqueuelen:0
  8.           RX bytes:91719644 (87.4 Mb)  TX bytes:91895765 (87.6 Mb)

  9. eth0      Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F
  10.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  11.           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
  12.           RX packets:66340 errors:0 dropped:0 overruns:0 frame:0
  13.           TX packets:70755 errors:0 dropped:0 overruns:0 carrier:0
  14.           collisions:0 txqueuelen:100
  15.           RX bytes:62999539 (60.0 Mb)  TX bytes:63440842 (60.5 Mb)
  16.           Interrupt:9 Base address:0x4000

  17. eth1      Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F  Media:unknown(auto)
  18.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  19.           UP BROADCAST DEBUG NOTRAILERS RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
  20.           RX packets:31710 errors:0 dropped:0 overruns:0 frame:0
  21.           TX packets:35858 errors:0 dropped:0 overruns:0 carrier:0
  22.           collisions:0 txqueuelen:100
  23.           RX bytes:28720105 (27.3 Mb)  TX bytes:28454923 (27.1 Mb)
  24.           Interrupt:9 Base address:0x6000

  25. lo        Link encap:Local Loopback
  26.           inet addr:127.0.0.1  Mask:255.0.0.0
  27.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  28.           RX packets:16 errors:0 dropped:0 overruns:0 frame:0
  29.           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
  30.           collisions:0 txqueuelen:0
  31.           RX bytes:1264 (1.2 Kb)  TX bytes:1264 (1.2 Kb)

  32. [root@localhost root]#
复制代码

mode=1
  1. [root@localhost root]# ifconfig
  2. bond0     Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F
  3.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  4.           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
  5.           RX packets:151339 errors:0 dropped:0 overruns:0 frame:0
  6.           TX packets:122827 errors:0 dropped:0 overruns:0 carrier:0
  7.           collisions:0 txqueuelen:0
  8.           RX bytes:176177703 (168.0 Mb)  TX bytes:100056637 (95.4 Mb)

  9. eth0      Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F
  10.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  11.           UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
  12.           RX packets:123792 errors:0 dropped:0 overruns:0 frame:0
  13.           TX packets:92270 errors:0 dropped:0 overruns:0 carrier:0
  14.           collisions:0 txqueuelen:100
  15.           RX bytes:152707097 (145.6 Mb)  TX bytes:65678127 (62.6 Mb)
  16.           Interrupt:9 Base address:0x4000

  17. eth1      Link encap:Ethernet  HWaddr 00:0A:EB:20:4A:8F  Media:unknown(auto)
  18.           inet addr:192.168.250.55  Bcast:192.168.250.255  Mask:255.255.255.0
  19.           UP BROADCAST DEBUG NOTRAILERS RUNNING NOARP SLAVE MULTICAST  MTU:1500  Metric:1
  20.           RX packets:27547 errors:0 dropped:0 overruns:0 frame:0
  21.           TX packets:30557 errors:0 dropped:0 overruns:0 carrier:0
  22.           collisions:0 txqueuelen:100
  23.           RX bytes:23470606 (22.3 Mb)  TX bytes:34378510 (32.7 Mb)
  24.           Interrupt:9 Base address:0x6000

  25. lo        Link encap:Local Loopback
  26.           inet addr:127.0.0.1  Mask:255.0.0.0
  27.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  28.           RX packets:14 errors:0 dropped:0 overruns:0 frame:0
  29.           TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
  30.           collisions:0 txqueuelen:0
  31.           RX bytes:1088 (1.0 Kb)  TX bytes:1088 (1.0 Kb)

  32. [root@localhost root]#
复制代码

注意這兩行
  1. UP BROADCAST DEBUG NOTRAILERS RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
复制代码
  1. UP BROADCAST DEBUG NOTRAILERS RUNNING NOARP SLAVE MULTICAST  MTU:1500  Metric:1
复制代码

论坛徽章:
0
22 [报告]
发表于 2003-12-04 09:53 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

小弟又做了四塊網卡實驗,除得到以上的結果外。還有....
mode=0時,四塊網卡負載均衡,拔出非主網卡eth0都不會出現網絡中斷,隻是帶寬下降了。
mode=1時,四塊網卡冗余,默認是第一塊網卡工作,不管拔出那條網線,系統會按cat /etc/rc.local 中的順序來選擇網卡,
  1. [root@localhost root]# cat /etc/rc.local
  2. #!/bin/sh
  3. #
  4. # This script will be executed *after* all the other init scripts.
  5. # You can put your own initialization stuff in here if you don't
  6. # want to do the full Sys V style init stuff.

  7. touch /var/lock/subsys/local
  8. #mii-tool --advertise=100baseT-FD eth3
  9. ifenslave bond0 eth0 eth1 eth2 eth3
  10. route add -net 192.168.250.0 netmask 255.255.255.0 bond0

  11. [root@localhost root]#
复制代码

有個怪問題,我做實驗兩台機,一台rh90,一台win2kserver,用d-link 1008d相連,測試帶款兩台同時從對方主機下載一個300m的文件.
發關和接收隻能用到網卡速度的一半,比如,兩邊同時下載,發送接收是18M,如果停掉一邊,速度之和還是18M,真是不明白,請高手釋疑?

论坛徽章:
0
23 [报告]
发表于 2003-12-04 10:09 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

我很想知道怎么能在实现负载均衡以后在实现冗余,请高手释疑。

论坛徽章:
0
24 [报告]
发表于 2003-12-04 11:17 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

谢了,俺在你的帮助下也成功了

论坛徽章:
0
25 [报告]
发表于 2003-12-04 15:49 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

按楼主的办法。
在7.2上实现了绑定。
[root@firewall /]# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:C0:26:F0:12:81  
          inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:301 errors:0 dropped:4 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:36252 (35.4 Kb)

eth0      Link encap:Ethernet  HWaddr 00:C0:26:F0:12:81  
          inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:344 errors:0 dropped:0 overruns:0 frame:0
          TX packets:155 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:34439 (33.6 Kb)  TX bytes:18427 (17.9 Kb)
          Interrupt:11 Base address:0xe000

eth1      Link encap:Ethernet  HWaddr 00:C0:26:F0:12:81  Media:unknown(auto)
          inet addr:192.168.1.222  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST DEBUG NOTRAILERS RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:353 errors:0 dropped:0 overruns:0 frame:0
          TX packets:154 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:35013 (34.1 Kb)  TX bytes:18509 (18.0 Kb)
          Interrupt:10

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:561 (561.0 b)  TX bytes:561 (561.0 b)

我看到第二块网卡的MAC同eth0一样?

论坛徽章:
0
26 [报告]
发表于 2003-12-05 11:33 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

请问在/etc/modules.conf 中配置中
options bond0 miimon=100 mode=0
其中mode可以付0、1、2、3这些值都有什么用途。
如何测试我现在mode的值是什么。如何测试我加载的模块。
如果单纯要把一个ip帮定在多个网卡上实现冗余,我看用下面的方法比较简单。
touch bonding.sh
chmod 755 bonding.sh
mv bonding.sh /etc/rc.d/
echo '/etc/rc.d/bonding.sh'>;>;/etc/rc.d/rc.local
cat >;/etc/rc.d/bonding<<!
#!/bin/sh
ifdown eth0 eth1 eth2 ……
ifconfig bond0 addr  xxx.xxx.xxx.xxx/xx
ifenslave bond0 eth0 eth1 eth2 ……
!
就这样就能实现。我想知道那些miimon=100 是默认的,mode=那些值的用法和如何测试。请高手释疑!

论坛徽章:
0
27 [报告]
发表于 2004-02-03 11:12 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

/etc/modules.conf 中options这一行可以不写。系统自动默认为:
mode=0 miimon=0
miimon是用来进行链路监测的。
比如:miimon=100,那么系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路。
mode的参数可以设置为0,1,2,3
一般情况下都只用到0和1,除非你的网卡不支持miimon。而现在通用的网卡基本上都是支持miimon即链路监测的。

注意:bonding只能提供链路监测,即从主机到交换机的链路是否接通。如果只是交换机对外的链路down掉了,而交换机本身并没有故障,那么bonding会认为链路没有问题而继续使用,这时如果你的mode=0,那么会丢一半的数据包,如果mode=1,那么网络就会全部不通了。

其实具体的文档在内核版本高于2.4的linux中都有。位于/usr/src/linux-2.4.18/Document/network/bonding.txt 。

论坛徽章:
0
28 [报告]
发表于 2004-11-26 10:27 |只看该作者

原创:在RedHat Linux 8.0环境中实现双网卡绑定指南

在HP-UNIX上怎么绑定啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP