How to Create Network Bridge in RHEL 8 / Centos 8
Network Bridge is a link layer device based on mac address that foreword traffic between networks. In Linux, software bridge uses to emulate a hardware bridge that can be used in the virtual applications with one or more virtual application virtual nic. For example, if we are installing KVM we have to create bridge for the internal network. This can not be used in the wi-fi network due to the IEEE 802.11 standard of wi-fi.
There are three methods to create a bridge in RHEL 8.
1 – Using Command-line nmcli
2 – Edit eth file and create bridge file using the command line
3 – Using graphical nmtui
In this article, we will see how to create a bridge in the existing setup which is already in use. In our setup static IP is assigned to ens192 and we have to create a bridge br0. We will use nmtui and vi editor to create bridge.
Steps To Create Network Bridge
Step 1 – Check the existing network and mac address
Check existing network and mac address to avoid mistakes and take backup in case we have to revert back.
# ip a
Above pic, you can see one ethernet port ens192 with static ip. save this ip and mac address. The Mac address is not mandatory.
Step 2 – Open Network Manager TUI
# nmtui
This command will open TUI for the network manager. Here you can edit and create new connections.
Here go to “Edit a connection” to add or change the setting of the ethernet port.
Step 3 – Create Bridge and Assign Slave Ethernet Port
In this step, we will create a bridge with ens192 port slave.
first, perform step 2 you will see pic below :
Click on “Add” to add a new connection. Scroll down to Bridge and press tab to move on create.
Press enter on create. Now you will see below options on the screen. Where you need to give a name to bridge and assign IP as per your requirement or you can leave default names.
In the above pic, change the highlighted area and click on add to add a physical nic port that will carry bridge network.
In the above pic, you can see options. Select Ethernet and press tab to jump on create and press enter to move on the next step.
In the below pic, enter the ethernet port name and mac address. Mac address is not mandatory you can leave it also.
Click ok to save the setting.
Now in the next step assign Ip on the bridge. Make sure to assign the same series IP which your network provider to network team provides you to avoid any network loss. IN our case we will assign the same IP which was assigned to ens192 because it was tested and working.
For that go to IPv4 Configuration and click and select manual.
Click on “Show” to assign IP
Enter IP in the format of 192.168.11.123/24 gateway 192.168.11.1.
After that click ok to save the configuration.
In the below pic you can see Bridge is created name br0 and now move to ok and press enter
Now all bridge configuration has been done use down arrow ket to move to quit and press enter to exit nmtui.
Now you have created bridge with slave ens192. But now we have to tell ens192 that his master is br0.
Step 4 – Edit Ethernet File For Bridge Communication
Now we have to edit the ethernet configuration file in my case it is ens192. In your case, it could be eth0, eth1 or ens0, etc.
use below command to edit :
# vi /etc/sysconfig/network-scripts/ifcfg-ens192
Make the same entry as shown in below
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
NAME=ens192
UUID=ceb12aa6-afa5-4365-946b-4b573fe0c43e
DEVICE=ens192
ONBOOT=yes
MASTER=br0
Save configuration. Press esc then:wq! press enter
Now restart Network Manager by below command
# systemctl status NetworkManager
Step 5 – Confirm bridge is configured correctly
Check this via below command
# ip a
Now here you can check two-point to verify the bridge is configured correctly.
- The IP address will show only on the bridge, not on the ens192 port.
- Mac Address will be the same as the bridge and our ethernet port which was the slave of the bridge.
At this point, you have successfully configured the bridge. Now you can use it in any KVM machine or application which required a bridge network.
If this article helps you share it because sharing will motivate us .