Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

According to this link

nmcli dev wifi con a52c60f5-c1af-4d39-8dc8-728bd770bffc password 12345678 name dlink_home

should establish the connection, but it outputs the following error when I try to connect:

Error: 'dev wifi' command 'con' is not valid.

So, how I can connect to wireless internet/network using network-manager or nmcli in command-line mode?

PS. The OS I am running is RHEL6 Server

share|improve this question
    
Try dev wlan0 instead. –  Flup Jun 20 '13 at 11:57
    
Error: 'dev' command 'wlan0' is not valid. –  easl Jun 20 '13 at 11:59
1  
I tried nmcli con up id dlink_home but it only works after I start GUI with startx, without starting GUI nmcli nm's state is disabled. –  easl Jun 20 '13 at 12:00
    
See my answer over here: unix.stackexchange.com/a/79434/7453 –  slm Jun 20 '13 at 12:10
    
it does not connect by outputting the error i had mentioned above –  easl Jun 20 '13 at 12:13

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
wicd did not work either. It caused more troubles than it solved. –  Lord Loh. Nov 15 '13 at 21:58

Try:

nmcli dev wifi connect a52c60f5-c1af-4d39-8dc8-728bd770bffc password 12345678 name dlink_home

As per the man page:

OBJECT := { nm | con | dev }
............
dev
............
wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [iface <iface>] [bssid <BSSID>] [name <name>] [--private] [--nowait] [--timeout <timeout>]
share|improve this answer
    
Still the same error : Error: 'dev wifi' command 'connect' is not valid. –  easl Jun 20 '13 at 12:09
    
con is equivalent to connect here AFAIK. The problem is that they require a recent-ish version of nmcli. –  Gilles Jun 20 '13 at 19:27

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

I hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.