LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Wirelessly Connecting to a Specific AP (http://www.linuxquestions.org/questions/slackware-14/wirelessly-connecting-to-a-specific-ap-4175431425/)

TommyC7 10-09-2012 10:57 PM

Wirelessly Connecting to a Specific AP
 
So I can't seem to figure this one out...

Basically I'm attempting to connect to a specific Access Point (AP) in a place with many AP's of the same name. I have the BSSID of the AP, but no matter what I do in rc.wireless.conf or rc.inet1.conf, I can't seem to connect to that AP again.

Here is my rc.wireless.conf:
Code:

...
B4:15:*)
    INFO="The only good router here..."
    ESSID="The-ESSID"
    MODE="Master" (iwlist scan picked up Mode as "Master" not "Managed" so this is correct)
    CHANNEL="1" (believe it or not, it is Channel 1.)
    IWCONFIG="ap B4:15:SP:EC:IF:IC"
esac

In this situation, SP:EC:IF:IC is the actual BSSID that I mentioned earlier and "iwlist scan" shows it each time I scan.

I commented two sections like the wiki has:
Code:

... (part at the very beginning)
#*)
#    INFO="Any ESSID"
#    ESSID="any"
#    ;;
... (part at the very end)
# Generic example (describe all possible settings)
#*)
#    INFO="Fill with your own settings..."
...

So I know I'm good on that.

Now in rc.inet1.conf I have:

Code:

IFNAME[1]="wlan0"
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]="yes"
...
WLAN_ESSID[1]="The-ESSID"
WLAN_MODE[1]="Master"
WLAN_WPA[1]="wpa_supplicant"
WLAN_CHANNEL[1]="1"

My rc.inet1.conf, rc.wireless.conf, the latter of which I never touched and wpa_supplicant.conf have not needed modifying because I was able to connect to this AP (and the others set up exactly the same way) perfectly fine.

However, today I wish to access this specific AP because it provides a better connection. Even with those settings that I placed, it still keeps accessing a different AP (same ESSID as the one I wish to connect to, but different BSSID is what I mean).

I've read the man page for rc.inet1.conf and there doesn't seem to be an option to set the specific BSSID to connect to. Only one to set the MAC address on the local machine. There is no man page for rc.wireless.conf so no luck there.

Also, when I add in:
Code:

WLAN_MODE[1]="Master"
To rc.inet1.conf, I get:
Code:

Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.

Alongside:
Code:

Error for wireless request "Set Nickname" (8B1C) :
    SET failed on device wlan0 ; Operation not supported.

But the latter is something I've always gotten.

eloi 10-11-2012 01:14 PM

What you are configuring is your wireless not the ap. Till i know your wireless should be in managed mode.

If there is no option to set the ap mac address let's add it.

Add this to your rc.inet1.conf:

Code:

WLAN_AP[1]="here the mac of the router"

In rc.wireless, in the section "# Empty all wireless parameters" below WPAWAIT="" add AP="":

Code:

WPADRIVER=""
WPACONF=""
WPAWAIT=""
AP=""

in the same file below WPA=${WLAN_WPA[$i]:-${WPA}} add AP=${WLAN_AP[$i]:-${AP}}

Code:

RTS=${WLAN_RTS[$i]:-${RTS}}
SENS=${WLAN_SENS[$i]:-${SENS}}
WPA=${WLAN_WPA[$i]:-${WPA}}
AP=${WLAN_AP[$i]:-${AP}}


in the same file and in the section "Regular stuff..." add:

Code:

if [ -n "$AP" ] ; then
        echo "$0:  $IWCOMMAND ap $AP" | $LOGGER
        $IWCOMMAND ap $AP
fi


What we are doing with the above is adding a iwconfig ap command to the Slackware init scripts.

I have no wireless now to try if this workarround works. Let me know if it does :).

The error about the nickname is because your wireless doesn't support this feature. If you don't want to see it comment out (in the same rc.wireless) the following:

Code:

#if [ ! -n "$NICKNAME" ] ; then
#    NICKNAME=$(/bin/hostname)
#fi
#if [ -n "$ESSID" -o -n "$MODE" ] ; then
#        echo "$0:  $IWCOMMAND nick $NICKNAME" | $LOGGER
#        $IWCOMMAND nick $NICKNAME
#fi


Good luck.

TommyC7 10-11-2012 05:48 PM

Hey eloi.

I appreciate the help, but I chose a simpler method. For some reason, in wpa_supplicant.conf's man page, the options aren't listed. However on another operating system (and on the internet), wpa_supplicant.conf's man page showed that it had a "bssid" option, so I just added that to /etc/wpa_supplicant.conf instead:

Code:

network={
        bssid=00:12:34:56:78:9A
        ...
}

I'm still not quite sure why the rc.wireless.conf method didn't work, though.

eloi 10-12-2012 05:39 AM

What I've explained above seems complicated because is some kind of patch to make the option "permanent". What it does is passing through Slackware bash scripts a command like this:

Code:

iwconfig wlan0 ap 00:11:22:33:44:55
But I've never used WPA encryption. I ignore to what extent wpa_supplicant inherit the options passed through iwconfig.

My advice is just comment this:

Code:

#*)
#    INFO="Any ESSID"
#    ESSID="any"
#    ;;

on rc.wireless.conf and leave the rest of that file untouched. Then make several attempts alternately passing your wireless options trough rc.inet1.conf and/or wpa_supplicant.conf.

The "simpler" solution would be changing the AP name ;-).

rob.rice 10-13-2012 08:53 PM

do it the easy way
in slackware/extras there's a package called wicd install it
you did install wirelesstools
any way wicd will scan for access points then give you a list to select from
set the password (if any) enable encryption (if the access point is encrypted) and handle it for you
will handle wired connections as well as wifi

overall a nice tool to have around

TommyC7 10-14-2012 02:59 AM

I prefer connecting to access points via the given tools in the operating system without having to resort to external programs or using ifconfig, wpa_supplicant/wirelestools and dh{cpcd,client} individually (just a personal preference).

rob.rice 10-14-2012 10:29 AM

cool do it your way
but I can sit down at a strange hot spot and be on the web in 30 seconds

eloi 10-14-2012 03:01 PM

Yeah. Why to bother in finding out how things work?

Use iPhone5. When something is broken (i.e. internet
connection) buy a new one. Easy.


All times are GMT -5. The time now is 02:35 PM.