[root@pay network-scripts]# cat ifcfg-bond0 |grep -v \#
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
IPADDR="192.168.67.111"
NETMASK="255.255.255.0"
GATEWAY="192.168.67.2"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
DEVICE="bond0"
ONBOOT="yes"
BONDING_OPTS="miimon=100 mode=1"
[root@pay network-scripts]# cat ifcfg-ens38 |grep -v \#
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
DEVICE="ens38"
MASTER=bond0
SLAVE=yes
[root@pay network-scripts]# cat ifcfg-ens39 |grep -v \#
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
DEVICE="ens39"
MASTER=bond0
SLAVE=yes
[root@pay network-scripts]# service network restart
[root@pay ~]# ip a |egrep 'bond|ens38|ens39'
4: ens38: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
5: ens39: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
8: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
inet 192.168.67.111/24 brd 192.168.67.255 scope global bond0
[root@pay ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens39
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens38
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:52:f7:35
Slave queue ID: 0
Slave Interface: ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:52:f7:3f
Slave queue ID: 0
总结: TYPE="Ethernet" 不能设置为bond , 也不用设置啥 /etc/modprobe.d/bonding.conf 添加 alias bond0 bonding
测试:!!!!!!!!!!!!!!!!!!
停掉其中1个网卡
[root@pay network-scripts]# ifdown ifcfg-ens39
Device 'ens39' successfully disconnected.
只剩下38
[root@pay ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens38
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens38
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:52:f7:35
Slave queue ID: 0
[root@pay ~]# ifup ens39
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/28)
恢复39
[root@pay ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens38
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens38
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: 00:0c:29:52:f7:35
Slave queue ID: 0
Slave Interface: ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:52:f7:3f
Slave queue ID: 0
关掉38
[root@pay ~]# ifdown ens38
Device 'ens38' successfully disconnected.
[root@pay ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens39
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens39
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:52:f7:3f
Slave queue ID: 0
ifdown bond0后再ifup bond0 需要重启网卡才能恢复
来源:https://www.cnblogs.com/hanxing/p/12000806.html