How to add network bridge with nmcli (NetworkManager) on Linux

How to add network bridge with nmcli (NetworkManager) on Linux

To add a network bridge using nmcli (NetworkManager) on a Linux system, you can follow these steps:

  1. Open a terminal window.

  2. Make sure the NetworkManager service is running on your system. You can check the status of the service with the following command:

refer ‮l:ot‬autturi.com
systemctl status NetworkManager
  1. If the NetworkManager service is not running, start it with the following command:
systemctl start NetworkManager
  1. Use the 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.

  1. Use the 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.

  1. Use the 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.

  1. Use the 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 the nmcli command with caution, as improper use can cause problems or disrupt the operation of the network.

Created Time:2017-10-28 21:38:57  Author:lautturi