A network bridge is a device responsible for joining two networks and forming a single network. It operates on the famous OSI model’s data link layer, layer 2. The Network Bridge creates a table of MAC addresses used to forward traffic between the connected networks.
Each network, which the bridge is supposed to be connected, requires a network device to operate. The Network Bridge works as a virtual network switch.
Here at LinuxAPT, we shall look into how a Network Bridge can be created in CentOS 8.
Also, you will see that Network Bridge cannot be used or configured via Wi-Fi in Ad-Hoc.
Network bridge can be created via the below ways:
$ sudo nmcli connection add type bridge con-name bridge0 iframe bridge0
This command will add the bridge "bridge0".
Run the below command:
$ nmcli device status
You will see the bridge "bridge0" in the right of the center of the terminal output result.
You can use the following command:
$ nmcli connection add type ethernet slave-type bridge con-name bridge0-port1 iframe enp7s0 master bridge0
You can use the following commands in the same sequence:
$ nmcli connection modify bridge0 ipv4.addresses '192.168.122.1'
$ nmcli connection modify bridge0 ipv4.gateway '192.168.122.1'
$ nmcli connection modify bridge0 ipv4.dns '192.168.122.1'
$ nmcli connection modify bridge0 ipv4.method manual
Next configure Ipv6 settings using the following commands:
$ nmcli connection modify bridge0 ipv6.addresses '2001:db8:1::1/64'
$ nmcli connection modify bridge0 ipv6.gateway '2001:db8:1::fffe'
$ nmcli connection modify bridge0 ipv6.dns '2001:db8:1::fffd'
$ nmcli connection modify bridge0 ipv6.dns-search 'example.com'
$ nmcli connection modify bridge0 ipv6.method manual
You can use the below command:
$ nmcli connection up bridge0
You will see that the connection is activated.
To check the status of the port, run the command:
$ nmcli device
You will see a small window which is the "Network Connections".
If you look beneath, you will see the "+" button. Click it to go to the "choosing the connection type" in the Ethernet page. Here, you can select from multiple options that are up to you to decide. This is called "The Bridge Tab".
This article covers how to Create Network Bridges on Centos OS. In fact, the nmcli command-line tool can create a persistent bridge configuration without editing any files.