CentOS 7.6网卡绑定mode1
[root@server ~]# systemctl stop NetworkManager [root@server ~]# systemctl disable NetworkManager [root@server ~]# lsmod |grep bonding [root@server ~]# modprobe --first-time bonding [root@server ~]# setenforce 0 [root@server ~]# getenforce 0
使用bond实现mode1: [root@server ~]# more /etc/modprobe.d/bond.conf alias bond1 bonding options bond1 miimon=100 mode=1 [root@server ~]#
[root@server 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" [root@server network-scripts]# [root@server network-scripts]# more ifcfg-ens33 TYPE="Ethernet" BOOTPROTO="none" NAME="ens33" DEVICE="ens33" ONBOOT="yes" MASTER=bond1 SLAVE=yes USERCTL=no [root@server network-scripts]# [root@server network-scripts]# more ifcfg-ens36 TYPE="Ethernet" BOOTPROTO="none" NAME="ens36" DEVICE="ens36" ONBOOT="yes" MASTER=bond1 SLAVE=yes USERCTL=no [root@server network-scripts]#
验证:
1.查看bond1状态: [root@server 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
[root@server network-scripts]#
2.测试,宕掉其中一个接口,看是否切换 [root@server network-scripts]# ifdown ens36 [root@server 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 [root@server network-scripts]#
3.查看网卡绑定后的速度:
[root@server 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
[root@server network-scripts]#