在RHEL5服务器系统下双网卡使用bonding

转自:http://www.wangchao.net.cn/bbsdetail_1786805.html

 

所谓bonding,就是将多块网卡绑定同一IP地址对外提供服务,可以实现高可用或者负载均衡。当然,直接给两块网卡设置同一IP地址是不可能的。通过 bonding,虚拟一块网卡对外提供连接,物理网卡的被修改为相同的MAC地址。Kernels 2.4.12及以后的版本均提供bonding模块,以前的版本可以通过patch实现。
  1.确认你目前使用的网卡,检查/etc/sysconfig/network-scripts目录下以ifcfg-开头的文件,应该为eth0, eth1...
  2.配置虚拟网卡bond0
  可以使用DHCP,也可以配置static IP,最好通过vi编辑配置文件
  
  [root@server1 ~]# cd /etc/sysconfig/network-scripts

写道
[root@server1 network-scripts]# cat ifcfg-bond0
  DEVICE=bond0
  BOOTPROTO=none
  ONBOOT=yes
  NETWORK=192.168.0.0
  NETMASK=255.255.255.0
  IPADDR=192.168.0.10
  USERCTL=no
  GATEWAY=192.168.0.254
  TYPE=Ethernet
 

  3.修改eth0, eth1配置文件
  
  [root@server1 network-scripts]# ifcfg-eth0

写道

 

写道
DEVICE=eth0
  BOOTPROTO=none
  ONBOOT=yes
  MASTER=bond0
  SLAVE=yes
  USERCTL=yes
 

  [root@server1 network-scripts]# ifcfg-eth1

写道
DEVICE=eth1
  BOOTPROTO=none
  ONBOOT=yes
  MASTER=bond0
  SLAVE=yes
  USERCTL=yes
 

   4.将新添加的bond0设备加入modprobe.conf中,以便kernel识别。加入设置参数,miimon值表示两块网卡相互监测的时间,以 ms为单位。mode值为工作模式,可设置为高可用还是负载均衡,0为高可用(默认值),1为负载均衡,另外还有一种XOR模式。
  alias bond0 bonding
  options bond0 miimon=100 mode=1
  文章来源: baike.duba.net

 

但是这样在外网ping的时候会有一个小问题,不不知道如何解决。。

写道
$ ping 10.10.10.150
PING 10.10.10.150 (10.10.10.150) 56(84) bytes of data.
64 bytes from 10.10.10.150: icmp_seq=1 ttl=64 time=0.410 ms
64 bytes from 10.10.10.150: icmp_seq=1 ttl=64 time=0.501 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=2 ttl=64 time=0.266 ms
64 bytes from 10.10.10.150: icmp_seq=2 ttl=64 time=0.329 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=3 ttl=64 time=0.258 ms
64 bytes from 10.10.10.150: icmp_seq=3 ttl=64 time=0.316 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=4 ttl=64 time=0.454 ms
64 bytes from 10.10.10.150: icmp_seq=4 ttl=64 time=0.672 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=5 ttl=64 time=0.228 ms
64 bytes from 10.10.10.150: icmp_seq=5 ttl=64 time=0.287 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=6 ttl=64 time=0.270 ms
64 bytes from 10.10.10.150: icmp_seq=6 ttl=64 time=0.351 ms (DUP!)
64 bytes from 10.10.10.150: icmp_seq=7 ttl=64 time=0.460 ms
64 bytes from 10.10.10.150: icmp_seq=7 ttl=64 time=0.684 ms (DUP!)

 ping 的时候会有两个回复。。不知道如何解决。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值