0

I just want to use my Pi as hotspot. What's the easiest* way to get there?

What I have:

What I have tried that didn't work:

Until the upgrade to Jessie, I used the script provided by Raspberry-at-home at the bottom of the article ant it worked really well. Now nothing works again, sadly.

*definition of "easy": Any method that brings up a solution in a reasonable amount of time (<5h) with little to no additional Google problem solving.

  • Have you tried this method provided on eLinux? It looks like it would work and seems "easy" to setup. – Ricardo Mar 6 '17 at 22:56
  • This question is more or less, "I've tried everything and none of it worked, what do I do?", to which the only logical answer is, "Give up." It makes more sense, problem solving wise, to get into the details of how something specific you tried did not work so you can resolve the problem. By analogy, if your car does not start tomorrow, do you buy a new car -- and then if it does not start the next day, buy another new car, ad infinitum? Or do you try and figure out why the car won't start and what can be done to fix it? – goldilocks May 3 '17 at 12:07
  • @goldilocks This is basically it. I already did everything to try to solve the problem and this was my last hope. To keep the analogy, if you spent more time trying to repair your car than it is worth, you start looking for different solutions instead of trying to fix every little problem that comes up. I also maybe formulated the question the wrong way: I am not really looking for an easy method, but for one that can be reproduced. – piegames May 3 '17 at 12:58
  • "if you spent more time trying to repair your car than it is worth, you start looking for different solutions" -> Definitely. In this case, the smart solution would be to buy a completely different device, namely a consumer ready hotspot of some sort (these are not pricer than an rpi, either). Beware of "have my pi and eat it too" ;) -- "I want to use the DIY device but I don't want to do it myself because I do not have the time and/or skills". Extending the car analogy, there is a limit to what you can fix by asking people how online. Not everybody wants or needs to be a mechanic. – goldilocks May 3 '17 at 13:22
  • For those who still have problems with a hotspot, thepi.io/… works for me (using Raspbian Stretch and the official Raspberry Pi wifi adapter) – piegames Dec 28 '17 at 17:43
3

I didn't want to leave this unanswered, so I found an old Pi B+ and an AP-Compatible WiFi dongle, and after trying a few times, finally found a way for this to work.

Please try the following steps:

BTW, I typed full commands below so you can open this page on your Pi's browser (starting on step 2) and copy and paste on the Terminal

  1. Download and run PiBakery, enter your WiFi SSID and Password, and Write your SD Card.

  2. Start up your Pi, open this page on browser, open Terminal, and type or copy and paste:

    sudo apt-get install hostapd udhcpd  
    sudo ifconfig wlan0 192.168.42.1  
    

Then edit this conf file:

sudo nano /etc/udhcpd.conf  

So that it has the following:

start 192.168.42.2  
end 192.168.42.20  
interface wlan0  
remaining yes  
opt dns 8.8.8.8 4.2.2.2  
opt subnet 255.255.255.0  
opt router 192.168.42.1  
opt lease 864000  

Then edit this file:

sudo nano /etc/default/udhcpd  

Comment the following line:

#DHCPD_ENABLED="no"  

Then edit this file:

sudo nano /etc/network/interfaces

Comment the following lines:

#allow-hotplug wlan0
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Then create this conf file:

sudo nano /etc/hostapd/hostapd.conf

Copy and Paste the following:

interface=wlan0
driver=nl80211
ssid=PiAccess
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=PiPassword
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

Then edit this file:

sudo nano /etc/default/hostapd

Uncomment and add conf file location:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Then enable IP Forwarding:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

Then edit this file:

sudo nano /etc/sysctl.conf

Uncomment this line:

net.ipv4.ip_forward=1

Then enable NAT:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

Then edit this file one last time:

sudo nano /etc/network/interfaces

And add the following line to the bottom of the file:

up iptables-restore < /etc/iptables.ipv4.nat

Finally for the hotspot to start when the Pi boots:

sudo update-rc.d hostapd enable
sudo update-rc.d udhcpd enable

sudo reboot

Restart your Pi and once running, you should see from another computer the new WiFi network called "PiAccess".

| improve this answer | |
  • Thanks for that detailed answer and for mentioning PiBakery, but it did sadly not work on Jessy, Wheezy and the image provided by PiBakery. Should I adapt the line "driver=nl80211" corresponding to my hardware? – piegames Mar 20 '17 at 15:08
  • Easiest might be to get a new WiFi dongle; but you could try a special version of hostapd like this one. – Ricardo Mar 20 '17 at 20:03
  • I'll try that out later. The thing is, the dongle works well under Wheezy and supports everything it needs to so it really should work. – piegames Mar 20 '17 at 20:11
  • I retried it using the official wifi dongle. The hotspot works, but does not share internet now. – piegames May 21 '17 at 10:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.