h0945466 发表于 2018-5-10 12:44:56

Redhat6 双网卡绑定

  Redhat6 双网卡绑定
  一、环境情况   1、操作系统:redhat6.4 64位
         注意:redhat6以下版本部分配置文件不一样
  2、网卡2块:eth0eht1
  二、操作步骤
  1、需要彻底关闭NetworkManager服务,否则会和bond网卡冲突
  service NetworkManager stop      //关闭NetworkManager服务
           chkconfig NetworkManager off       //系统启动时不启动服务
  
   2、修改 /etc/sysconfig/network-scripts/ifcfg-bond0 配置文件
        vi /etc/sysconfig/network-scripts/ifcfg-bond0
        在配置文件中写为以下配置:   
         DEVICE=bond0
           ONBOOT=yes
           BOOTPROTO=static
           IPADDR=xxx.xxx.xxx.xxx   //写入你的ip
           NETMASK=xxx.xxx.xxx.xxx    //写入你的掩码
           GATEWAY=xxx.xxx.xxx.xxx    //写入你的网关
           USERCTL=no
           TYPE=Ethernet
     
     3、修改/etc/sysconfig/network-scripts/ifcfg-eth0配置文件
         vi /etc/sysconfig/network-scripts/ifcfg-eth0
        在配置文件中写为以下配置:
        DEVICE=eth0
           BOOTPROTO=none
           ONBOOT=yes
           MASTER=bond0         //将网卡指向bond0
           SLAVE=yes            //启用双网卡
           USERCTL=no
     
     4、修改 /etc/sysconfig/network-scripts/ifcfg-eth1配置文件
         vi /etc/sysconfig/network-scripts/ifcfg-eth0
         在配置文件中写为以下配置:
        DEVICE=eth1
           BOOTPROTO=none
           ONBOOT=yes
           MASTER=bond0         //将网卡指向bond0
           SLAVE=yes            //启用双网卡
           USERCTL=no
  
   5、修改内核文件/etc/modprobe.d/dist.conf文件添加
        vi /etc/mkdprobe.d/dist.conf

        在配置文件中添加以下配置:
           alias bond0 bonding
               options bond0 mode=1 miimon=100
  注释1:miimon是指多久时间要检查网路一次,单位是ms(毫秒),
         意思是假设其中有一条网路断线,会在0.1秒内自动备援。
  注释2:mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。
  

   6、重启网络服务生效

         service network restart
        这时,只有bond0的网卡有ip地址,eth0和eth1网卡应该没有ip就可以了。
        查看网卡运行的状态,使用命令
        cat /proc/net/boning/bond0
        可以看到那块网卡生效。
  
页: [1]
查看完整版本: Redhat6 双网卡绑定