Re: Change IP address with libnm



On Tue, 2020-02-25 at 17:02 +0000, António Mendes wrote:
Hi.
I tried to use the example add-connection-libnm-glib.c and adapt to
my case but without success...
I wanted to change an IP address from a connection already created
and add some 802.1X configurations.

Hi,

add-connection adds a new profile.
Basically, what `nmcli connection add ...` does.

The example you refer to is about usage of libnm. So, the corresponding
API is nm_remote_connection_update2() ([1]). This maps to the D-Bus
call Update2 ([2]). This is what `nmcli connection modify ...` does.

[1] https://developer.gnome.org/libnm/1.22/NMRemoteConnection.html#nm-remote-connection-update2
[2] 
https://developer.gnome.org/NetworkManager/1.22/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html#gdbus-method-org-freedesktop-NetworkManager-Settings-Connection.Update2


As always, connection profiles in NetworkManager are really just a bunch of nested
dictionaries, that is the plain settings. There is no further logic involved, just
create a suitable profile. If you use libnm, you probably create the profile using the
NMConnection and NMSetting types. These represent the nested dictionaries.

After you modify a profile, you usually need to activate it so that your actual networking
configuration (`nmcli device`, `ip link`) changes.



best,
Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]