Raspberry Pi Auto-Hotspot
Initial software from http://blog.sip2serve.com/post/48420162196/howto-setup-rtl8188cus-on-rpi-as-an-access-point
The concept of headless Pi at Jams and in classrooms has always been a subject close to my heart and recently I’ve been trying to go down the route of a Pi that see if it gets an IP address from a DHCP server, if not – it turns itself into a hotspot so that other computers can connect and communicate to it over WiFi.
So sequence should be
1. Check if IP been handed out on WiFi from a DHCP server – if OK End
2. If not, create hotspot for other Pi/clients to use.
The basic software needed is something called hostapd to make the Pi appear as a WiFi access point and dnsmasq so that it can hand out ip addresses to anything connecting to it.
Note: Hopefully this current state will be taken over by @heeedt https://github.com/heeed/hotpi
Working Hotspot (but no automatic changeover) using 8188CUS based adaptors
To get this working you need to connect your Pi to the internet using a LAN cable.
Then copy and paste this into an LX Terminal session
wget http://git.io/wZV8tg -O ipispot.sh
and then type
sudo bash ipispot.sh
You will be asked a series of questions but unless you an advanced geek or the network you are running on is using 10.0.0.xx addresses – just accept the default for each question
The only exceptions to this would be for your country and WiFi channel number
At the end, it will ask to reboot – once done, you should now see a open ClassPi available WiFi connection that you can connect to.
The hotspot does not supply a bridged connection to your LAN and the internet – (it would be an access point if it did that) it is purely designed to let you connect to it from a WiFi laptop or any WiFI enabled device such as as tablet
Please try and give me feedback
Works great, been wanting to do this for a while.
However how do I easily revert back to non hotspot mode?
The idea is to make it auto-matic so that if it finds a known wifi (e.g at home) then it conencts to that and only goes into hotspot mode when it can’t find normal situation (e.g at a Jam or a mates house)
So stage 2 is to do that bit 🙂
Simon – thanks for this – it is looking very good so far.
One thing I noticed, the script gathers security info, but the generated hostapd.conf file has the security parameters commented out – so the access point comes up with no security in place. Might be worth letting people know about this – and which file to mod if they want to enable security.
I’m almost up and running – works fine with no security, but when I uncomment the lines in hostapd.conf I can see the AP network, and connect but it gets stuck in an Authentication loop (possibly getting IP ) – but then I had a similar problem when I was setting up an Access point manually (Adafruit tutorial) – must be something I’m doing wrong – or maybe my network dongle – I’ll keep going and see what I can discover.
I’m a no security person 🙂 (there’s always a way to crack WiFi so I never botherin the first place)
The idea is that this will be a fallback mode when it can’t find its normal AP and for primary classrooom use so no password is a requirement but I’ll try and see which lines need uncommenting to enable the password 🙂
Well I’m certainly not a security expert either 🙂 But having just wrestled with this topic and reading multiple online tutorials last week, the topic is fairly fresh for me.
I believe that after running your script, if you uncomment the lines in the file /etc/hostapd/hostapd.conf and reboot it should come up in “secure” mode and need a WPA/2 password etc.
Using your script and a different wifi dongle (Edimax) I have a nice “secure” access point working fine – so I suspect that my cheapo £2 wifi dongle is the main problem I was experiencing – it works in AP (access point) mode as long as I don’t require WPA/2 security.
Thanks for the really useful script – the whole topic continues to be a learning experience for me 🙂
Worth noting that wifi dongles are limited to the number of connections they can make in AP mode,
and some have really low limits:
e.g. TP-LINK TL-WN722N can only handle SEVEN clients
Simon is using the RTL8188CUS which can go up to 32
you say in your Readme that you have this working on a Ralink RT5370 adapter but the current file checks for an RTL8188CUS and throws up an error message if not present. What changes do I need to make to get it to work with the 5370 please.
There are many guides for hotspots that use the RT5370 so I’d just follow them – my stuff is for the harder to use 8188 – check the forums
I have tried to do this following other instructions and failed, so having seen your post and the successful comments above thought I would give it a try.
I have copied the line wget …. into a terminal as suggested, press enter and get the following error,
HTTP request sent, awaiting response… 302 Found
Location: https://raw.githubusercontent.com/cymplecy/pispot/master/install_hotspot8188CUS.sh [following]
–2014-09-30 13:34:46– https://raw.githubusercontent.com/cymplecy/pispot/master/install_hotspot8188CUS.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)… 126.96.36.199
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|188.8.131.52|:443… connected.
GnuTLS: A TLS packet with unexpected length was received.
Unable to establish SSL connection.
any ideas what the problem could be?
I am using a Dexter Industries image but with the text with the above error do not believe this is the problem. Later on this week I will try it with my wheezey image
It could have been a problem at the time with github – try this link as an alternative
That down loaded and installed with no errors, thanks for the response,