« Previous 1 2
NetworkManager at the command line
Building Bridges
NetworkManager for Bridges
More complex setups follow this setup pattern. If you want to set up, say, a bridge, follow the instructions in Listing 1. The virtual bridge device is given the name virt-br0
in the example. This is assigned to the virtbridge connection and receives two slave devices, which also each have their own connection. This is necessary, because you might want to change the properties of these devices, such as the MTU size of the Ethernet device.
Listing 1
Setting up a Bridge with nmcli
01 # nmcli con add type bridge con-name virtbridge ifname virt-br0 02 Connection 'virtbridge' (dbbf82a2-06f7-431a-9d14-0027173ef89d) successfully added. 03 # nmcli con add type bridge slave con virtbridge-port1 name ifname enp0s25 master virt-br0 04 Connection 'virtbridge-port1' (dab53884-15cf-4d95-8886-a24ffaccfc7b) successfully added. 05 # nmcli con add type bridge-slave con-name virtbridge-port2 ifname virbr0-nic master virt-br0 06 Connection 'virtbridge-port2' (f598a4ce-6564-4b3f-b46e-c3da256915af) successfully added. 07 # brctl show virt-br0 bridge name bridge id STP enabled interfaces virt-br0 8000.5254003504fe yes enp0s25 virbr0-nic
The actual bridge can be configured via the virtbridge connection, as shown in the first example for the Ethernet device. If you are not sure what options are available for the bridge device, you can again rely on Bash completion. Setting up other devices is similar and quickly learned.
Conclusion
NetworkManager is an extensive service tool for configuring the network stack on Linux systems. Thanks to extensive compatibility with the well-known init scripts, you will be able to find your way around the configuration files quickly without a learning curve. If you fail to make friends with the new tool, you can always disable NetworkManager using systemctl stop NetworkManager; systemctl disable NetworkManager
.
Infos
- Network Manager D-BUS API: https://developer.gnome.org/NetworkManager/1.2/spec.html
« Previous 1 2
Buy this article as PDF
(incl. VAT)