How do you make network connections persistent when using NetworkManager

I had a google of this but can’t find anything useful. I use networkmanager to configure my wireless card. Currently this only works when I’m logged in to KDE. If I log out the system loses the network connection. Is there a way to make it persistent using NetworkManager?

I do not think so. Network manager is specialy designed to let the end-user (that is the user that loged in into the GUI and as long as he is loged in) manage the network. Opposed to the “normal” situation where connecting to the network is a system task, configured by root, starting at boot (runlevel 3 and above) and stopped on shutdown (in YaST this is called: “traditional with ifup”).

Now the network manage approach is allready full of pittfalls because in a Unix/Linux system there can be many logeed in users, even in the GUI and I realy do not know which of those users is then able to manage the network (I am not using network manager, but you could do some interesting tests here). But to me it is rather clear that when the user logs out, he stops managing. The power to manage then goes either to another loged in user (or not, this could be one of the tests) or to the next user to log in.

Thus imho it is either “traditional with ifup” or networkmanager. As long as you allways (most of the time) connect to the same network (wired or wireless) you should go for traditional (imho that would include server only systems, desktops, laptops normaly not leaving the house).

You can check the thread:
Gave up Knetworkmanager. Made Networkmanager-GNOME work on KDE4!
and then define that connection to be available to all users.

Or you can switch to using “ifup”. I am currently using “ifup”.

Thanks, that’s very interesting that the GNOME network manager allows this but KDE’s doesn’t.

Who is the boss there? Which user? The one that loged in first?

If you use the gnome network manager, and set the connection to be shared with all users, then you are connected on boot - before anybody is logged in. And you stay connected on logout.

When logged in, you can switch to a different WiFi network. But when you logout, it reverts back to the shared WiFi connection. It actually works rather well. It’s a pity that the KDE network manager applet does not support this.

To me that is a combination of “ifup” from the standard config, to be overuled (if wanted) by the end-user networl manager interface for the duration of the login.

Not a bad idea. Do you configure the basic connection with YaST and the “traditional with ifup” method?

NetworkManager is using keeping the configuration for this in “/etc/NetworkManager/system-connections”, and the gnome nm-applet will create such entries. The KDE network manager has a selection for “System Connection” but it is always grayed out.

Back when I was running 11.0, NetworkManager was using the “ifup” configuration for a system connection. It isn’t using that now.

Thanks for this information. Seems that I have to read a bit more about NetworkManager (I do not use it, but it is still interesting).

I suppose that the configuration of the system connection is to be done by root. I guess that is what YaST > Network Devices > Network configuration does that when you choose for not “ifup”? instead of doing it in the /etc/sysconfig/network/ifcfg* files. Is that correct (I rather would not test this in a production system here)?

NetworkManager is mostly for laptops, anyway. I would not use it on a server.

When you enable NetworkManager, the “ifup” scripts instead start NetworkManager running as root (as a daemon). The KDE and gnome apps communicate with it, I think via udev. But the applets are just user-accessible front-ends, and the actual setting up of the network is done by the daemon running as root. (Or, at least, that is my understanding of how it works).

Currently, I have my laptop using “ifup”. I keep several versions of the “/etc/sysconfig/network/ifcfg-*” files. It isn’t very difficult to move the desired version into place, and then do “/etc/init.d/network restart”. However, you will need to switch to using “dhclient” to handle the DHCP. It seems that “dhcpcd” caches too much information and that won’t work when switching wifi networks.

Thanks. Your idea about networkmanager in fact being a daemon running as root is correct. After all only root can do things like up/down of network interfaces. And the applets (which which many end-users call Networkmanager) are in fact clients.

And I think (but I am not sure) that the communication is via dbus, not udev.

You are probably correct about that.

Other than the gnome applet there is always the NetworkManager cli for using NetworkManager without a desktop environment whatsoever :slight_smile: Don’t remember the name of it though as I don’t need such functionality.

Best regards,
Greg

I believe it is called “nmcli”. And I have been meaning to experiment with that.