Re: traffic statistics by network connection
Thomas Haller wrote: On Tue, 2021-07-20 at 16:26 -0400, David H Durgee via networkmanager- list wrote: How can I get traffic statistics by network connection? Is there a way to retrieve this using nmcli? Is there another tool that will do so? I have looked around and the tools I see work at the interface level, not at the connection level. I am using nmcli 1.22.18 as distributed with linux mint 20.1 x64 here. Ui, a "connection" is a profile, that is a bunch of settings for configuring a network interface. Basically, see the lower-case keys in `nmcli connection show "$PROFILE". A profile has no traffic statstics, nor would it make sense. Well, that's not entirely correct and I guess it might make some sense to collect statistics associated with a profile. NM associates additional information to prfiles with "connection.timestamp" and "wifi.seen-bssids" properties and there are also the lease files under /var/lib/NetworkManager. But these are exceptions, usually a profile is just the settings that the user configured. In particular traffic statistics are not tracked or associated with connection profiles in NetworkManager (yet). On D-Bus, $ busctl -j call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects you see the "org.freedesktop.NetworkManager.Device.Statistics" interface (which is per-interface). That exposes the RX/TX bytes. That is basically the same as kernel reports via netlink API. However, the values are stale unless you RefreshRateMs to a positive value (which causes NM to periodically poll the statistics from kernel). There is no further magic with "org.freedesktop.NetworkManager.Device.Statistics". You could just as well read the information via netlink. These statistics are ad-hoc, and will be lost after reboot (or when the interface dispears). I guess you could build an interesting tool for that. I am not aware that one exists. However, the API was added by Ubuntu developers, and presumably the do have a use for it and a tool. best, Thomas My reason for asking about this was as a means of confirming proper operation of a strongswan VPN. When activated this VPN does not create a tun interface as the VPN I was previously using did. I had hoped to find some way to confirm that the traffic is indeed being routed via the VPN as opposed to going directly over the WiFi connection even when the VPN is active. Perhaps I need to take another approach. How difficult would it be for me to modify the connection to add a tun interface? I see no way to specify this in the GUI, but inspecting the lapsed VPN connection shows a "dev=tun" statement in the VPN section of its nmconnection file. Would manually adding such a statement to the strongswan VPN nmconnection file be sufficient? Are other additional statements required that are not present by default? Dave smime.p7s Description: S/MIME Cryptographic Signature ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: how to disable WiFi / wpa-supplicant so hostapd can be used ?
Thank You so much, Thomas, for the most useful info ! RE: > Patch welcome to properly handle the release of a device > by setting it unmanaged. I will investigate this and see what I can do to improve management of wpa_supplicant (W_S) & wireless interfaces. I'd also like to develop a patch to make NM fully hostapd aware , so that the code realizes that use of W_S and hostapd are mutually exclusive for an interface , and which add settings for fully setting up & managing hostapd as well as W_S . And to allow switching between hostpd & W_S modes. hostapd probably needs its own module to manage things like providing dhcp service to connecting usits - I've been using static IP because I only have a few connecting devices - happily Android phones do allow connections to WEP APs with a static IP . But full Address Pool & DHCP server mgmt is needed for arbitrarily large numbers of connecting units. And the NM GUIs / applets would need changes to support the new hostapd settings . On 21/07/2021, Thomas Haller wrote: > On Tue, 2021-07-20 at 22:04 +0100, Jason Vas Dias via networkmanager- > list wrote: >> If I do : >> # nmcli radio wifi off >> , it disassociates the PHY for the device and I have to >> 'rfkill $id unblock' . >> If I reenable wireless, and do >> # systemctl stop wpa_supplicant >> # mv /usr/sbin/wpa_supplicant /usr/sbin/wpa_supplicant.bin >> after starting NM, then I can run hostapd . >> I have to remember to move wpa_supplicant back after I stop >> using hostapd . >> Please add support for enabling either hostapd or wpa_supplicant, >> not both, to NM = or is there some way of disabling running the >> wpa_supplicant service only, without rfkill ? > > Hi, > > > configure the device as unmanaged. > > Temporarily, with `nmcli device set wlan0 managed no` > > > Permanently, there are several means (udev rules, config files). the > best seems to be a file > > /etc/NetworkManager/conf.d/90-wlan-unmanaged.conf > > with > > [device-90-wlan-unmanaged] > match-device=interface-name:wlan0 > managed=0 > > see `man NetworkManager.conf`. > > > If you do it that way, you can still override it at runtime with `nmcli > device set wlan0 managed yes`. > > > > I think `nmcli device set wlan0 managed yes` may not sufficiently > instruct wpa_supplicant to let go of the device. That means, you still > might need `systemctl stop wpa_supplicant.service`. Patch welcome to > properly handle the release of a device by setting it unmanaged. > > > > best, > Thomas > > >> >> >> On 20/07/2021, Jason Vas Dias wrote: >> > >> > Good day - >> > >> > Whenever I try to run hostapd, NM still runs wpa-supplicant, >> > which periodically tries to put the WiFi interface into scanning >> > mode, which messes up the hostapd session . >> > >> > Please is there a config file setting or applet interaction >> > to disable wpa-supplicant (and maybe configure & run hostapd) ? >> > >> > I'd like NM to start dhclient on my Wired interface, and >> > be able to bring up my L2TP VPN, but leave the Wireless >> > interface entirely alone. >> > >> > Any way to do this in NetworkManager.conf or GUI ? >> > >> > Thanks in advance for any replies, >> > Best Regards, >> > Jason >> > >> ___ >> networkmanager-list mailing list >> networkmanager-list@gnome.org >> https://mail.gnome.org/mailman/listinfo/networkmanager-list >> > > > ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: traffic statistics by network connection
On Tue, 2021-07-20 at 16:26 -0400, David H Durgee via networkmanager- list wrote: > How can I get traffic statistics by network connection? Is there a > way > to retrieve this using nmcli? Is there another tool that will do so? > > I have looked around and the tools I see work at the interface level, > not at the connection level. > > I am using nmcli 1.22.18 as distributed with linux mint 20.1 x64 > here. Ui, a "connection" is a profile, that is a bunch of settings for configuring a network interface. Basically, see the lower-case keys in `nmcli connection show "$PROFILE". A profile has no traffic statstics, nor would it make sense. Well, that's not entirely correct and I guess it might make some sense to collect statistics associated with a profile. NM associates additional information to prfiles with "connection.timestamp" and "wifi.seen-bssids" properties and there are also the lease files under /var/lib/NetworkManager. But these are exceptions, usually a profile is just the settings that the user configured. In particular traffic statistics are not tracked or associated with connection profiles in NetworkManager (yet). On D-Bus, $ busctl -j call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects you see the "org.freedesktop.NetworkManager.Device.Statistics" interface (which is per-interface). That exposes the RX/TX bytes. That is basically the same as kernel reports via netlink API. However, the values are stale unless you RefreshRateMs to a positive value (which causes NM to periodically poll the statistics from kernel). There is no further magic with "org.freedesktop.NetworkManager.Device.Statistics". You could just as well read the information via netlink. These statistics are ad-hoc, and will be lost after reboot (or when the interface dispears). I guess you could build an interesting tool for that. I am not aware that one exists. However, the API was added by Ubuntu developers, and presumably the do have a use for it and a tool. best, Thomas ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: how to disable WiFi / wpa-supplicant so hostapd can be used ?
On Tue, 2021-07-20 at 22:04 +0100, Jason Vas Dias via networkmanager- list wrote: > If I do : > # nmcli radio wifi off > , it disassociates the PHY for the device and I have to > 'rfkill $id unblock' . > If I reenable wireless, and do > # systemctl stop wpa_supplicant > # mv /usr/sbin/wpa_supplicant /usr/sbin/wpa_supplicant.bin > after starting NM, then I can run hostapd . > I have to remember to move wpa_supplicant back after I stop > using hostapd . > Please add support for enabling either hostapd or wpa_supplicant, > not both, to NM = or is there some way of disabling running the > wpa_supplicant service only, without rfkill ? Hi, configure the device as unmanaged. Temporarily, with `nmcli device set wlan0 managed no` Permanently, there are several means (udev rules, config files). the best seems to be a file /etc/NetworkManager/conf.d/90-wlan-unmanaged.conf with [device-90-wlan-unmanaged] match-device=interface-name:wlan0 managed=0 see `man NetworkManager.conf`. If you do it that way, you can still override it at runtime with `nmcli device set wlan0 managed yes`. I think `nmcli device set wlan0 managed yes` may not sufficiently instruct wpa_supplicant to let go of the device. That means, you still might need `systemctl stop wpa_supplicant.service`. Patch welcome to properly handle the release of a device by setting it unmanaged. best, Thomas > > > On 20/07/2021, Jason Vas Dias wrote: > > > > Good day - > > > > Whenever I try to run hostapd, NM still runs wpa-supplicant, > > which periodically tries to put the WiFi interface into scanning > > mode, which messes up the hostapd session . > > > > Please is there a config file setting or applet interaction > > to disable wpa-supplicant (and maybe configure & run hostapd) ? > > > > I'd like NM to start dhclient on my Wired interface, and > > be able to bring up my L2TP VPN, but leave the Wireless > > interface entirely alone. > > > > Any way to do this in NetworkManager.conf or GUI ? > > > > Thanks in advance for any replies, > > Best Regards, > > Jason > > > ___ > networkmanager-list mailing list > networkmanager-list@gnome.org > https://mail.gnome.org/mailman/listinfo/networkmanager-list > ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list