CentOS 8 add network bridge (br0) with nmcli command

www.lau‮rutt‬i.com
CentOS 8 add network bridge (br0) with nmcli command

To create a network bridge called "br0" using nmcli on CentOS 8, you can use the following steps:

  1. First, install the bridge-utils package, which provides the brctl utility that is required to create and manage bridge interfaces:
sudo yum install bridge-utils
  1. Next, use nmcli to create the bridge interface:
sudo nmcli connection add type bridge con-name br0 ifname br0
  1. You can then add one or more physical network interfaces to the bridge using the nmcli command. For example, to add the eth0 interface to the bridge:
sudo nmcli connection add type ethernet con-name eth0 ifname eth0 master br0
  1. Once you have added all of the desired interfaces to the bridge, you can bring the bridge interface up using the following command:
sudo nmcli connection up br0
  1. If you want the bridge to be automatically activated at boot time, you can set the autoconnect property of the bridge connection to yes:
sudo nmcli connection modify br0 autoconnect yes

That's it! You should now have a working network bridge called "br0" that is composed of the physical interfaces you added to it. You can verify that the bridge is working by checking the output of the ip a command, which should show the bridge interface and the interfaces that are part of it.

Note: If you need to remove the bridge or any of its associated interfaces, you can use the nmcli connection delete command to delete them. For example, to delete the eth0 interface from the bridge:

sudo nmcli connection delete eth0
Created Time:2017-10-16 14:38:40  Author:lautturi