NetworkManager device autoconnect option: Meaning and status?

NetworkManager has an autoconnect option for devices:

nmcli device set eth1 autoconnect yes

However, I have not found any explanation what this option does. Is it related to the autoconnect option of NM’s connection object (which is well documented)? Does it interfere with a connection’s autoconnect? When should it be used?

Another question: While I know how to set a device’s autoconnect option, how can it be displayed? nmcli device show eth1 doesn’t show it.

man 1 nmcli
(Ubuntu Manpages)
:

# how to see the status
nmcli -f name,autoconnect con list

# it's another, and last occurrence of "autoconnect".
# it isn't specifies the properties of "autoconnect".
nmcli dev disconnect iface em2

              disconnects a connection on interface em2 and marks the device as unavailable for
              auto‐connecting. That's why no connection will automatically be activated on the
              device until the device's "autoconnect" is set to TRUE or user manually activates a
              connection.

Hello,

It just means that this connection will be automatically connected on system startup. You will see in nmcli con show conname.

Regarding the MAN page. You didn’t find it because you searched in the wrong place. Please see man 5 nm-settings. You will find the explanation at the begging of this doc.

Goodluck

1 Like

Thanks for the answers. However I was not looking for connection autoconnect, but device autoconnect.

nmcli device eth0 set autoconnect yes

Where can I check if this option is set? And what does it mean anyway?

# my bad; possibly:
nmcli -f name, **autoconnect** dev show

If you issue nmcli device disconnect eth0, the device goes down. Thereby, the device gets blocked from autoconnecting right again, otherwise you’d be pretty surprised if the device would be connected (again) after you disconnected it.

So, a device is either in a state where autoconnect is allowed or blocked. nmcli device set eth0 autoconnect yes|no simply sets that flag.

Note that even if a device currently is allowed to autoconnect, it will only autoconnect if it is also possible. E.g. if the cable is unplugged, it may not be able to autoconnect (at least, not a profile that enabled DHCP or IPv6 autoconf, because those addressing methods require cable plugged in).

Also, in order for a device to autoconnect, it also requires a suitable connection profile that is currently available on the device (e.g. the SSID must be in the Wi-Fi scan list). Also, most profile can only autoconnect once at each moment (see connection.multi-connect setting in man nm-settings).

Finally, if you do nmcli connection down, that blocks the profile from autoconnecting (for the same reasons that nmcli device disconnect blocks the device). But in that case, the device may autoconnect right away with another profile, if such a profile exists and all other circumstances are suitable.

1 Like