Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In my area, there is a big network of around 50 routers with same SSID. My devices automatically connect to the closest and strongest network.

How can I connect to one of those manually which are in the range?


| Router || Network SSID || Strength |
| One    || RandomName   || 85%      |
| Two    || RandomName   || 75%      |
| Three  || RandomName   || 65%      |
| Four   || RandomName   || 60%      |

My device automatically connect to Router One because it has the maximum strength. How can I connect to Router Two or Router Three (or Four)?

I need a solution for Linux.

share|improve this question
You're looking to connect to a specific BSSID. We have an existing question for Windows ( superuser.com/questions/485517/…), so you can either make this Linux-only or have it closed as a duplicate. –  Bob May 1 at 10:30
Also, IIRC Kubuntu's wireless utility lets you specify a BSSID. –  Bob May 1 at 10:31
@Bob, I made the question Linux only, but I don't think that specific question has a good solution already. How can I get the Kubuntu's wireless utility on Ubuntu? –  Akshat Mittal May 1 at 10:37

1 Answer 1

You can do it by connecting to the AP manually.

First, it is easiest to turn off network manager, if you are running one:

  sudo service network-manager stop

Then you need to identify the BSSID of the AP you wish to join: the command

 sudo iw dev wlan0 scan

(if you are using wlan0 as your wireless interface) will produce a lot of output, among which you will find something like:

  BSS f8:1a:67:aa:7f:b9 (on wlan0) -- associated
    TSF: 629432841083 usec (7d, 06:50:32)
    freq: 2417
    beacon interval: 100
    capability: ESS Privacy ShortPreamble SpectrumMgmt ShortSlotTime (0x0531)
    signal: -70.00 dBm
    last seen: 0 ms ago
    Information elements from Probe Response frame:

(the output is longer than this). The relevant part is of course BSS f8:1a:67:aa:7f:b9.

Next, you will have to free your interface of any previous IP addresses, just in case:

  sudo ip link set wlan0 down
  sudo ip addr flush dev wlan0
  sudo ip link set wlan0 up

Now you specify you want to connect to the specific AP:

  sudo iwconfig wlan0 essid MySSID_NAME ap f8:1a:67:aa:7f:b9

where of course ap precedes the BSSID you just identified.

Now you need to start wpa_supplicant,

 sudo wpa_supplicant -Dnl80211 -i wlan0 -B -c FILE_with_WPA_Secrets

(if you do not know how to set up the file with your WPA credentials, you may look it up here for instance; just be careful, where it says network= {, it should be network={ without a space). Lastly,

 sudo dhclient -v wlan0

(the -v flag does not work on all Linux distros, I like it because I can monitor what is happening).


The instructions above work for a network with WPA security. Fore WEP security, replace the wpa_supplicant command with:

  sudo iwconfig wlan0 key s:Your_WEP_password

Remember that the two characters s: before your password are necessary. After this, once again

  sudo dhclient -v wlan0
share|improve this answer
This is interesting. I'll try it for sure, but one thing I notice is it says WPA credentials, the network I am talking about is on WEP, it will still be the same? –  Akshat Mittal May 1 at 11:45
@AkshatMittal No, it is actually easier. Pls see my edit –  MariusMatutiae May 1 at 13:09
Thank you. I'll try that in sometime. :) –  Akshat Mittal May 2 at 14:54
Seems like it ain't working for me, I tried on multiple systems. I always have some sort of error in any one of the steps. –  Akshat Mittal May 4 at 14:01
@AkshatMittal Could you be more specific? –  MariusMatutiae May 5 at 5:23

Your Answer


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.