# Blocking networks in wpa_supplicant

## PM17E5

I can't seem to find much on the forums or on google about blocking certain ssids in wpa supplicant. I do a lot of roaming and often run into networks that keep stealing the priority due to their signal strength, and prevent me from connecting to more reliable networks. Even when I set the priority properly in wpa_supplicant it still seems to pick them because they are open. Does anyone have any ideas?

----------

## massimo

You could try setting the fields (forcepreferredonly or blacklist_aps, ....) mentioned at [1] accordingly.

[1] Wireless Networking

----------

## PM17E5

Thanks for the pointer in that direction. I'm playing around with it and it doesn't seem to be working yet but now at least I know what to read up on. It doesn't seem like wpa supplicant cares much for the settings but I'm sure it must be something I'm doing wrong. Also while I'm at it, is there any way to specify keys in the wpa_supplicant.conf file by the MAC of the AP rather than the SSID? For example, I try to connect to a network which has ! at the end of the SSID and a space in the name and it doesn't seem to be relating to it properly.

----------

## Gh0str1d3r

you can use

```
bssid=00:aa:b0:d5:11:70
```

to give the mac instead of the name.

----------

## pappy_mcfae

Set the qt4 USE flag and re-install wpa_supplicant so you get wpa_gui. To do it quickly, enter USE='qt4' emerge -av1 wpa_supplicant. Depending on what you use as your desktop, that could be a lot of new packages. If you use KDE, you should be fairly OK. Once you have wpa_gui, then you have a bit more control over the networks to which you connect.

Cheers,

Pappy

----------

## PM17E5

Is there any other way? I'm still having issues with this. It really annoys me to always have it connect to an open network rather than the one I want to just because it's got a better signal. It doesn't seem to follow priority setting that well either. And I'd really like to try and avoid having to install the qt4 core just to use it  :Sad: .

----------

## pappy_mcfae

As far as I know, this is the only way to get wpa_gui. Having just gone through the "fun" of doing a machine setup via wireless, this is it. 

If you want to go for manually editing /etc/wpa_supplicant/wpa_supplicant.conf, that might work, but it will also be a guaranteed pain. If you're really adventurous, you might want to play with wpa_cli, but be prepared to learn lots of new switches, and know that wpa_cli only works properly when connected to a wireless access point first.

Good luck.

Cheers,

Pappy

----------

## PM17E5

I guess I'll have to grab the dependencies, you're right wpa_cli and wpa_supplicant.conf aren't that fun to mess with. It's too bad it doesn't have an ncurces interface for it.

----------

## pappy_mcfae

Believe me, I understand. Were it not for wpa_gui, I wouldn't have qt4 on this machine. Since it still runs KDE-3.5, I only need qt3 for everything BUT wpa_gui. Then again, with five hundred gigs on a laptop, I'd say I'm not really losing a lot of space for everything else.

Cheers,

Pappy

----------

## PM17E5

Quick side question. I installed wpa_gui but for some reason it never saves my settings or writes anything to the config. My permissions seem to be alright though and I run it in root. Can anyone git some tips on how to maybe run it as a normal user to be on the safe side and how to make it write settings to the config file?

----------

## pappy_mcfae

I'll go you one better. Here's the modified version of my /etc/wpa_supplicant/wpa_supplicant.conf I use on this machine. Note that the passkeys have been changed in case someone near me wants to get into some of my private networks.

```
ctrl_interface=/var/run/wpa_supplicant

update_config=1

network={

   ssid="someone_who_uses_wep"

   key_mgmt=NONE

   wep_key0=11111111111111111111111111

   id_str=""

}

network={

   ssid="never_you_mind"

   psk=9c3ff36784f2bb2dbb6041c229bafe302a2b9d43df3704c53d77cccc8771bd7e

   proto=WPA

   key_mgmt=WPA-PSK

   pairwise=TKIP

   group=TKIP WEP104 WEP40

   auth_alg=OPEN

}
```

I believe the first two declarations are what allows wpa_gui to write to  /etc/wpa_supplicant/wpa_supplicant.conf. As for non-root user issues, I don't think you need to change anything in /etc/group. If I am wrong on that, someone else please chime in. I have been root user since I first played with Slackware when Windoze-3.1 ruled the land, and the 486 was king!

Cheers,

Pappy

----------

## ddriver

Can't you just add "disabled=1" to the section in wpa_supplicant.conf for the networks you don't want?

----------

## ddriver

 *PM17E5 wrote:*   

> Quick side question. I installed wpa_gui but for some reason it never saves my settings or writes anything to the config. My permissions seem to be alright though and I run it in root. Can anyone git some tips on how to maybe run it as a normal user to be on the safe side and how to make it write settings to the config file?

 

CTRL-S to save settings.

----------

