Use Network-Manager to Connect to a wifi Access Point on the command-line

Posted by Stefano Palazzo on Ask Ubuntu See other posts from Ask Ubuntu or by Stefano Palazzo
Published on 2010-10-19T18:21:17Z Indexed on 2012/04/11 11:42 UTC
Read the original article Hit count: 356

I'd like to connect to a wireless access point from the command-line. ideally, I'd only need the name of the AP. But the hardware-address would work as well.

I know I can use nmcli to connect to a managed network connection, but in my case, the access point may not be configured for Network-Manager yet (See the difference between the output of nm-tool and nmcli con).

Example output of nmcli:

Auto pwln       3a3d62b1-bbdf-4f76-b4d2-c211fd5cfb03   802-11-wireless [...]  
Wired Network   aa586921-accf-4932-98c4-c873c310f08e   802-3-ethernet [...]  
Cisco-UDP Uni   7f94847b-04dc-40b7-9955-5246fb77cc65   vpn [...]  
T-mobile (D1)   867f345a-cbbf-4bd4-b883-a5e5ae0932f0   gsm  [...]

Example output of nm-tool:

State: connected
- Device: eth1  [Auto pwln] ----------------------------------------------------
[...]
  Wireless Access Points (* = current AP)
    *pwln: Infra, [...], Freq 2472 MHz, Rate 54 Mb/s, Strength 80 WPA WPA2
    WLAN:  Infra, [...], Freq 2422 MHz, Rate 54 Mb/s, Strength 20 WPA WPA2

[...]

How do I connect to an access point that may or may not be known to NM?

Extra: Finding out if the connection needs a pass-phrase, and submitting it on the command-line as well would be great too (that is to say It'd be nice if network-manager wouldn't pop open any keyring dialogues or errors on the gui)

© Ask Ubuntu or respective owner

Related posts about 10.10

Related posts about command-line