Ryan Knopp

Adding a network bridge using nmcli.

Currently I updated my Ubuntu server to the new LTS version 20.04 (Focal Fossa). Ubuntu seemed to have change the networking system from Netplan that they used in Ubuntu 18.04 (Bionic Beaver) to NetworkManager. Here’s a guide to add a network bridge with NetworkManager so you can expose some of your virtual machines to your network.

List your connections

$ nmcli con show
Initial show connection screen.

Creating a bridge (needs sudo)

This create’s a bridge interface name br0. I used br0 since that’s what I used for Netplan in Ubuntu 18.04. con-name is the switch where you can change the name to what you like. In this instance con-name br0.

$ sudo nmcli con add ifname br0 type bridge con-name br0

Let’s create an association with the new bridge that we created with our network interface.

$ sudo nmcli con add type bridge-slave ifname ens33 master br0
$ nmcli con show
Initial show connection screen.

Disable STP if you don’t need spanning tree (if you are unsure, I would just disable it)

$ sudo nmcli con modify br0 bridge.stp no
$ nmcli -f bridge con show br0
Show connection with the new bridge connection.

Turning on the bridge interface.

Let’s turn off the Wired connection 1 connection and then bring up the new bridge interface.

$ sudo nmcli con down "Wired connection 1"
$ sudo nmcli con up br0
$ nmcli con show
Show connection with the new bridge connection.

Did it work?

Interface br0 should have an ip address while your network interface ens33 should not have one.

$ ip a s
Show connection with the new bridge connection enabled.
Updated: May 14, 2020