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.
# 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
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.