Cyberithub

How to Create a Network Bonding/Teaming in RedHat/CentOS 7

Advertisements

In this tutorial, I will take you through the steps to create a network bonding/teaming in Linux. Red Hat Enterprise Linux/CentOS 7 allows administrators to bind multiple network interfaces together into a single, bonded, channel. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.

Network Bonding

Step 1: Prerequisites

Make sure you have 2 network interfaces attached to your system to configure network bonding. Along with this you need to have root access to perform below Operations.

How to Create a Network Bonding/Teaming in RedHat/CentOS 7 1

Step 2: Create bond0 entry in modprobe.d

You need to have a conf file here with the same interface name which you are going to use in /etc/sysconfig/network-scripts/ifcfg-bond0. Configuration file name could be anything but interface name should be same. So choose as per your requirement.

[root@localhost ~]# cd /etc/modprobe.d/
[root@localhost modprobe.d]# cat bonding.conf
alias bond0 bonding

Step 3: Create bond0 Interface

You need to create a bond0 Configuration File here as mentioned below.

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.0.108
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no

Note: You need to choose IP based on your environment. It could be any IP.

Step 4: Configure First Slave Interface

Change your first network interface enp0s3 to act as slave interface of master bond0. Specify the configuration as mentioned below.

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
DEVICE=enp0s3
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Step 5: Configure Second Slave Interface

Change the mode of second network interface enp0s8 to act as slave interface of master bond0. Provide the configuration as given below.

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
DEVICE=enp0s8
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

Step 6: Restart Network Service

Once the configuration is completed, restart the network service.

[root@localhost modprobe.d]# service network restart
Restarting network (via systemctl): [ OK ]

Check the status of network service.

[root@localhost modprobe.d]# systemctl status network
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (exited) since Tue 2019-12-10 02:55:31 EST; 7min ago
Docs: man:systemd-sysv-generator(8)
Process: 5014 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost network[5014]: RTNETLINK answers: File exists
Dec 10 02:55:31 localhost systemd[1]: Started LSB: Bring up/down networking.

Note: If you see an error "Failed to start LSB: Bring up/down networking." while restarting network service, you need to set NM_CONTROLLED=NO in your network configuration file.

And then try again.

[root@localhost modprobe.d]# service network restart
Restarting network (via systemctl): [ OK ]

Step 7: Check the output

Check the status of network interface enp0s3 and enp0s8. It is working as Slave now and bond0 is working as Master.

[root@localhost ~]# ip addr sh
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: enp0s3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
link/ether 08:00:27:78:93:72 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP group default qlen 1000
link/ether 08:00:27:78:93:72 brd ff:ff:ff:ff:ff:ff
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:da:f8:a1:8b brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 08:00:27:78:93:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.108/24 brd 192.168.0.255 scope global bond0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe78:9372/64 scope link
valid_lft forever preferred_lft forever

Congratulations!! You have successfully configured the Network Bonding.

Also Read: How to change Date and Time in RedHat/CentOS 7

Reference: RedHat Network Bonding Documentation

Leave a Comment