4

I figure this is the best place to ask. Many IOT devices need to be connected to a network, and sometimes require Internet access, but not 100% of the time. Usually it's fine to just connect them to your WiFi network and be done with it. As a user of mobile Hotspot, I don't use broadband. Is there a way to have a continuous wireless network while I'm away with my phone, then allow the phone to connect and provide its Internet connection?

3

It would be relatively easy to build something to do what you want.

A Raspberry Pi 3 with a extra WiFi USB dongle should be enough.

Set the Pi up with hostapd to act as a WiFi Hotspot using the built in WiFi adapter. It should probably also run something like dnsmasq to provide DHCP and DNS caching/forwarding.

Then set up the extra USB WiFi adapter to connect to the phone's WiFi hotspot.

Set up the Pi to act as a NAT gateway for any traffic on it's own hostspot and have a default route via the phone.

This should automatically connect to the phone when it's in range allowing access to the wider Internet while also providing a local always on LAN for devices while you are away.

(It is technically possible to do this all with just the build in WiFi adapter, but it's easier and you will get better through put with 2 adapters)

Of course this does mean that a lot of the benfits of most consumer IoT devices will be lost, as you will not be able to control any devices while away from home or receive alerts from them as they will have not connection.

|improve this answer|||||
  • Yes, internet connected functionality will be limited but I don't fancy leaving my phone at home. It does help for remote control and schedule setting via apps etc. Do you think a Pi Zero would be capable of supporting a load like this? Simply because I have one of those. – Seraphim Jester Jun 20 '19 at 15:11
  • Yes a Pi Zero would be more than capable (once you add a USB-to-Go adapter to add the second WiFi adapter) – hardillb Jun 20 '19 at 15:16
2

This is certainly possible with a single consumer-grade wireless access point/router. Most have the ability to act in client mode, where the device's wireless card runs in managed mode and it connects to an existing wireless network. This network can then be bridged to the Ethernet switch and/or another wireless network that it hosts in master mode. The particular configuration will depend on the exact interface.

If the default firmware doesn't provide simultaneous client/master functionality, custom firmware likely will.

You will have to decide how you will want parts of the network to operate. If you run a DHCP server on both the phone (probably not able to turn off) and the access point, you would need it to act as a router instead of just bridging it. If the access point is just bridged, the entire network will rely on the phone providing DHCP, and devices might not be able to reconnect when the phone is not present unless they have a static address.

You could also accomplish the same with two access points connected via Ethernet cable. One could act as a client; the other as a master. You would just need to make

|improve this answer|||||
  • Looks good. Could you clarify for me, would a minimum build require 2 routers and 1 ethernet cable connecting the two? – Seraphim Jester Jun 20 '19 at 15:09
  • No, just a single wireless access point that is broadcasting a persistent network and your phone providing the hotspot periodically, which the access point connects to as a client. No cables needed. Unless the router cannot do both at one time, in which case you would require the hardware you mentioned. – multithr3at3d Jun 21 '19 at 22:37
  • Please edit the clarifications into the answer. Thanks – Helmar Jun 23 '19 at 17:16

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.