How to connect to internet using `nmcli`?
Using an 18-month old openSUSE with nmcli -v 0.8.2, I did the following:
nmcli dev wifi
That gave me a list, in which I could spot my own wireless hub. The key columns are SSID and BSSID.
I then used Start Menu-->Control Center-->Network Connections-->Wireless. I had one connection there called "Wireless connection 1". Selecting it, Edit...-->Wireless: fill in SSID and BSSID verbatim from the nmcli command above. Then on Wireless Security page, I entered my hub's password. The "Security" selection was based again on the nmcli output above. OK, Save...
Then (I did this as root; may not be necessary):
nmcli con up id 'Wireless connection 1'
Note the "id" is NOT the SSID or BSSID; instead this is the "nickname" on your computer for this network.
As stated above, /etc/NetworkManager/system-connections holds files of which "Wireless connection 1' is one (in my case).
The capability to define a new connection on the command line with nmcli dev wifi con …
was added in NetworkManager 0.9.6. (If you're using Ubuntu, that means release 12.10 or higher.) In earlier versions, new connections can only be defined through the GUI or by editing configuration files manually (in /etc/NetworkManager/system-connections
or under ~/.gconf
). You can activate an existing connection with nmcli con up
.
If you have no GUI to define connections, you can try wicd instead of NetworkManager.