CentOS Stream 8
Sponsored Link

Configure Network Bonding
2021/12/08
 
Configure Network Bonding to bind multiple network interfaces into a single load balanced or fault-toleranced interface and so on.
The Network Teaming feature which is the same solution of network load-balancing or fault-tolerance is also provided.
Refer to the comparison of network teaming and bonding features below.
⇒ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-comparison_of_network_teaming_to_bonding
There are some modes for configuring network bonding like follows.
Mode Mode Name Description
0 balance-rr Sets a round-robin policy for fault tolerance and load balancing.
Transmissions are received and sent out sequentially on each bonded member interface beginning with the first one available.
1 active-backup Sets an active-backup policy for fault tolerance.
Transmissions are received and sent out via the first available bonded member interface.
Another bonded member interface is only used if the active bonded member interface fails.
2 balance-xor Sets an XOR (exclusive-or) policy for fault tolerance and load balancing.
Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the member NICs.
Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
3 broadcast Sets a broadcast policy for fault tolerance.
All transmissions are sent on all member interfaces.
4 802.3ad Sets an IEEE 802.3ad dynamic link aggregation policy.
Creates aggregation groups that share the same speed and duplex settings.
Transmits and receives on all members in the active aggregator. Requires a switch that is 802.3ad compliant.
5 balance-tlb Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing.
The outgoing traffic is distributed according to the current load on each member interface. Incoming traffic is received by the current member NIC.
If the receiving member fails, another member takes over the MAC address of the failed member.
6 balance-alb Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing.
Includes transmit and receive load balancing for IPV4 traffic.
Receive load balancing is achieved through ARP negotiation.

[1] Configure Network Bonding.
# display network devices

[root@dlp ~]#
nmcli device

DEVICE  TYPE      STATE         CONNECTION
enp1s0  ethernet  connected     enp1s0
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged     --

# delete existing network connections

[root@dlp ~]#
nmcli connection delete enp1s0

Connection 'enp1s0' (c0ab6b8c-0eac-a1b4-1c47-efe4b2d1191f) successfully deleted.

[root@dlp ~]#
nmcli device

DEVICE  TYPE      STATE         CONNECTION
enp1s0  ethernet  disconnected  --
enp7s0  ethernet  disconnected  --
lo      loopback  unmanaged     --

# add a new bonding device [bond0] (any name you like)
# refer to the description above for each mode (OK to specify with mode number for [mode=*])

[root@dlp ~]#
nmcli connection add type bond ifname bond0 con-name bond0 bond.options "mode=balance-rr"

Connection 'bond0' (065773f8-2d6e-4718-88c3-1c4ef2fab8a5) successfully added.

# add member devices to the bonding device

[root@dlp ~]#
nmcli connection add type ethernet ifname enp1s0 master bond0

Connection 'bond-slave-enp1s0' (f0c5a801-3d3f-431e-a31b-2f296f0ac46f) successfully added.
[root@dlp ~]#
nmcli connection add type ethernet ifname enp7s0 master bond0

Connection 'bond-slave-enp7s0' (6368b4fd-8b05-4d2a-978e-58796cf32e16) successfully added.

[root@dlp ~]#
nmcli device

DEVICE  TYPE      STATE      CONNECTION
bond0   bond      connected  bond0
enp1s0  ethernet  connected  bond-slave-enp1s0
enp7s0  ethernet  connected  bond-slave-enp7s0
lo      loopback  unmanaged  --

[root@dlp ~]#
nmcli connection

NAME               UUID                                  TYPE      DEVICE
bond0              065773f8-2d6e-4718-88c3-1c4ef2fab8a5  bond      bond0
bond-slave-enp1s0  f0c5a801-3d3f-431e-a31b-2f296f0ac46f  ethernet  enp1s0
bond-slave-enp7s0  6368b4fd-8b05-4d2a-978e-58796cf32e16  ethernet  enp7s0

# set IP address and so on to the bonding device and restart it
# IP address

[root@dlp ~]#
nmcli connection modify bond0 ipv4.addresses 10.0.0.30/24
# gatway

[root@dlp ~]#
nmcli connection modify bond0 ipv4.gateway 10.0.0.1
# DNS - specify with space separated if set multiple DNS servers

[root@dlp ~]#
nmcli connection modify bond0 ipv4.dns "10.0.0.10 10.0.0.11"
# DNS search base - specify with space separated if set multiple domains

[root@dlp ~]#
nmcli connection modify bond0 ipv4.dns-search "srv.world"
[root@dlp ~]#
nmcli connection modify bond0 ipv4.method manual

[root@dlp ~]#
nmcli connection down bond0 && nmcli connection up bond0

Connection 'bond0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
# verify bonding state

[root@dlp ~]#
cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: enp1s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:65:52:ca
Slave queue ID: 0

Slave Interface: enp7s0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: 52:54:00:ff:86:42
Slave queue ID: 0

[root@dlp ~]#
ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: enp1s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 52:54:00:65:52:ca brd ff:ff:ff:ff:ff:ff
3: enp7s0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
    link/ether 52:54:00:65:52:ca brd ff:ff:ff:ff:ff:ff permaddr 52:54:00:ff:86:42
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:65:52:ca brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global noprefixroute bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::1ca1:2d40:b983:545b/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

# configuration files are stored under the place

[root@dlp ~]#
ll /etc/sysconfig/network-scripts

total 12
-rw-r--r--. 1 root root 415 Dec  8 14:56 ifcfg-bond0
-rw-r--r--. 1 root root 127 Dec  8 14:48 ifcfg-bond-slave-enp1s0
-rw-r--r--. 1 root root 127 Dec  8 14:48 ifcfg-bond-slave-enp7s0
Matched Content