Skip to content

Linux 网口相互绑定 bond

lanzhiwang edited this page Nov 26, 2019 · 2 revisions
1、加载 bonding 模块
modinfo bonding
modprobe bonding
lsmod | grep  bonding

2、禁用 NetworkManager
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

3、配置网卡,修改网卡配置之前先停止网卡
bond 网卡名称从 bond0 开始,bond1 bond2 ...
[root@master-02 network-scripts]# cat ifcfg-bond0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=bond0
ONBOOT=yes
IPADDR=10.176.11.18
NETMASK=255.255.255.0
BONDING_OPTS="miimon=100 mode=1"
USERCTL=no
[root@master-02 network-scripts]#
[root@master-02 network-scripts]# cat ifcfg-ens7f0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=ens7f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@master-02 network-scripts]#
[root@master-02 network-scripts]# cat ifcfg-ens8f0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=ens8f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@master-02 network-scripts]#

note:
bond mode=0 需要交换机支持

4、配置 gateway
[root@master-02 network-scripts]# cat /etc/sysconfig/network
# Created by anaconda
GATEWAY=10.176.11.1
[root@master-02 network-scripts]#

[root@master-01 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 114.114.114.114
[root@master-01 ~]#

note:
不要将 gateway 和 DNS 配置到网卡上


Clone this wiki locally