当前位置: > CentOS > CentOS教程 > 系统配置 >

CentOS6.5多网卡绑定

时间:2014-05-07 13:25来源:linux.it.net.cn 作者:it

CentOS6.5与以前的Redhat Linux版本在网络配置方面略有不同,本文详述CentOS6.5下多网卡绑定的配置操作过程。

1. 创建绑定接口bond0

[root@Hostname ~]#touch /etc/sysconfig/network-scripts/ifcfg-bond0
[root@Hostname ~]#cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=172.24.254.13
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=172.24.254.91
BONDING_OPTS="MODE=0 MIIMON=1000"

2. 配置物理接口eth2,eth3,eth4,eth5

[root@Hostname ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
[root@Hostname ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
[root@Hostname ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth4
DEVICE=eth4
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
[root@Hostname ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth5
DEVICE=eth5
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet

3.配置Bonding配置文件/etc/modprobe.d/bond0.conf

[root@Hostname ~]# cat /etc/modprobe.d/bond0.conf
alias bond0 bonding

4.修改系统配置文件/etc/rc.local,在文件末尾增加如下内容

ifenslave bond0 eth2 eth3 eth4 eth5

5.重启系统,让配置生效


更多信息请参考:
http://www.linuxtopia.org/online_books/rhel6/rhel_6_deployment/rhel_6_deployment_sec-Using_Channel_Bonding.html

另外:如果在RHEL6下执行:
service network restart

     时,报如下错误:
Bringing up interface bond0: Error: Connection activation failed: Device not managed by NetworkManager

     此错误是因为系统中默认由NetworkManager服务管理网络,可以将其停止:

[root@Hostname ~]#chkconfig NetworkManager off
[root@Hostname ~]#service NetworkManager stop
[root@Hostname ~]#chkconfig network on
[root@Hostname ~]#service network restart

注意NetworkManager区分大小写。

(责任编辑:IT)
------分隔线----------------------------