tette
Posts: 16
Joined: Fri Jun 28, 2019 2:56 pm

3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:13 pm

I'm looking to set up my 3B with the IoT style wifi setup where, after you turn the pi on, it tries to connect to a wifi network, but if it fails it'll set itself in an AP mode with a web interface to enter wifi credentials to the local network.

Is this possible with the pi?

bls
Posts: 720
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:18 pm

Absolutely! This post https://raspberrypi.stackexchange.com/q ... 221_100196 fully documents a way to do this. I've made it part of my "standard configuration"
Pi tools:
Easily and quickly build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Free your network from your router's DHCP/DNS:https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

tette
Posts: 16
Joined: Fri Jun 28, 2019 2:56 pm

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:19 pm

bls wrote:
Fri Aug 02, 2019 5:18 pm
Absolutely! This post https://raspberrypi.stackexchange.com/q ... 221_100196 fully documents a way to do this. I've made it part of my "standard configuration"
Thanks for the link and tip! I'll have a read through and see if I can set it up :)

hippy
Posts: 8081
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:29 pm

It is possible ...

https://github.com/balena-io/wifi-connect

Other "hotspot" and "honeypot" guides also provide relevant and useful information, but the thing is figuring what enables the AP and networking, and what does the forwarding or other things you don't want or need for your particular scenario..

You only need "hostapd" to create an AP, "dnsmasq" to route connections to your own web server etc, "iptables" to drop stuff you don't want when in AP mode.

bls
Posts: 720
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:33 pm

Great! Post here or there if you have any questions/problems. I did notice that the github repo jake created doesn't seem to exist any more. I'll look into polishing up my stuff and posting it.
Pi tools:
Easily and quickly build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Free your network from your router's DHCP/DNS:https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

tette
Posts: 16
Joined: Fri Jun 28, 2019 2:56 pm

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 5:45 pm

Thanks for the links!

Which is better/easier, https://raspberrypi.stackexchange.com/q ... 221_100196 or the wifi-connect?

bls
Posts: 720
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: 3B IoT style wifi setup with AP?

Fri Aug 02, 2019 8:13 pm

tette wrote:
Fri Aug 02, 2019 5:45 pm
Thanks for the links!

Which is better/easier, https://raspberrypi.stackexchange.com/q ... 221_100196 or the wifi-connect?
Of course "it depends". The StackExchange link describes a very lightweight mechanism. wifi-connect looks like a very complete and featureful implementation, but more complex than the StackExchange link method. So, depends on what you want. And, like just about everything on Linux (Raspbian), better/easier can be highly subjective :lol:
Pi tools:
Easily and quickly build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Free your network from your router's DHCP/DNS:https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

hippy
Posts: 8081
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: 3B IoT style wifi setup with AP?

Sat Aug 03, 2019 12:03 pm

bls wrote:
Fri Aug 02, 2019 8:13 pm
wifi-connect looks like a very complete and featureful implementation, but more complex than the StackExchange link method.
WiFi Connect worked brilliantly when I tried it, did exactly what it said it would. But it uses Network Manager rather than dhcpcd and I couldn't figure out exactly how one automates it nor test how it behaves when the network is lost because I wasn't going to turn my router off and could not move the Pi or block WiFi enough for it to lose the connection.

I am also not sure if it supports wired with fall-back to WiFi, with fall-back then to being a hotspot, which is what I would ideally like.

The StackExchange solution also works, but I don't have enough experience of either to say which is best, though anything which uses what Raspbian uses by default would seem to me to be a better solution.

As with most things there is a 'try it and see' element to what is best and most suitable for any particular use case, often with additional research required.

The advantage of the Pi is one can grab a fresh SD Card, try anything and easily be back to how one was if one doesn't like what one has tried.

I am currently running a Python program in the background, checking network connection, and issuing commands to change the configuration, because, so far, that feels best for me. But I'm still open to something which may be better.

bls
Posts: 720
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: 3B IoT style wifi setup with AP?

Mon Aug 05, 2019 1:06 am

OK, polishing done. You can find the first release of autoAP at https://github.com/gitbls/autoAP. Small and fast...Enjoy!

PS It doesn't yet have the web page for entering WiFi credentials. That's next!
Pi tools:
Easily and quickly build customized-just-for-you SD Cards: https://github.com/gitbls/sdm
Free your network from your router's DHCP/DNS:https://github.com/gitbls/ndm
Easy strongSwan VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

Return to “Networking and servers”