To add a network bridge using nmcli
(NetworkManager) on a Linux system, you can follow these steps:
Open a terminal window.
Make sure the NetworkManager
service is running on your system. You can check the status of the service with the following command:
systemctl status NetworkManager
NetworkManager
service is not running, start it with the following command:systemctl start NetworkManager
nmcli
command with the connection
subcommand to create a new connection profile for the network bridge. For example, to create a new connection profile named bridge0
, you can use the following command:nmcli connection add type bridge con-name bridge0
This will create a new connection profile for a network bridge named bridge0
.
nmcli
command with the connection
subcommand to modify the connection profile for the network bridge. For example, to set the IP address for the network bridge, you can use the following command:nmcli connection modify bridge0 ipv4.addresses 192.168.1.1/24
This will set the IP address for the network bridge to 192.168.1.1
with a subnet mask of /24
.
nmcli
command with the connection
subcommand to activate the connection profile for the network bridge. For example, to activate the connection profile for bridge0
, you can use the following command:nmcli connection up bridge0
This will activate the connection profile for the network bridge and bring the bridge interface up.
ip
command to verify that the network bridge has been added and is operational. For example, you can use the following command to list all the network interfaces on your system:ip link show
This will display a list of all the network interfaces on your system, including the network bridge interface.
Note: The
nmcli
command has many options and features available for managing network connections on a Linux system. Consult the documentation and online resources for more information on the various options and features available with this command. It is recommended to use thenmcli
command with caution, as improper use can cause problems or disrupt the operation of the network.