VinnyD
Posts: 2
Joined: Thu May 16, 2019 12:24 am

Connecting the Pi to multiple WiFi networks simultaneously

Thu May 16, 2019 12:34 am

I have completed the official guide on setting up a Raspberry Pi as an access point in a standalone network (NAT), and it works, but I can't join other networks.

I want my Raspberry Pi to act as an Access point and a client at the same time, and I would like to be able to connect to multiple clients.

Basically, I want to implement the below architecture with my three raspberry Pis:

- Pi 1 joins Pi 2 and Pi 3's networks
- Pi 2 joins Pi 1 and Pi 3's networks
- Pi 3 joins Pi 2 and Pi 1's networks

Is this even possible? I tried searching the internet for tutorials on how to do this, but I failed to find anything useful. Any help here would be highly appreciated.

User avatar
topguy
Posts: 5566
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Connecting the Pi to multiple WiFi networks simultaneously

Thu May 16, 2019 10:59 am

Each Pi would need 2 wifi-adapters, unless there is some supported Wifi-mesh-protocol I dont know about.

epoch1970
Posts: 2994
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Connecting the Pi to multiple WiFi networks simultaneously

Thu May 16, 2019 11:33 am

Note: Topguy has the short version, just above :)

This looks suspiciously like a mesh network. How should things look like if a 4th Pi was to be added to the deployment?

If you want a wifi mesh, using batman-adv and adhoc wifi mode is probably the easiest solution. Should work with Pi's built-in wifi adapter. You'd get a single network in the end.

If you really want multiple separate wireless networks, you need multiple wifi adapters working as AP and as clients.
- The Pi's built-in WiFi adapter can do AP or STA (client) but not both. (Ok, not completely true but you'd better believe it if you don't want to waste an awful lot of time.)
- Some 1/3 party USB adapter should be able to do both or possibly run multiple virtual client interfaces.
So in the worst case you would need internal WiFi + 2 USB adapters on each Pi that needs to belong to 3 networks. Best case would be internal wifi + one USB adapter capable of exposing virtual interfaces.

If you only want multiple separate IP networks, you could go with a single AP/SSID/security scheme, and segregate clients via VLAN or IP tunnelling. There are various options there (vlan, vxlan, openvpn, wireguard etc.), I'd say none would be cheaper than buying a few USB adapters if you value your time in any way.

(Finally you can also attach any network interface to multiple IP networks by giving it multiple IP addresses; but I suppose that doesn't match your needs as it doesn't provide any form of enforceable isolation.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

VinnyD
Posts: 2
Joined: Thu May 16, 2019 12:24 am

Re: Connecting the Pi to multiple WiFi networks simultaneously

Sun May 19, 2019 7:54 pm

Thank you for the response guys. I bought three of these Wifi USB adapters.

Now while I am waiting for these adapters to arrive, do you guys know which documentation/guide I can use to set this up?

- Simple mesh network between Pi 1, Pi 2, and Pi 3
- Each Pi has to be AP, and broadcast a unique SSID

Return to “Networking and servers”