Ubuntu – How to trigger network-manager autoconnect

16.04network-managerplasma

Let's say that network-manager is connected to specific Wi-Fi network. When I click "Disconnect" via GUI from it then it never connects back.

But when I close the laptop lid, then open it back (so that system suspends and resumes) then network-manager automatically connects to the Wi-Fi network it finds.

How do I trigger network-manager from console to automatically connect to the Wi-Fi network it finds without doing system suspend and resume?

Best Answer

nmcli device set IFNAME autoconnect yes

is the command you're searching for. It enables autoconnect for the device with the interface name IFNAME, see e. g. nmcli device to get this name. If the device is currently not connected but finds a network it can connect to when you execute this command, it will instantly connect.

Related Question