CentOS 6.5 网卡绑定

CentOS 6.5   


网卡名称为eth1,eth2


具体绑定操作


1.在/etc/sysconfig/network-scripts/目录 创建 ifcfg-bond0文件


#vi /etc/sysconfig/network-scripts/ifcfg-bond0
写以下内容
DEVICE=bond0    # 设备名称
USERCTL=no
BOOTPROTO=static   #静态地址
ONBOOT=yes   #开机启动
IPADDR=0.0.0.0      # 根据自已需要修改IP
NETMASK=255.255.255.0
GATEWAY=0.0.0.0   # 网关
TYPE=Ethernet


2. 修改网卡信息
修改eth1
#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1   #设备名称
ONBOOT=yes  #开机启动
BOOTPROTO=none 
MASTER=bond0  
SLAVE=yes
USERCTL=no
修改eth2
#vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth1   #设备名称
ONBOOT=yes  #开机启动
BOOTPROTO=none 
MASTER=bond0  
SLAVE=yes
USERCTL=no


3.在/etc/modprobe.d/目录创建名称为bonding.conf文件
#vi /etc/modprobe.d/bonding.conf 
内容如下
alias bond0 bonding
options bond0 miimon=100 mode=1   


#  miimon=100 每100毫秒 (即0.1秒) 检查一次网络
#  mode=0  
共有七种模式,常用的模式是0和1
mode=0 : 负载均衡模式,所有网卡一起使用,峰值=所有网卡带宽的总和,当某个网卡故障,仅降低带宽,不影响其他网卡
mode=1 : 热备模式,即一块网卡运行,其他待命,当运行的网卡故障,其他网卡顶上




4.修改启动文件 /etc/rc.d/rc.local
vi /etc/rc.d/rc.local
加入
ifenslave bond0 eth0 eth1


5.查看bond0状态:
cat /proc/net/bonding/bond0


问题备注:
若某个网卡的MII Status=down,表示该网卡无法连接网络
此时应检查:
1、网线是否插好
2、网线是否损坏
3、网卡配置是否正确
4、网卡是否没插好
5、网卡是否损坏

你可能感兴趣的:(linux)