How To Create a Linux Network Bridge on CentOS 8 / RHEL 8

Windows Articles

Diskpart is a very useful tool for managing storage in Windows 10.

Hello! Diskpart is an internal tool included in Windows systems that allows you to manage storage units. Indeed, it is possible to manage internal...

How To Install MySQL 8.0 On Ubuntu 20.04

Today we are going to learn that how to Install MySQL 8.0 on Ubuntu 20.04. MySQL is one of the most popular and commonly...

How to Update to MIUI 12 via Fastboot

Greetings friends. The new version of the Android-based operating system MIUI 12 released this year, is still being deployed with some devices missing. On...

How to use modprobe command?

The modprobe command is a Linux administration system created for management, visualization, inclusion and exclusion. From loadable modules to kernel. Also, the Module is...

Install Virtualmin on CentOS 8

Hello, friends. In this post, you will learn how to install Virtualmin on CentOS 8. In addition to that, we will leave it ready...

In this tutorial, you’ll cover the creation of Linux Network Bridge on CentOS / RHEL 8. As you know Bridge is used to connect two or more roads, Similarly here in Linux Bridge is used to connect two or more segments together. The common use of Linux Network Bridge is to pass the Virtual Machines traffic through a hyper visor network card. By doing so all machines connected to a network bridge will act as a physical network interface.

Creating a Linux Network Bridge on CentOS 8 / RHEL 8 using nmcli

Network bridge behaves as a virtual network switch. We’ll proceed further to see how it can be created and used follow the below steps to get started.

Step 1: Creating a Linux Bridge

Here we will use the nmcli network management command line tool to create a Linux bridge on a desired interface.

To see connections available run the following command.

$ sudo nmcli connection show
NAME UUID TYPE DEVICE
ens33 8806158c-9c2b-4ffb-8109-8b662baf8581 ethernet ens33
virbr0 06282371-27ba-4f03-b3c5-ebcc401e2531 bridge virbr0
virbr0-nic 0dcb669a-5ead-4a67-a877-2f78d432691e tun virbr0-nic
ens33 93392eb5-c75b-45ea-80a3-509e01144dc7 ethernet --
ens33 2a10fc64-1312-4232-8103-5cdc114cf5b8 ethernet --

As my bridge will be created on the second device ens33 So, I’ll delete the existing connection to create a bridge connection with this device.

$ sudo nmcli connection delete ens33
[sabi@localhost root]$ sudo nmcli connection delete ens33
Connection 'ens33' (93392eb5-c75b-45ea-80a3-509e01144dc7) successfully deleted.
Connection 'ens33' (2a10fc64-1312-4232-8103-5cdc114cf5b8) successfully deleted.
Connection 'ens33' (8806158c-9c2b-4ffb-8109-8b662baf8581) successfully deleted.

Now save bridge related information to variables.

BR_NAME="ifname"
BR_INT="ens29"
SUBNET_IP="192.168.94.10/24"
GW="192.168.94.1"
DNS1="8.8.8.8"
DNS2="8.8.4.4"
  • BR_NAME: Name of the bridge, we are going to create.
  • BR_INT: Physical device to be used as a bridge slave.
  • SUBNET_IP: IP address & subnet assigned to the created bridge.
  • GW: Default Gateway address.
  • DNS1 & DNS2: DNS servers IP which are to be used.

Now after assigning information, create new bridge connection.

sudo nmcli connection add type bridge autoconnect yes con-name ${BR_NAME} ifname ${BR_NAME}

You will see the following output upon successful creation.

Connection 'ifname' (f76df2f2-f4ed-48a3-b39d-e58979710298) successfully added.

After creating connection of bridge assign the IP address, Gateway and DNS servers.

sudo nmcli connection modify ${BR_NAME} ipv4.addresses ${SUBNET_IP} ipv4.method manual
sudo nmcli connection modify ${BR_NAME} ipv4.gateway ${GW}
sudo nmcli connection modify ${BR_NAME} ipv4.dns ${DNS1} +ipv4.dns ${DNS2}

Now add the network device as a bridge slave.

sudo nmcli connection delete ${BR_INT}
sudo nmcli connection add type bridge-slave autoconnect yes con-name ${BR_INT} ifname ${BR_INT} master ${BR_NAME}

Output:

Connection 'ifname' (f76df2f2-f4ed-48a3-b39d-e58979710298) successfully added.

Run the following command to check connection changes.

sudo nmcli connection show

You’ll see the bridge connection you’ve just created.

NAME        UUID                                  TYPE      DEVICE
ens33 dde2beed-2e9d-4ea8-82c6-460306f17847 ethernet ens33
virbr0 06282371-27ba-4f03-b3c5-ebcc401e2531 bridge virbr0
virbr0-nic 0dcb669a-5ead-4a67-a877-2f78d432691e tun virbr0-nic
ifname f76df2f2-f4ed-48a3-b39d-e58979710298 bridge nm-bridge
ifname 984edc85-9e75-45b1-843b-e06d11631cae bridge nm-bridge1

Step 2: Bring up Network Bridge

Now it’s time to bring up the network bridge after creating successful connection.

sudo nmcli connection up ifname
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)

You can view bridge details by running

sudo nmcli connection show ifname

To find out IP address run the following command .

$ ip ad

That’s it! The bridge is now ready to use.

If have any queries regarding this tutorial, feel free to ask!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Diskpart is a very useful tool for managing storage in Windows 10.

Hello! Diskpart is an internal tool included in Windows systems that allows you to manage storage units. Indeed, it is possible to manage internal...

How To Install MySQL 8.0 On Ubuntu 20.04

Today we are going to learn that how to Install MySQL 8.0 on Ubuntu 20.04. MySQL is one of the most popular and commonly...

How to Update to MIUI 12 via Fastboot

Greetings friends. The new version of the Android-based operating system MIUI 12 released this year, is still being deployed with some devices missing. On...

How to use modprobe command?

The modprobe command is a Linux administration system created for management, visualization, inclusion and exclusion. From loadable modules to kernel. Also, the Module is...

Install Virtualmin on CentOS 8

Hello, friends. In this post, you will learn how to install Virtualmin on CentOS 8. In addition to that, we will leave it ready...
x