Re: Creating NetworkManager connections via DBus API
On Fri, 2014-07-04 at 11:51 +1000, Stuart Longland wrote: > Hi Dan, > On 04/07/14 10:51, Dan Williams wrote: > > On Fri, 2014-07-04 at 09:18 +1000, Stuart Longland wrote: > >> But how do I encode my address settings in a Settings.Connection object? > >> Where do I find a list of the settings and their possible values? > > There's actually a bunch of Python examples here: > > > > http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python > > > > that use both plain dbus and Python GObject introspection. The GObject > > introspection ones are similar to python-networkmanager actually. I'm > > not sure how python-networkmanager accepts a new connection to add, but > > perhaps the examples give you an idea how to do that? > > Ahh okay, that's handy. I'll have a dig through those and see what I > can uncover. > > > I'd expect it to > > be a normal "dict of dicts" like the examples above show which is then > > passed to org.freedesktop.NetworkManager.Settings.AddConnection(). > > It does appear that way, I tried pulling the information out for my > Ethernet connection and got: > > In [9]: conn.GetSettings() > > Out[9]: > > {u'bridge': {u'interface-name': u'br0', u'stp': False}, > > u'connection': {u'id': u'Bridge Ethernet', > > u'type': u'bridge', > > u'uuid': u'357c4dcf-2600-45fa-8687-05f4c2cb82b4', > > u'zone': u'work'}, > > u'ipv4': {u'addresses': [], > > u'dns': [], > > u'may-fail': False, > > u'method': u'auto', > > u'routes': []}, > > u'ipv6': {u'addresses': [], u'dns': [], u'method': u'auto', u'routes': []}} > > It seems NetworkManager doesn't much like my hand-configured bridge > (won't see its IP address), but that's a side issue. > > What I'm curious about is what sorts of keys and values are expected in > that dict of dicts? At a basic level I need to be able to set IP > addresses, static routes, DNS servers, domain and DNS search order. Did you see https://wiki.gnome.org/Projects/NetworkManager/Developers ? especially https://developer.gnome.org/NetworkManager/0.9/ref-settings.html (or try `man nm-settings` if you have the manual pages installed) > Probably host name too (not sure if that's doable in NetworkManager). SaveHostname , see https://developer.gnome.org/NetworkManager/0.9/spec.html > At least that will be the starting point. The devices in question we're > setting up will be headless boxes, basically appliances, intended to > poll energy meters in an energy management system and pump the data > elsewhere. > > So mostly wired access, there's a couple of places where we have a > bridges and OpenVPN for technical support on some sites and I envisage > some possibly needing cellular 3G support. > > No one has approached us with the need for WIFI support, but I bet > someone will some day, thus it'd be useful to know how that's configured > too. I would say, this *should* all work (without knowing your exact requirements) > Is there some documentation as to how these various network types are > specified as dict objects to NetworkManager? I think above links is a good starting point, otherwise just ask. Thomas signature.asc Description: This is a digitally signed message part ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[PATCH 1/1] service: only attempt to load the 'tun' modules if necessary
'tun' support might be compiled into the kernel, thus modprobe will always fail. https://mail.gnome.org/archives/networkmanager-list/2014-July/msg00014.html Signed-off-by: Thomas Haller --- src/nm-openvpn-service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c index 84968e8..b45eb28 100644 --- a/src/nm-openvpn-service.c +++ b/src/nm-openvpn-service.c @@ -1623,7 +1623,8 @@ main (int argc, char *argv[]) if (debug) g_message ("nm-openvpn-service (version " DIST_VERSION ") starting..."); - if (system ("/sbin/modprobe tun") == -1) + if ( !g_file_test ("/sys/class/misc/tun", G_FILE_TEST_EXISTS) + && (system ("/sbin/modprobe tun") == -1)) exit (EXIT_FAILURE); plugin = nm_openvpn_plugin_new (); -- 1.9.3 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
NM refuses to manage a VLAN
Dear All: I am trying to migrate an existing setup. To that end, I defined a connection with "nmcli c add type vlan". Result is like this: [root@elanor network-scripts]# nmcli conn show configured NAME UUID TYPE TIMESTAMP-REAL vlan-ethgray 098fcf3f-1801-4cfa-a8d4-85346bcd4083 vlan never [root@elanor network-scripts]# nmcli conn show configured id vlan-ethgray connection.id: vlan-ethgray connection.uuid:098fcf3f-1801-4cfa-a8d4-85346bcd4083 connection.interface-name: ethmain.4 connection.type:vlan connection.autoconnect: yes connection.timestamp: 0 connection.read-only: no connection.permissions: connection.zone:-- connection.master: -- connection.slave-type: -- connection.secondaries: connection.gateway-ping-timeout:0 802-3-ethernet.port:-- 802-3-ethernet.speed: 0 802-3-ethernet.duplex: -- 802-3-ethernet.auto-negotiate: yes 802-3-ethernet.mac-address: -- 802-3-ethernet.cloned-mac-address: -- 802-3-ethernet.mac-address-blacklist: 802-3-ethernet.mtu: auto 802-3-ethernet.s390-subchannels: 802-3-ethernet.s390-nettype:-- 802-3-ethernet.s390-options: ipv4.method:manual ipv4.dns: ipv4.dns-search: ipv4.addresses: { ip = 192.168.132.1/24, gw = 0.0.0.0 } ipv4.routes: ipv4.ignore-auto-routes:no ipv4.ignore-auto-dns: no ipv4.dhcp-client-id:-- ipv4.dhcp-send-hostname:yes ipv4.dhcp-hostname: -- ipv4.never-default: no ipv4.may-fail: no ipv6.method:manual ipv6.dns: ipv6.dns-search: ipv6.addresses: { ip = fd2d:acfb:74cc:5::1/64, gw = :: }; { ip = fe80:0:0:5::1/64, gw = :: } ipv6.routes: ipv6.ignore-auto-routes:no ipv6.ignore-auto-dns: no ipv6.never-default: yes ipv6.may-fail: no ipv6.ip6-privacy: -1 (unknown) ipv6.dhcp-hostname: -- vlan.interface-name:ethmain.4 vlan.parent:ethmain vlan.id:4 vlan.flags: 0 (NONE) vlan.ingress-priority-map: vlan.egress-priority-map: [root@elanor network-scripts]# Then, I make sure that device alias is deleted: [root@elanor network-scripts]# ip link delete dev ethmain.4 [root@elanor network-scripts]# nmcli dev DEVICE TYPE STATE ethmainethernet unmanaged lo loopback unmanaged ethmain.2 vlan unmanaged ethmain.3 vlan unmanaged ethmain.5 vlan unmanaged [root@elanor network-scripts]# So far, so good. But then... [root@elanor network-scripts]# nmcli c up id vlan-ethgray Error: Connection activation failed: Device not managed by NetworkManager or unavailable Oops! [root@elanor network-scripts]# nmcli dev DEVICE TYPE STATE ethmainethernet unmanaged lo loopback unmanaged ethmain.2 vlan unmanaged ethmain.3 vlan unmanaged ethmain.4 vlan unmanaged ethmain.5 vlan unmanaged So, NM creates the correct alias (visible with ip link or ip addr), but bails before setting any addresses on it. This happens with NetworkManager-0.9.9.0-40.git20131003.fc20.i686. Any ideas how this could be fixed? -- Pete ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: networkmanager-openvpn will not connect
On Fri, 2014-07-04 at 16:05 +0200, Thomas Haller wrote: > On Fri, 2014-07-04 at 11:30 +, John Frankish wrote: > > Using networkmanager-openvpn- 0.9.8.4 patched to use libsecret, I am unable > > to connect. > > > > After configuring the vpn connection using gnome-control-center, I'm > > prompted for the vpn password, but after entering it I get the error " > > Connection activation failed: the VPN service failed to start". > > > > Running from the command line gives the output below. > > > > The tun module is compiled into the 3.8.13 kernel I'm using (CONFIG_TUN=y), > > is this the source of the error? > > Yes. Seems like that is the cause of the error: > > if (system ("/sbin/modprobe tun") == -1) > exit (EXIT_FAILURE); > > https://git.gnome.org/browse/network-manager-openvpn/tree/src/nm-openvpn-service.c#n1626 > > > I am not sure, how to fix that best(?) Ignore errors from the system() call and check for "/sys/class/misc/tun" ? ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: networkmanager-openvpn will not connect
On Fri, 2014-07-04 at 11:30 +, John Frankish wrote: > Using networkmanager-openvpn- 0.9.8.4 patched to use libsecret, I am unable > to connect. > > After configuring the vpn connection using gnome-control-center, I'm prompted > for the vpn password, but after entering it I get the error " Connection > activation failed: the VPN service failed to start". > > Running from the command line gives the output below. > > The tun module is compiled into the 3.8.13 kernel I'm using (CONFIG_TUN=y), > is this the source of the error? Yes. Seems like that is the cause of the error: if (system ("/sbin/modprobe tun") == -1) exit (EXIT_FAILURE); https://git.gnome.org/browse/network-manager-openvpn/tree/src/nm-openvpn-service.c#n1626 I am not sure, how to fix that best(?) Thomas signature.asc Description: This is a digitally signed message part ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
networkmanager-openvpn will not connect
Using networkmanager-openvpn- 0.9.8.4 patched to use libsecret, I am unable to connect. After configuring the vpn connection using gnome-control-center, I'm prompted for the vpn password, but after entering it I get the error " Connection activation failed: the VPN service failed to start". Running from the command line gives the output below. The tun module is compiled into the 3.8.13 kernel I'm using (CONFIG_TUN=y), is this the source of the error? Regards John -- $ nmcli con up uuid 540fd671-39c7-4b1c-9745-ff4b5690e259 Error: Connection activation failed: the VPN service failed to start $ sudo /usr/local/lib/NetworkManager/nm-openvpn-service --debug ** Message: nm-openvpn-service (version 0.9.8.4) starting... modprobe: module tun not found in modules.dep ** Message: real_need_secrets: connection - connection name : "connection" id : "VPN 1" (s) uuid : "540fd671-39c7-4b1c-9745-ff4b5690e259" (s) type : "vpn" (s) permissions : ['user:tc:'] (s) autoconnect : FALSE (s) timestamp : 0 (sd) read-only : FALSE (sd) zone : NULL (sd) master : NULL (sd) slave-type : NULL (sd) secondaries : [] (sd) vpn name : "vpn" service-type : "org.freedesktop.NetworkManager.openvpn" (s) user-name : NULL (sd) data : [ { 'username': }, { 'comp-lzo': yes }, { 'remote': uk1.vpn.xxx.com }, { 'connection-type': password }, { 'password-flags': 3 }, { 'ca': /mnt/sdb2/tmp/ca..com.crt }, ] (s) secrets : [ ] (s) ipv6 name : "ipv6" method : "auto" (s) dhcp-hostname : NULL (sd) dns : [] (s) dns-search : [] (sd) addresses : [] (s) routes : [] (s) ignore-auto-routes : FALSE (sd) ignore-auto-dns : FALSE (sd) never-default : FALSE (sd) may-fail : TRUE (sd) ip6-privacy : -1 (sd) ipv4 name : "ipv4" method : "auto" (s) dns : [] (s) dns-search : [] (sd) addresses : [] (s) routes : [] (s) ignore-auto-routes : FALSE (sd) ignore-auto-dns : FALSE (sd) dhcp-client-id : NULL (sd) dhcp-send-hostname : TRUE (sd) dhcp-hostname : NULL (sd) never-default : FALSE (sd) may-fail : TRUE (sd) ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list