# [Solved] wpa_supplicant choose network

## henning_bravo

Hello!

I cant figure out how to use wpa_supplicant. Every time I try to connect to a network it connects a the wrong one and I have no idea how to choose another. I saw wpa_cli but that didn't help much. Any good tips on how to choose network and stuff (no GUI program)?

Thanks!Last edited by henning_bravo on Tue Sep 23, 2008 6:02 pm; edited 1 time in total

----------

## isilia

Edit your /etc/wpa_supplicant/wpa_supplicant.conf file if you haven't yet. Here's a guide: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=4#doc_chap2

----------

## Voltago

Also, looking at/usr/share/doc/wpa_supplicant-<version>/wpa_supplicant.conf.gz"  helps.

----------

## di1bert

There is the wpa_gui app you can use, but it relies on QT which is a bit of a big library if you are trying to keep your system lean.

You can use the wpa_cli app...I stumbled apon the usage a while back

```

wpa_cli -iath0 add network

wpa_cli -iath0 set_network 0 ssid '"YOURNETWORK"'

wpa_cli -iath0 set_network 0 key_mgmt WPA-PSK

wpa_cli -iath0 set_network 0 pairwise TKIP

wpa_cli -iath0 set_network 0 group TKIP

wpa_cli -iath0 set_network 0 proto WPA

wpa_cli -iath0 set_network 0 psk '"YOURPASSWORD"'

wpa_cli -iath0 enable_network 0

```

Obviously you can modify this to your need. If will need the basic wpa_supplicant daemon running but it's very handy if

you want to script it...

HTH

-em

----------

## henning_bravo

I have done the config. But say I have two networks reachable were both are in my conf. Say I connect to the first but then want to switch to the second. How can I do that (without any GUI-tools)?

----------

## dfelicia

As others have said, wpa_cli

```
wpa_cli select_network <network id>
```

Type 

```
wpa_cli help
```

, or RTFM for more info.

You can also use the priority keyword in wpa_supplicant.conf  to arange order in which networks will be tried.

----------

## henning_bravo

 *dfelicia wrote:*   

> As others have said, wpa_cli
> 
> ```
> wpa_cli select_network <network id>
> ```
> ...

 

Thank you! =)

----------

