Introduction
In networking, a virtual bridge serves as a crucial component for connecting and managing multiple network interfaces. It allows for the creation of a unified network infrastructure, whether for virtual machines or physical devices. The NetworkManager Command-Line Interface (nmcli) is a powerful tool for configuring network connections on Linux systems.

This guide outlines the steps to create a virtual bridge using nmcli, providing a seamless way to consolidate network interfaces and enhance connectivity. Here are the steps:
Check Existing Connections
Before creating a bridge, it’s good to check existing network connections. You can use the following command to list available connections:
$ nmcli connection showAbbreviations of this command like nmcli con show or nmcli c s will work as well.
Create Bridge Connection
Use nmcli to create a new bridge connection. For this example, we will use br0 as the desired bridge name.
$ nmcli connection add type bridge ifname br0Add Interfaces
Add the network interfaces you want to include in the bridge. Replace enp0s1 and enp0s2 with the actual interface names you’d like to include as yours will be different.
$ nmcli connection add type bridge-slave ifname enp0s1 master br0
$ nmcli connection add type bridge-slave ifname enp0s2 master br0Activate Bridge Connection
Activate the bridge connection to apply the changes.
$ nmcli connection up br0Verify Configuration
Confirm that the bridge and its associated interfaces are configured correctly.
$ nmcli connection showCheck Status
Ensure that the bridge connection is active and the interfaces are part of the bridge.
$ nmcli con show --activeConfigure IP address
If needed, you can assign an IP address to the bridge interface.
$ nmcli connection modify br0 ipv4.addresses 192.168.2.2/24
$ nmcli connection modify br0 ipv4.method manualAdjust the IP address and subnet mask according to your network configuration.
Activate Changes
Activate the changes to apply the IP address configuration.
$ nmcli connection up br0Verify IP Configuration
Confirm that the IP address is assigned to the bridge interface.
$ nmcli con show br0 | grep addresses
802-3-ethernet.accept-all-mac-addresses:-1 (default)
ipv4.addresses: 192.168.2.2/24
ipv6.addresses: --
No comments:
Post a Comment