2

I want pi3 to be able to connect to 2 wifi access points at the same location. There are 2 wifi adaptors (the on-board and a plug in dongle). What I want to do is have a wlan1 use the wifi dongle that connects to an access point for IOT remote devices and wlan0 connects to user's router that has internet access. Can I have the standard supplicant file on the pi SD card with settings for the IOT node access and another supplicant file on a USB memory stick? This would allow user to enter their own wifi credentials in the usb file and not affect the OIT network?

3
  • Thanks for your response. What url does the user use to see the www-server page to edit credentials? I am new to wifi connectivity on pi. – David Huisman Mar 6 '17 at 0:46
  • My applications uses headless pi. – David Huisman Mar 6 '17 at 1:39
  • does your question point to my answer? then put this as a comment to the answer not as a comment under your question. Please clarify what you want to know... which URL the user type in the browser? This is up to you. In the config mode I've described below the raspberry is not connected to the internet. so you can redirect any URL to the config page. The raspberry can be headless.... GUI on the PI is not necessary. – Joe Platano Mar 8 '17 at 4:28
1

Yes this should be possible. You can link to different wpa_supplicant files in /etc/network/interfaces like

auto lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
   wpa-conf /mnt/router.conf

allow-hotplug wlan1
iface wlan1 inet manual
   wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

This should work fine. You should just ensure that the thumb drive is pluged in, the mount path is correctly set and the file will be found there. Another thing to ensure is that a text file created with windows might have different line endings and could therefore not read correctly.

Edit: It seems that you want to give the Pi to persons that haven't to much experience with Raspberry or Linux.

If it is for many persons there is maybe another approach:

Until the Raspberry has a valid wpa_supplicant for wlan0, the Pi starts in a config mode, where wlan0 brings up an AP and a www-server with a form to put in the routers credentials.

After the input is submitted and validated, trigger a few scripts that run wpa_passphrase to generate a wpa_supplicant file. Then a script can rewrite the /etc/network/interfaces so after a reboot the Pi will connect wlan0 and wlan1.

A nice add-on to this you can use the other dongle to create a list of available wifis with

iwlist wlan0 scan

and a script that scrape the SSISD form the output and write this to a text file. Use this text file to provide a select list in the config web site. This "get ssid" script run periodical you can use some ajax to refresh the config web page...

... but this is maybe just an approach if you have many users or like to fiddle around. ;)

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.