Nmcli: Working with Linux Bridges on RHEL8/CentOS8

For better or worse, mmcli is pretty much the default mechanism for configuring networking on RHEL8/CentOS8. I cannot as of yet, say I am a fan. However, I have been working with ifconfig files for years and held on to that method of networking configuration until they were dragged from my cold and bloated hands.

Show Bridges

# nmcli con show
NAME          UUID                                  TYPE      DEVICE       
eno1          e875f081-1ef6-4995-bb12-0f5ff50f1095  ethernet  eno1         
provisioning  272457e0-8a6b-4e93-8902-f28c07f45cdc  bridge    provisioning 
baremetal     f6d0909c-9ee7-4aa6-8902-b8ce9171fa93  bridge    baremetal    
vlan98        1db123b9-0e43-453d-ba7b-757213ed377d  vlan      eno1.98      
vlan99        9d5d886b-e9bd-45c3-8dc4-c958b73b232e  vlan      eno1.99      
vnet0         73344ec4-37e4-487d-9a07-775ddab2b05e  tun       vnet0        
vnet1         cb4622dc-7987-4410-8497-780f89195a2f  tun       vnet1        
eno2          c1b3674d-cc63-414c-90bb-69e00759efd8  ethernet  --           
eno3          5f12b893-3333-4c8f-91c2-54512d7e7f09  ethernet  --           
eno4          4bbbcace-9ffe-43df-863a-2b19585d98ee  ethernet  --    

Show a Bridge and Connected Interfaces

Format is as shown below.

nmcli -f GENERAL.DEVICE,GENERAL.TYPE,BRIDGE.SLAVES device show bridge_device_name

For example:

nmcli -f GENERAL.DEVICE,GENERAL.TYPE,BRIDGE.SLAVES device show provisioning
GENERAL.DEVICE:                         provisioning
GENERAL.TYPE:                           bridge
BRIDGE.SLAVES:                          eno1.98 vnet1

Add a Bridge

# nmcli connection add type bridge ifname app-br0
Connection 'bridge-app-br0' (f26b8315-5ab0-409a-a701-8abf3837aa92) successfully added.

Add a Slave Interface to a Bridge

nmcli con add type ethernet con-name br-slave-1 ifname eno51 master app-br0

Delete a Bridge

# nmcli conn delete bridge-app-br0
Connection 'bridge-app-br0' (f26b8315-5ab0-409a-a701-8abf3837aa92) successfully deleted.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.