User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Config for AutoConnect to multiple Wireless Networks

Wed Nov 21, 2012 12:57 pm

Can't find this anywhere else, I'd like to have a wireless config setup on one of my Pi's so that it will auto connect "on boot" to which ever one of two WEP secured Wireless Networks it finds first

Basically I want to run my Cam-Pi (for timelapse) on either my Home Wireless LAN or on an Android Hotspot Wireless LAN when I am using the setup in the wilds

Is this possible? Or do I need to attempt some hand cranked shell script stuff whereby I re-rewite my /etc/network/interfaces file and change the values of

wireless-essid
wireless-key

if I don't get a connection first time?
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Config for AutoConnect to multiple Wireless Networks

Sun Dec 02, 2012 8:45 pm

Anyone?

Is it seriously going to have to be a cron script that runs every 5 minutes that checks for a running wifi connection and if not connected it manually moves /etc/network/interface contents around and retries?
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Config for AutoConnect to multiple Wireless Networks

Sun Dec 02, 2012 8:57 pm

Started to google this... looks like logical interfaces and/or ifscheme is the answer, at least in part.

You can set up multiple WLAN definitions in /etc/network/interfaces like so

Code: Select all

iface wlan_home inet dhcp
    wpa-ssid mynetworkname
    wpa-psk mysecretpassphrase

iface wlan_android inet dhcp
    wpa-ssid androidnetworkname
    wpa-psk androidsecretpassphrase

And then issue one of the following commands as appropriate - I just need to crack the 'have I connected to somewhere?' question before issuing one of

Code: Select all

# ifup wlan0=wlan_home
or

Code: Select all

# ifup wlan0=wlan_android
to get it to auto connect to the right one on start up
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

mrhobbeys
Posts: 80
Joined: Wed Jul 18, 2012 2:53 am

Re: Config for AutoConnect to multiple Wireless Networks

Thu Jan 03, 2013 6:20 am

There is an easier way to do this but strangely finding the links to previously read pages has been strangely hard....

I will post back as soon as I have a solution that I have read about before.
www.betterpchealth.com
www.hektechnologies.com

Return to “Advanced users”