GNOME Bugzilla – Bug 660719
nmcli con down gets immediately reverted on automatic connections
Last modified: 2013-05-02 15:59:30 UTC
Running nmcli con down id my-connection-name doesn't work properly when a connection is configured to "connect automatically". The connection comes down for only a second, then goes back up again. Bringing the same connection down via nm-applet works as expected.
That's expected behaviour. There are two ways how to disconnect via NM D-Bus API [1]: * DeactivateConnection() method on org.freedesktop.NetworkManager * Disconnect() method on org.freedesktop.NetworkManager.Device DeactivateConnection() doesn't prevent from auto-connecting again Disconnect() prevents from auto-activation 'nmcli con down id "blah"' makes use of DeactivateConnection() 'nmcli dev disconnect iface wlan0' make use of Disconnect() and thus do what you want [1] http://projects.gnome.org/NetworkManager/developers/migrating-to-09/spec.html
> 'nmcli dev disconnect iface wlan0' make use of Disconnect() and thus do what > you want Thanks for the clarification. Is there a symmetrical "connect" command that works with an iface argument?
(In reply to comment #2) > > 'nmcli dev disconnect iface wlan0' make use of Disconnect() and thus do what > > you want > > Thanks for the clarification. Is there a symmetrical "connect" command that > works with an iface argument? No. And there's no need for it. You have to say what connection (parameters) you want to use. However, you *can* specify interface to 'con up' command: nmcli con up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>] See 'man nmcli'
This still leaves a gap in functionality. If a device is disconnected, NetworkManager still listens for events (eg. carrier sense) on the device, and when it gets one it deactivates the device. If I have configured an IP address for the device, NetworkManager clears it. So I have no way to get NetworkManager to leave the interface entirely alone. (Unless I delete the connection; but then there is no easy way to get it back.)
NM bugzilla reorganization... sorry for the bug spam.