[root@openldap ~]# ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.31.48 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::20c:29ff:fe55:5ed3 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:55:5e:d3 txqueuelen 1000 (Ethernet)
RX packets 4116 bytes 265898 (259.6 KiB)
RX errors 0 dropped 21 overruns 0 frame 0
TX packets 83 bytes 11927 (11.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:55:5e:d3 txqueuelen 1000 (Ethernet)
RX packets 828 bytes 52513 (51.2 KiB)
RX errors 0 dropped 1 overruns 0 frame 0
TX packets 58 bytes 9677 (9.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 00:0c:29:55:5e:d3 txqueuelen 1000 (Ethernet)
RX packets 829 bytes 52547 (51.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 166 bytes 14000 (13.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 166 bytes 14000 (13.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@openldap ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
BOOTPROTO=static
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
ONBOOT=yes
IPADDR=192.168.31.48
NETMASK=255.255.255.0
GATEWAY=192.168.31.1
PREFIX=24
BONDING_OPTS="miimon=200 mode=1"
[root@openldap ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eth0
NAME=eth0
BONDING_MASTER=yes
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@openldap ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eth1
NAME=eth1
BONDING_MASTER=yes
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@openldap ~]#
[root@openldap ~]# 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: eth0
MII Status: up
MII Polling Interval (ms): 200
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:55:5e:d3
Slave queue ID: 0
Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:55:5e:dd
Slave queue ID: 0
[root@openldap ~]#
[root@openldap ~]# 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: eth0
MII Status: up
MII Polling Interval (ms): 200
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:55:5e:d3
Slave queue ID: 0
Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:55:5e:dd
Slave queue ID: 0
[root@openldap ~]#
可能会启动失败,bond0的状态不是UP, 查看/var/log/message可看到如下信息
Error: Connection activation failed: Master device bond0 unmanaged or not available for activation
需要禁用NetworkManager
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service