实现的是2个网线共用一套IP,类似于高可用。
机器要双网卡
1、启动bonding模块:
[root@localhost ~]# vim /etc/modprobe.d/modprobe.conf
alias netdev-bond0 bonding
2、安装软件bridge-utils
[root@localhost ~]# yum install bridge-utils -y
3、修改配置文件:
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-bond0
[root@localhost network-scripts]# cp ifcfg-ens33 ifcfg-ens37
ens33网卡
[root@localhost network-scripts]# vim ifcfg-ens33
NAME="ens33"
DEVICE="ens33"
ONBOOT=yes
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO=static
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
ens37网卡
[root@localhost network-scripts]# vim ifcfg-ens37
NAME="ens37"
DEVICE="ens37"
ONBOOT=yes
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO=static
TYPE=Ethernet
SLAVE=yes
MASTER=bond0
bonding绑定
[root@localhost network-scripts]# vim ifcfg-bond0
NAME="bond0"
DEVICE="bond0"
ONBOOT=yes
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO=static
TYPE=Ethernet
BONDING_OPTS="miimon=100 mode=6"
BRIDGE=br0
br0网桥
[root@localhost network-scripts]# vim ifcfg-br0
NAME="br0"
DEVICE="br0"
ONBOOT=yes
NETBOOT=yes
IPV6INIT=yes
BOOTPROTO=static
TYPE=Bridge
IPADDR=172.16.12.30
NETMASK=255.255.0.0
GATEWAY=172.16.0.254
DNS1=8.8.8.8
4、重启网络
[root@localhost network-scripts]# /etc/init.d/network restart