CentOS 7.6网卡绑定mode1
[[email protected] ~]# systemctl stop NetworkManager
[[email protected] ~]# systemctl disable NetworkManager
[[email protected] ~]# lsmod |grep bonding
[[email protected] ~]# modprobe --first-time bonding
[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce 0
使用bond实现mode1:
[[email protected] ~]# more /etc/modprobe.d/bond.conf
alias bond1 bonding
options bond1 miimon=100 mode=1
[[email protected] ~]#
[[email protected] network-scripts]# more ifcfg-bond1
TYPE=Bond
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=bond1
IPADDR=192.168.21.200
PREFIX=24
NM_CONTROLLE=no
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100"
[[email protected] network-scripts]#
[[email protected] network-scripts]# more ifcfg-ens33
TYPE="Ethernet"
BOOTPROTO="none"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
MASTER=bond1
SLAVE=yes
USERCTL=no
[[email protected] network-scripts]#
[[email protected] network-scripts]# more ifcfg-ens36
TYPE="Ethernet"
BOOTPROTO="none"
NAME="ens36"
DEVICE="ens36"
ONBOOT="yes"
MASTER=bond1
SLAVE=yes
USERCTL=no
[[email protected] network-scripts]#
验证:
1.查看bond1状态:
[[email protected] network-scripts]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:0c:29:a6:22:fe
Slave queue ID: 0
Slave Interface: ens36
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:a6:22:08
Slave queue ID: 0
[[email protected] network-scripts]#
2.测试,宕掉其中一个接口,看是否切换
[[email protected] network-scripts]# ifdown ens36
[[email protected] network-scripts]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:0c:29:a6:22:fe
Slave queue ID: 0
[[email protected] network-scripts]#
3.查看网卡绑定后的速度:
[[email protected] network-scripts]# ethtool bond1
Settings for bond1:
Supported ports: [ ]
Supported link modes: Not reported
Supported pause frame use: No
Supports auto-negotiation: No
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: Other
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
Link detected: yes
[[email protected] network-scripts]#
原文地址:http://blog.51cto.com/huazhixu123/2342950