In Ubuntu 20.04, you can add a network bridge (br0) using the nmcli
command-line tool. Here are the steps you can follow:
- Start by making sure that the
network-manager
package is installed by running the following command:
sudo apt-get install network-manager
- Next, you can create a new bridge by running the following command:
nmcli connection add type bridge con-name br0 ifname br0
- To add an interface to the bridge, you can run the following command:
nmcli connection add type bridge-slave con-name br0-slave ifname interface-name master br0
Replace interface-name
with the actual name of the interface you want to add to the bridge, e.g. eth0
.
- To activate the bridge, you can run the following command:
nmcli connection up br0
- To check the status of the bridge, you can run the following command:
nmcli connection show br0
- If you want to remove the bridge, you can run the following command:
nmcli connection delete br0
- It’s important to keep in mind that creating a bridge may disrupt network connectivity, so it’s a good idea to test the bridge in a non-production environment before applying it to production.
- Also, note that creating a bridge will also require you to configure the IP address, mask and gateway for the bridge interface.
- You may also need to configure DNS server and DHCP server if they are needed.