目的:两块网卡流量负载均衡、冗余
DELL R720:4块网卡(需要交换机也支持),分为管理网和业务网
系统:CentOS6.5
将网卡em1和em2绑定,虚拟网卡名称为bond1(管理网)
# cat /etc/sysconfig/network-scripts/ifcfg-em1 DEVICE=em1 //网卡设备名称 HWADDR=C8:1F:66:E5:33:67 //网卡MAC地址 ONBOOT=yes //随network启动 BOOTPROTO=none //获取IP的方式 MASTER=bond1 //绑定的虚拟网卡名称 SLAVE=yes //角色为从
# cat /etc/sysconfig/network-scripts/ifcfg-em2 DEVICE=em2 HWADDR=C8:1F:66:E5:33:68 ONBOOT=yes BOOTPROTO=none MASTER=bond1 SLAVE=yes
# cat ifcfg-bond1 DEVICE=bond1 //虚拟网卡名称 ONBOOT=yes //随network启动 BOOTPROTO=none //获取IP的方式 IPADDR=192.168.1.224 //IP地址 NETMASK=255.255.255.0 //子网掩码 GATEWAY=192.168.1.1 //网关
# grep bond /etc/modprobe.d/dist.conf //配置绑定模型, 此两行加到配置文件最后 alias bond1 bonding options bond1 miimon=100 mode=0 //系统每隔100ms检测一下mode指定负载模式
# grep bond /etc/rc.local ifenslave bond1 em1 em2 //系统启动时将虚拟网卡和两张物理网卡绑定
重启机器(可以尝试其它方式,加载模块或者重启服务)
# cat /proc/net/bonding/bond1 //检测状态 EthernetChannel Bonding Driver: v3.6.0 (September 26, 2009) BondingMode: load balancing (round-robin) MIIStatus: up MIIPolling Interval (ms): 100 Up Delay(ms): 0 DownDelay (ms): 0 SlaveInterface: em1 MIIStatus: up Speed:1000 Mbps Duplex:full LinkFailure Count: 0 PermanentHW addr: c8:1f:66:e5:33:67 Slavequeue ID: 0 Slave Interface: em2 MII Status: down Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: c8:1f:66:e5:33:68 Slave queue ID: 0 //该物理网卡是断开状态,因为没有插网线
2. 同理,将网卡em3和em4绑定,虚拟网卡名称为bond2(业务网)
# cat ifcfg-em3 DEVICE=em3 HWADDR=C8:1F:66:E5:33:69 ONBOOT=yes BOOTPROTO=none MASTER=bond2 SLAVE=yes
# cat ifcfg-em4 DEVICE=em4 HWADDR=C8:1F:66:E5:33:6A ONBOOT=yes BOOTPROTO=none MASTER=bond2 SLAVE=yes
# cat ifcfg-bond2 DEVICE=bond2 ONBOOT=yes BOOTPROTO=none IPADDR=10.88.253.224 NETMASK=255.255.255.128 GATEWAY=10.88.253.129
# grep bond /etc/modprobe.d/dist.conf alias bond2 bonding options bond2 miimon=100 mode=0
# grep bond /etc/rc.local ifenslave bond1 em3 em4
# cat /proc/net/bonding/bond2 EthernetChannel Bonding Driver: v3.6.0 (September 26, 2009) BondingMode: load balancing (round-robin) MIIStatus: up MIIPolling Interval (ms): 100 Up Delay(ms): 0 DownDelay (ms): 0 SlaveInterface: em3 MIIStatus: up Speed:1000 Mbps Duplex:full LinkFailure Count: 0 PermanentHW addr: c8:1f:66:e5:33:69 Slavequeue ID: 0 Slave Interface: em4 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: c8:1f:66:e5:33:6a Slave queue ID: 0
本文出自 “esoul” 博客,请务必保留此出处http://esoul.blog.51cto.com/7825461/1748627
原文地址:http://esoul.blog.51cto.com/7825461/1748627