CentOS 8 add network bridge (br0) with nmcli command
📅 2026/8/21 7:47:16
How do I configure my CentOS 8 and add network bridge (br0) with the nmcli command? How can I create a Linux network bridge on CentOS Linux 8 server for KVM (Kernel-based Virtual Machine)?A network bridge is nothing but a device that joins two local networks into one network. It works at the data link layer (layer 2 of the OSI model). Network bridges often used with virtualization software. For example, popular software such as KVM, LXD, or Docker users can configure bridges instead of NAT-based networking. The nmcli command-line tool can create a persistent bridge configuration without editing any files.This page shows how to create a bridge interface using the Network Manager command-line tool called nmcli on CentOS 8 Enterprise Linux.Tutorial requirementsRequirementsCentOS Linux 8 serverRoot privilegesYesDifficulty levelEasyCategoryNetwork UtilitiesOS compatibilityAlmaLinux •CentOS • Fedora • RHEL • Rocky • StreamEst. reading time4 minutesTable of contents ↓1 Adding network bridge2 Prerequisite3 Creating a Linux network bridge4 Disable or enable STP5 Set up static or DHCP based IP address6 Enable br0 network bridge interface7 Verification network bridge8 ConclusionCentOS 8 add network bridge (br0) with nmcliThe procedure to create and add a bridge interface on CentOS 8 is as follows when you want to use Network Manager:Open the Terminal app or log in using the [nixmcd name”ssh”]Find out information about the current CentOS 8 network connection:sudo nmcli con showThen, add a new bridge called br0:sudo nmcli con add type bridge ifname br0Create a slave interface for br0:sudo nmcli con add type bridge-slave ifname eno1 master br0Turn on br0 interface to get an IP via DHCP:sudo nmcli con up br0Static IP settings are discussed below for the br0 interfaceLet us see all examples and instructions in detail to create a network bridge in CentOS 8.Warning: These instructions make critical network changes to your existing server, and wrong commands might lose network/ssh connectivity to the server. Hence, running these commands over ssh based sessions not recommended. Further, you may need to update firewall rules to match the network bridge settings. For remote servers, I recommend using KVM over IP or IPMI based remote sessions.Prerequisite to create a Linux Network Bridge on CentOS 8First thing, obtain information about the current CentOS Linux 8 interface and IP address as we need this information later. Hence, type the following command:nmcli con shownmcli connection show --activeOutputs:NAME UUID TYPE DEVICE eno1 71a189f2-9cb9-49f0-8464-37a6801740e3 ethernet eno1So my server has an “eno1” which uses the eno1 Ethernet interface. I am going to set up a bridge interface named br0 and add (enslave) an interface to eno1.Step 1 – Create a network bridge named br0The syntax is:sudo nmcli con add ifnamebr0type bridge con-namebr0sudo nmcli con add type bridge-slave ifnameeno1masterbr0nmcli connection showStep 2 – Disable or enable STP for network bridgeThe primary purpose of Spanning Tree Protocol (STP) is to ensure that you do not create loops when you have redundant paths in your network. We can disable STP or enable as follows for br0:sudo nmcli con modify br0 bridge.stpno## CentOS 8 nmcli command to enable STP with br0 ##sudo nmcli con modify br0 bridge.stpyes## Verification ##nmcli con shownmcli -f bridge con show br0Outputs:bridge.mac-address: -- bridge.stp: no bridge.priority: 32768 bridge.forward-delay: 15 bridge.hello-time: 2 bridge.max-age: 20 bridge.ageing-time: 300 bridge.group-forward-mask: 0 bridge.multicast-snooping: yes bridge.vlan-filtering: no bridge.vlan-default-pvid: 1 bridge.vlans: --Step 3 – Set up static or DHCP based IP for network bridge interfaceWe have not allocated any static IP address to our br0 interface. Hence, if the DHCP server is available, it should provide IP addresses and other settings. However, on servers, we typically set up a static IP address. In this example, I am converting existing eno1 IP network settings to br0 settings as follows:IPv4 br0 settingssudo nmcli connection modify br0 ipv4.addresses 192.168.2.19/24sudo nmcli connection modify br0 ipv4.gateway 192.168.2.254sudo nmcli connection modify br0 ipv4.dns 192.168.2.254sudo nmcli connection modify br0 ipv4.dns-search sweet.homesudo nmcli connection modify br0 ipv4.method manualIPv6 br0 settingssudo nmcli connection modify bridge0 ipv6.addresses Your-Static-IPv6-Addresssudo nmcli connection modify br0 ipv6.gateway Your-Static-IPv6-Gateway-Addresssudo nmcli connection modify br0 ipv6.dns Your-Static-IPv6-DNSsudo nmcli connection modify br0 ipv6.dns-search sweet.homesudo nmcli connection modify br0 ipv6.method manualStep 4 – Enable br0 network bridge interface on CentOS 8So far, we configured required network settings. It is time to turn it on our br0:sudo nmcli con up br0nmcli con showWait for some time to activate settings.Step 5 – Verification network bridge settingsUse the ip command to view the IP settings for br0:ip a sip a s br0You can remove eno1 as br0 got a static IP address itself as eno1 will be in forwarding state:$ sudo nmcli connection delete eno1Here is how it looks using the ip command:nmcli connection showip a show br0nmcli device## interface active and works with br0 ##ip a show eno1ip r## Check Internet and local LAN connectivity using ping command ##ping -c 4 www.cyberciti.bizping -c 4 192.168.2.25Show the link status of Ethernet devices and bridge devices on CentOS 8 Linux machine:ip link show master br0bridge link showbridge link show dev eno1ConclusionIn this tutorial, you learned how to add and create a Linux Network Bridge on CentoS 8 server. See nmcli docs here for more info.