orbitcoms
Posts: 57
Joined: Sat Jan 16, 2016 11:12 am

Setting up 2 wifi adaptors

Sun Jul 23, 2017 7:54 am

Though I am still a beginner with pi, I assume this is the correct place to post my question as I believe it is a bit more complex than "beginner" level.

I am running new pi3 with latest Raspian Jesse OS and want to have a second wifi adaptor installed and connected to different AP than wlan0. I have several questions related to setup and use.

1. Should the pi be powered up and THEN the wifi plugged in, and once the adaptor shows up as wlan1 in the list on desktop then enter the credentials?
2. If I have entered credentials for wlan0 for access point "A" and then credentials for wlan1 on access point "B", will the pi always leave these settings and wlan0 always connects to "A" while wlan1 always connects to "B"?
3. AP "A" has internet connection while "B" is hosted on this pi. Also, the pi is running node-red. Will node red be able to automatically be able to access the internet from wlan0? ie. does pi use any available netwrok connection to attempt to reach the destination regardless of whether access is obtained by eth0, wlan0 or wlan1, Or do I need to do something to make the system aware of being able to reach the internet via wlan0?
4. Is it ok to let each wifi use dhcp or should I select manual or static ? The router will assign address in range "192.168.1.xxx" while the pi AP will assign in range "192.1.42.xxx".
Finally, is setting up credentials in the desktop sufficient or do I need to manually create entries in interfaces and supplicant files?

sparkyhall
Posts: 168
Joined: Mon Aug 27, 2012 9:14 am

Re: Setting up 2 wifi adaptors

Sun Jul 23, 2017 5:20 pm

1) I would plug your WiFi dongles in before applying power to the Pi. You can plug them in with power but you may find the Pi re-boots because the 5V supply rail drops when the dongle is plugged in.
2) The Pi should remember the settings for each dongle.
3) node-red should be able to access the internet by which ever dongle has access.
4) If I have understood your use case correctly then dhcp should be fine. If you do need static addresses this is easy to configure either on the Pi or you may be able to bind addresses to specific hardware in your router.

I never set credential with desktop tools so I can't answer the last part. For this and all other questions I would just try it, see what happens and ask further questions if needed.

User avatar
elkberry
Posts: 167
Joined: Wed Dec 28, 2016 9:21 pm

Re: Setting up 2 wifi adaptors

Sun Jul 23, 2017 8:31 pm

1. With sufficient power supply (read, 2.5A official wall wart), plugging in the Edimax Wifi adapter will work without any reboots on your 3B. I can even plug them into my Zero W with a 2A USB power supply while it is running, using one of those neat little USB OTG shims, or even an OTG hub. Your mileage may vary, though.
3. Whether any(!) application on your Pi can access the Internet simply depends on the configuration your Pi gets from the wlan0 wifi network, as well as the wlan1 wifi. With IPv4, it's best if only one of your wifi networks provides a default route with Internet access. It doesn't matter which wifi network provides it. If both networks supply default routes (and DNS service), things usually get very nasty, so better avoid such multi-homing with dual Internet access. Contrary to urban legend, dual Internet access usung two providers isn't a piece of cake in IPv4.
From ZX81 to Raspberry Pi, but wait ... where's the 7805 gone?

orbitcoms
Posts: 57
Joined: Sat Jan 16, 2016 11:12 am

Re: Setting up 2 wifi adaptors

Mon Jul 24, 2017 12:13 am

I have most things sorted out except 1 issue.

I booted with only wlan0 and assigned it to wifi AP "A"
I then plugged in the wifi Dongle and it showed up as wlan1, I associated this with AP "B"

So far, so good
Then I reboot and BOTH wlan0 and wlan 1 are being associated with the same AP "B" only.

How do I force wlan0 to always be associated with AP "A" and wlan1 always with AP "B"?

orbitcoms
Posts: 57
Joined: Sat Jan 16, 2016 11:12 am

Re: Setting up 2 wifi adaptors

Mon Jul 24, 2017 4:58 am

I managed to get pi to boot with wifi adapters connected correctly to the appropriate AP. Is what I have done below the "correct" approach? It works but not sure if something was overlooked.

in network interfaces I did this...

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

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-ssid "XXXX"
wpa-psk "XXXX"

Then in wpa_supplicant file...

network={
ssid="XXXXt"
psk="XXXX"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

Return to “Advanced users”