I have a Debian system with multiple network interfaces. For the uplink interface (eno2), two different profiles are valid, depending whether the system is:

  • on my desk
  • in the lab

I would want NetworkManager to always automatically try to connect using the Lab connection (profile) for eno2, as I can manually select the other profile, if necessary. How can I control which connection NetworkManager applies?

  • You could create a connection profile for it and add a startup script containing nmcli connection up id <connection-id> (more info. – harrymc May 25 '18 at 16:29

According to this: https://wiki.debian.org/NetworkManager

NetworkManager by default does not manage any wired network connections, those defined in /etc/network/interfaces.

You can tell NetworkManager to manage these by setting managed=true in /etc/NetworkManager/NetworkManager.conf.

You should then be able to define the configuration of NetworkManager, including the network you wish it to always attempt to connect.

  • thank you for the reply. However, on a recent Debian installation (9.3), the only interface defined in /etc/network/interfaces is the loop back interface, all others are by default managed by NetworkManager. In addition, my question was about controlling which connection NetworkManager applies. – Eero Aaltonen Jun 1 '18 at 12:24

Ok, I think I have a working solution for this.

First of all, the options available in the GUI for NetworkManager (network-manager-applet?) is rather limited, so it's better to use the command line interface directly, which is nmcli.

Tecmint had a reasonably good article on using nmcli.

The solution works by configuring Connection options as follows:

  • for each interface, I configure the default Connection so that it is bound to the interface with the interface-name option and only one such connection is bound per interface.
  • for all other Connections, I set the option autoconnect=false so that the Connection will only be applied, if I request so.

I think this should work. Will have to test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.