1

I am using Ubuntu 14.04 server version on a turtle bot which is moving around. It is connected to my network with 4 APs around. My aim is to switch between APs when the turtle bot moves around. Currently it will keeps holding on to the current AP until the signal level is super bad before it switches. I wrote a script which constantly gets the strongest AP MAC address. I was wondering whether there is a way I can force connect to an APs MAC address. A little bit of googling and all I found was the below commands which didn't work when I tried it.

iwconfig wlan0 ap MACAddress  
ip link set wlan0 down  
ip link set wlan0 up  

I also found nmcli d wifi connect password iface bssid MACAddress which did help me to connect but I would like not to use password and username in the command, but use the setting in /etc/network/interfaces.Is there any other methods I can use to achieve what I need? I'm running Ubuntu 14.04.

2

You might want to look into and install wpasupplicant

How To: set up wpa_supplicant roaming mode and automatically start at boot

Specifically for the MAC address part, from the Gentoo wiki https://wiki.gentoo.org/wiki/Wpa_supplicant

Using bssid to specify which access point it should connect to using its MAC address, in case there are repeaters in place. Remember to use wpa_passphrase [passphrase] to generate the psk

FILE /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
ap_scan=1

network={
        bssid=00:50:17:31:1a:11
        ssid="YourSSID"
        psk="your-secret-key"
        scan_ssid=1
        proto=RSN
        key_mgmt=WPA-PSK
        group=CCMP TKIP
        pairwise=CCMP TKIP
        priority=5
}
  • Thanks for your reply, but my bot is running around and therefore the mac address keeps changing. Since we are hard coding mac address in wpa_supplicant.conf file, I cant use it for my purpose – Ajay Daniel Feb 27 '17 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.