Hey Thomas, Thanks again for your detailed answers! Cheers, Thilo Am Montag, den 15.01.2018, 14:52 +0100 schrieb Thomas Haller:
On Mon, 2018-01-15 at 10:34 +0000, thilo cestonaro ts fujitsu com wrote:Hey all! I have a lack of knowledge about how I'm supposed to work with the network manager. So here is my situation. I have two ethernet devices and multiple bridges. And I want to be able to connect one of the ethernet devices to one bridge and apply a static connection to that bridge then. Afterwards I want to deactive this connection and use any other combination of these two ethernet devices and the bridges to get connected to my network with exactly the same static connection. I want to learn the handling of bridges via network manager so thats more or less just a stupid example.Hi, See the D-Bus API: https://developer.gnome.org/NetworkManager/stable/spec.html Create connection profiles that are suitable to your need and activate them. Also look at the output of `nmcli connection` and `nmcli device` to understand what is happening.How I try to do it is the following (all is done via NM DBus API): # disconncet both ethernet devices disconnect enp0s1, enp0s2 # disconnect the old bridge disconnect br1often, you don't need to explicitly disconnect anything (you might though). Just activate what you care about, and NM will take care to bring the interface down first.# build the new connections add and active connection for new bridge br3 (with static settings) add and active connection for enp0s1 (as slave of br3) add and active connection for enp0s2 (with "/" as connection)On a minor note, it's a mistake to do: nmcli connection up br0-slave-eth0 && nmcli connection up br0 Either do nmcli connection up br0 && nmcli connection up br0-slave-eth0 or better just nmcli connection up br0-slave-eth0Is this the way of doing it or how am I supposed to do it? Do I need to delete the old connections?No, you can have arbitrary many connection profiles.Is network manager compatible with brctl or should I avoid using brctl when I manage my network devices with network manager?brctl is deprecated for iproute2. You can use both to look at the bridge's state (inspect, not change). It's probably a bad idea to interfere with NM by modifying the bridge using iproute2, but that might work too. Why would you need that? It depends what exactly happens, but in general it's not a good idea because there are inevitable races.Is there a simple way to show slaves of a bridge with nmcli?nmcli -f BRIDGE.SLAVES device show br0 Use nmcli to understand what's happening, and look at the D-Bus API (for example with the "d-feet" program). best, Thomas
Attachment:
smime.p7s
Description: S/MIME cryptographic signature