且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

linux双网卡绑定实现冗余与负载均衡

更新时间:2022-04-27 22:22:19

1 编辑/etc/modprobe.conf
  在/etc/modprobe.conf里加入如下两行:

  alias bond0 bonding

  options bond0 mode=1 miimon=100 use_carrier=0

2 创建bond0虚拟设备
  vim /etc/sysconfig/network-scripts/ifcfg-bond0
 
  DEVICE=bond0

  BOOTPROTO=none

  ONBOOT=yes

  NETMASK=255.255.255.0

  IPADDR=192.168.68.150

  GATEWAY=192.168.68.254

3 配置 eth0 eth1

  vim /etc/sysconfig/network-scripts/ifcfg-eth0
 
  DEVICE=eth0
  BOOTPROTO=none
  ONBOOT=yes
  MASTER=bond0
  SLAVE=yes

  vim /etc/sysconfig/network-scripts/ifcfg-eth1
 
  DEVICE=eth1
  BOOTPROTO=none
  ONBOOT=yes
  MASTER=bond0
  SLAVE=yes

4 重启系统