NIC Bonding on CentOS 7 with NMCLI
1. . Strong style= "padding:0px;margin:0px;" >
By default, the bonding kernel module is not enabled. Therefore, we will need to load it and make sure it lasts. Using Modprobe--first-time to load the bonding module, a warning is issued if the module fails to load.
# modprobe--first-time Bonding
The above command loads only the Bondiing module for the current session, and the module does not load automatically after the server restarts. To ensure continuous loading, the Create/etc/modules-load.d/bonding.conf file is placed in the folder/etc/modules-load.d directory, ensuring that the bonding module is loaded each time the server restarts.
# echo "# Load thebonding kernel module at boot" >/etc/modules-load.d/bonding.conf
# echo "Bonding" >>/etc/modules-load.d/bonding.conf
Ensure that the bonding module is automatically loaded after the server restarts
# lsmod|grep bonding
bonding 136705 0
#
2. NUCLI Create Bond
View existing connections and available network devices
# NMCLI Connection Show
NAME UUID TYPE DEVICE
# NMCLI Device status
DEVICE TYPE State CONNECTION
eno16777736 Ethernet Disconnected--
eno33554992 Ethernet Disconnected--
Bond0 Bond Unmanaged--
Lo Loopback unmanaged--
#
Create Bond
# nmcli con Add type Bond con-name BOND0 ifname bond0 ip4 192.168.31.108/24 mode BALANCE-RR
Connection ' bond0 ' (599582B0-346B-48D3-8F1D-F3BCEE5DECA7) successfully added.
# NMCLI Connection Add type Bond-slave con-name SLAVE1 ifname eno16777736 Master bond0
Connection ' slave1 ' (6A1DD331-BB90-4E92-9AF6-654ED8B2D2CA) successfully added.
# NMCLI Connection Add type Bond-slave con-name SLAVE2 ifname eno33554992 Master bond0
Connection ' Slave2 ' (E31F40C9-4A1C-45D5-9832-8A1705F0B1F7) successfully added.
#nmcli con mod bond0 ipv4.method Manual
#nmcli con mod bond0 ipv4.gateway 192.168.31.1
#nmcli Connection Modify Bond0 Ipv4.dns 192.168.31.1
#nmcli Connection Modify Bond0 bond.options mode=balance-rr,miimon=100,downdelay=0,updelay=0
Restart Network Service After creation
#systemctl Restart Network
# NMCLI Device status
DEVICE TYPE State CONNECTION
Bond0 Bond connected Bond0
eno16777736 Ethernet Connected Slave1
eno33554992 Ethernet Connected Slave2
Lo Loopback unmanaged--
View network links and network devices again
# NMCLI Connection Show
NAME UUID TYPE DEVICE
Bond0 599582B0-346B-48D3-8F1D-F3BCEE5DECA7 Bond Bond0
Slave1 6A1DD331-BB90-4E92-9AF6-654ED8B2D2CA 802-3-ethernet eno16777736
Slave2 E31f40c9-4a1c-45d5-9832-8a1705f0b1f7 802-3-ethernet eno33554992
# IP Addr List
1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN
Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00
inet 127.0.0.1/8 Scope host Lo
Valid_lft Forever Preferred_lft Forever
INET6:: 1/128 Scope Host
Valid_lft Forever Preferred_lft Forever
2:eno16777736: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU qdisc pfifo_fast Master bond0 State up Qlen 1000
Link/ether 00:0c:29:51:e8:75 BRD FF:FF:FF:FF:FF:FF
3:eno33554992: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> MTU qdisc pfifo_fast Master bond0 State up Qlen 1000
Link/ether 00:0c:29:51:e8:75 BRD FF:FF:FF:FF:FF:FF
4:BOND0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> MTU Qdisc Noqueue State up
Link/ether 00:0c:29:51:e8:75 BRD FF:FF:FF:FF:FF:FF
inet 192.168.31.108/24 BRD 192.168.31.255 Scope Global BOND0
Valid_lft Forever Preferred_lft Forever
Inet6 fe80::233b:2da9:bddd:c8dc/64 Scope link tentative dadfailed
Valid_lft Forever Preferred_lft Forever
Inet6 fe80::875c:5f79:646d:8446/64 Scope link tentative dadfailed
Valid_lft Forever Preferred_lft Forever
Inet6 fe80::bf1c:1978:9c5:6ed7/64 Scope link tentative dadfailed
Valid_lft Forever Preferred_lft Forever
#
This article is from "Technical achievement dream!" "Blog, be sure to keep this provenance http://dreamsanqin.blog.51cto.com/845412/1886212
NIC Bonding on CentOS 7 with NMCLI