TeeSee64
Posts: 16
Joined: Fri Mar 07, 2014 10:01 am

Raspberry Pi 3 WiFI hotspot?

Thu Mar 03, 2016 9:07 pm

I want to create a hotspot with my new rpi 3. But I cant get the build in wifi module in the master mode (AP)

Are there any drivers available for the rpi 3 wifi module to setup an hotspot?

pipuppy
Posts: 90
Joined: Fri Aug 24, 2012 12:51 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sat Mar 05, 2016 2:46 pm

Hi TeeSee64,

I was looking for much the same information as you and to cut a l-o-n-g story short the answer appears to be "yes" you can use the new R3 in AP mode. I asked a similar question in a duplicate posting on this forum (general and networking areas) and received a very helpful pointer from DirkS as follows...

by DirkS » Sat Mar 05, 2016 2:57 pm
Yes, can be done. See view ... 70#p919980 for (partial) info...
***** end quote *****

I hope this helps. I have not had time to test this yet myself but I am optimistic it should work. The rest of the setting-up depends on your requirements.

I hope this is somewhat helpful in pointing you in the right direction.

Regards,

pipuppy

DirkS
Posts: 10347
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Raspberry Pi 3 WiFI hotspot?

Sat Mar 05, 2016 2:50 pm

Link above is broken. Correct one is viewtopic.php?t=137932&p=920070#p919980

pipuppy
Posts: 90
Joined: Fri Aug 24, 2012 12:51 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sat Mar 05, 2016 3:17 pm

Thanks again DirkS and sorry about posting the "dud" link.

pipuppy

Fletch121
Posts: 4
Joined: Thu Mar 03, 2016 7:31 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sat Mar 05, 2016 4:25 pm

Finally managed to get the bridge/hotspot up and running on the Pi3. I used the tutorial provided here https://learn.adafruit.com/setting-up-a ... t/overview and modifed the hostapd config to hash out the line including the driver to get the onboard wifi into AP mode(Info courtesy of DirkS and PiPuppy) . Im now getting my full broadband speeds through the Pi which is 30Mbps down and 4Mbps up. Hope it helps

pipuppy
Posts: 90
Joined: Fri Aug 24, 2012 12:51 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 06, 2016 2:44 pm

Hi Fletch121,

Thats great news and thanks for the link to the bridge/hotspot. I will have a look and see if I can get both a bridge and hotspot working here sometime.

Just as a footnote I can also confirm that after following the information given in the original link my R3 also worked in AP mode in my case as a stand-alone wireless server/hot-spot.

The only problem I had was that after re-booting the pi my hot-spot ceased to be fully functional. The problem was traced/fixed to the "interfaces" configuration file located in the "/etc/network" directory.

The line which reads "#allow-hotplug wlan0" was commented out by default. Removing the "#" at the start of the line corrected the problem for me and the R3 stand-alone-server now functions correctly after re-boot every time.

Regards,

pipuppy

TeeSee64
Posts: 16
Joined: Fri Mar 07, 2014 10:01 am

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 06, 2016 3:01 pm

pipuppy wrote:Hi TeeSee64,

I was looking for much the same information as you and to cut a l-o-n-g story short the answer appears to be "yes" you can use the new R3 in AP mode. I asked a similar question in a duplicate posting on this forum (general and networking areas) and received a very helpful pointer from DirkS as follows...

by DirkS » Sat Mar 05, 2016 2:57 pm
Yes, can be done. See view ... 70#p919980 for (partial) info...
***** end quote *****

I hope this helps. I have not had time to test this yet myself but I am optimistic it should work. The rest of the setting-up depends on your requirements.

I hope this is somewhat helpful in pointing you in the right direction.

Regards,

pipuppy
Got it working!!!!

Thank you so much!

TeeSee64
Posts: 16
Joined: Fri Mar 07, 2014 10:01 am

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 06, 2016 3:08 pm

But now another question...

Now that the hotspot is working perfectly, I have a apche2 webserver running on the same Raspberry. Is it possible that when someone connects to the hotspot, his browser will be showing to the index.html page?
The index.html page is hosted on the hotspot/apache2 server. This page shows some local toerists information.

The idea is to setup a hotspot for the tourists comming to my village so they have free internet but also to give them some information about my village.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 06, 2016 3:45 pm

That's usually the function of a "captive portal". It forces you to connect to a network, logon (and accept Ts&Cs) then reroutes to a selected home page. You should be able to make your RPi3 hotspot do that.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

MarcoEatsQuarko
Posts: 2
Joined: Fri Mar 04, 2016 11:37 pm

Re: Raspberry Pi 3 WiFI hotspot?

Tue Mar 08, 2016 8:41 pm

Fletch121 wrote:Finally managed to get the bridge/hotspot up and running on the Pi3. I used the tutorial provided here https://learn.adafruit.com/setting-up-a ... t/overview and modifed the hostapd config to hash out the line including the driver to get the onboard wifi into AP mode(Info courtesy of DirkS and PiPuppy) . Im now getting my full broadband speeds through the Pi which is 30Mbps down and 4Mbps up. Hope it helps
I tried without hashing out the driver line and it didn't worked now I tried with the hashtag and I can see the Apartment as available Wifi on my smartphone. I can request a IP, too but it won't create a connection.

Can you help me?

D62
Posts: 4
Joined: Sun Mar 06, 2016 9:40 am

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 13, 2016 7:02 pm

I have followed your tutorials but it only worked before rebooting the Raspberry.

Since I rebooted it, I can still see and connect on the Raspberry spot but no data will transit.

One last important point: I wanted to create this hotspot to root all my traffic behind my VPN. However, for the few minutes the hotpost worked, all the devices connected on the Raspberry had the regular IP from my ISP, while the Raspberry is perfectly displaying the IP from my VPN.

If anybody could help solve those issues I would greatly appreciate.

HightronicDesign
Posts: 22
Joined: Mon Oct 27, 2014 8:03 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sun Mar 13, 2016 10:12 pm

Seems like you have a problem in your iptables routing the traffic from one network to the other one.

Here are my routing settings which are prefectly working for my Rpi3 Wifi Router :

Code: Select all

sudo ifconfig wlan0 10.11.12.1 netmask 255.255.255.0 && sudo /etc/init.d/isc-dhcp-server restart
iptables -A FORWARD -o eth0 -i wlan0 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Good Luck

D62
Posts: 4
Joined: Sun Mar 06, 2016 9:40 am

Re: Raspberry Pi 3 WiFI hotspot?

Tue Mar 15, 2016 11:43 pm

I must confess I am a little bit lost.

My iptables are as suggested in the Adafruit tutorial:

Code: Select all

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

mmoonn
Posts: 1
Joined: Wed Apr 20, 2016 8:23 pm

Re: Raspberry Pi 3 WiFI hotspot?

Wed Apr 20, 2016 8:26 pm

MarcoEatsQuarko wrote:
Fletch121 wrote:Finally managed to get the bridge/hotspot up and running on the Pi3. I used the tutorial provided here https://learn.adafruit.com/setting-up-a ... t/overview and modifed the hostapd config to hash out the line including the driver to get the onboard wifi into AP mode(Info courtesy of DirkS and PiPuppy) . Im now getting my full broadband speeds through the Pi which is 30Mbps down and 4Mbps up. Hope it helps
I tried without hashing out the driver line and it didn't worked now I tried with the hashtag and I can see the Apartment as available Wifi on my smartphone. I can request a IP, too but it won't create a connection.

Can you help me?

i have the same problem, did you find a solution ?


KirbyJames
Posts: 2
Joined: Tue Feb 25, 2014 6:09 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sun May 29, 2016 7:49 pm

There is a complete description of how to achieve this using a Pi3 at
https://frillip.com/using-your-raspberr ... h-hostapd/

rcastley
Posts: 6
Joined: Tue May 31, 2016 9:13 pm

Re: Raspberry Pi 3 WiFI hotspot?

Tue May 31, 2016 9:14 pm

I too stumble across Phil Martin's excellent blog post but I couldn't get it working. I have documented my solution (based on Phil's) here - https://github.com/rcastley/RaspberryPi

Hope this helps others :-)

rubens
Posts: 2
Joined: Sun Jun 12, 2016 2:06 pm

Re: Raspberry Pi 3 WiFI hotspot?

Sun Jun 12, 2016 2:28 pm

Hello,
this is my first post on these forums. First of all, thank you very much for your (older) post, they are really heapfull.

I needed to set up my Raspberry Pi 3 as a hotspot. I was succesfull so I want to share with you some tips that will solve your problems if you followed this howto: https://learn.adafruit.com/setting-up-a ... l-software

I am using raspbian:

Code: Select all

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux
1st TIP:
Tutorial tells you to "Update hostapd" to "adafruit_hostapd_14128.zip".

That´s a version from 2011. Do NOT "update" to that version because, today, when you "apt-get install hostapd" you get "hostapd v2.3" (2014 version).

2nd TIP:
Tutorial tells you to edit "/etc/network/interfaces" and add "up iptables-restore < /etc/iptables.ipv4.nat" "to the very end".

If you do it literally you will not have NAT when you reboot between wlan0 and eth0, that is, you will not have internet access from your wifi hotspot.

You do not have to add that line "to the very end" but inside "wlan0" block. My raspbian come with some configuration lines for "wlan1" (no idea why), if you add the line to the very end, it will be applied to "wlan1", not "wlan0".

This config is working for me (please note where "up iptables-restore ..." is placed):

Code: Select all

pi@raspberrypi:~ $ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet static
  #address 192.168.42.1         --> CHECK 5th TIP
  #netmask 255.255.255.0      --> CHECK 5th TIP
  up iptables-restore < /etc/iptables.ipv4.nat


allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
3rd TIP AND QUESTION:
I did not follow the bonus section about "Removing WPA-Supplicant". It looks that hostapd is working good for me.

Anyone could please explain when and why it might be needed to be removed?

4rd TIP:
Tutorial tells you to set driver in "sudo nano /etc/hostapd/hostapd.conf": either "driver=rtl871xdrv" or "driver=nl80211".

As advised by Fletch121, DirkS and PiPuppy: hash out the line including the driver to get the onboard wifi into AP mode.

5th TIP:
Tutorial tells you to set static address config in "/etc/network/interfaces".

As adviced by Cancelor, you should set it up otherwise: follow this other forum post
viewtopic.php?f=66&t=140252
Last edited by rubens on Mon Jun 13, 2016 11:25 am, edited 2 times in total.

User avatar
Cancelor
Posts: 775
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: Raspberry Pi 3 WiFI hotspot?

Sun Jun 12, 2016 5:14 pm

Static addresses should now be set up as detailed here:-
viewtopic.php?f=66&t=140252

DO NOT modify the file /etc/network/interfaces it should look like this.

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

rubens
Posts: 2
Joined: Sun Jun 12, 2016 2:06 pm

Re: Raspberry Pi 3 WiFI hotspot?

Mon Jun 13, 2016 11:31 am

What about this line?
up iptables-restore < /etc/iptables.ipv4.nat
Should it be in "/etc/network/interfaces" as stated in adafruit tutorial?
Should it be in "/etc/rc.local" as stated in https://frillip.com/using-your-raspberr ... h-hostapd/ ?
I think I even read a tutorial where it was added to dhcpcd.conf...

Cancelor wrote:Static addresses should now be set up as detailed here:-
viewtopic.php?f=66&t=140252

DO NOT modify the file /etc/network/interfaces it should look like this.

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

CJ1
Posts: 50
Joined: Wed Jun 29, 2016 7:32 pm

Re: Raspberry Pi 3 WiFI hotspot?

Thu Sep 08, 2016 2:21 pm

This is CRAZY!!!!
Is there a definitive solution without going all over the place to have a working Pi3 Wifi Hotspot as of todays version of the OS????

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

Re: Raspberry Pi 3 WiFI hotspot?

Wed Oct 26, 2016 12:42 am

CJ1 wrote:This is CRAZY!!!!
Is there a definitive solution without going all over the place to have a working Pi3 Wifi Hotspot as of todays version of the OS????
+1

I am trying to do the same but it's a complete nightmare; every tutorial is different, some use one thing, some use another, they all seem to be incomplete, most are 'wrong' in some way, they may half work but not completely.

It is okay people saying 'don't do it that way, it's wrong' but often the wrong way seems to work better than the suggested right way.

If I ever get it working I will document how but I worry that it will be just another 'this works for me but not anyone else' frustration for others.

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

Re: Raspberry Pi 3 WiFI hotspot?

Wed Oct 26, 2016 11:51 am

As I said above; if I got it working I would post how I did it. Here it is.

This is just a basic example of getting a Pi3B into access point mode using the on-board WiFi. It is to help people get started and does not include everything which would make such a set-up safe to deploy for public use.

I would recommend using Raspbian on a new SD Card so you can test this then swap back to your current system once it has been tested.

My set-up is intended to create a simple captive portal with no acccess to the internet or rest of the network. It does this by using dnsmasq to tell browsers that every domain name is at the Pi's IP address. There is more work which needs to be done to make that foolproof, safe and secure, but getting the Pi3B into access point mode is mainly the hurdle we intend to overcome here.

This guide is a collation of information from other guides and postings but mostly based on work done by Andrew Smith with his Pi Honeypot project -

http://andrewmichaelsmith.com/2013/08/r ... i-honeypot

Other guides may offer more than this one does, but they often introduce complexity and things beyond what any particular user may want or need. I have taken a keep it simple approach which involves minimal effort which users can then build upon and tailor to their needs.

What is in the guide worked for me but I cannot guarantee it will work for everyone.

Prerequisites are a Pi3B which currently connects via its internal WiFi to your router, network and LAN and ideally a web server running on the Pi which can serve a page from its 127.0.0.1 localhost address.

If you do not have a web server set-up you can still proceed to get the Pi into access point mode and connect to it over WiFi, but it will not do a lot beyond that.

I edited /etc/network/interfaces to give wlan0 its required static IP address. The recommended means of doing that when using a Pi is to edit /etc/dhcpcd.conf but this works for me and I need to do that myself because I have never managed to get dhcpd to work with multiple IP address allocated to my eth0 which I require.

I would say do it this way first, get it working, and, if you don't like that way, undo the edits of /etc/network/interfaces and figure out exactly what needs to be done to /etc/dhcpcd.conf to make it work the same. Then let everyone know.

First ensure you are up to date and have the required software installed -

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install hostapd dnsmasq
Do not edit /etc/dhcpcd.conf, leave that as it is.

Edit /etc/hostapd/hostapd.conf to be -

Code: Select all

interface=wlan0
ssid=Pi3B-HotSpot
channel=6
hw_mode=g
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=blueberry
rsn_pairwise=CCMP
It seems everything after channel can be left out if you want an open access point but that is not recommended for this particular set-up.


Edit /etc/init.d/hostapd to change DAEMON_CONF= -

Code: Select all

DAEMON_CONF=/etc/hostapd/hostapd.conf
Edit the /etc/network/interfaces wlan0 configuration to -

Code: Select all

allow-hotplug wlan0  
iface wlan0 inet static  
  address 172.17.2.1
  netmask 255.255.255.0
  broadcast 255.0.0.0
The allow-hotplug line is essential


Edit /etc/dnsmasq.conf to be -

Code: Select all

address=/#/172.17.2.1
interface=wlan0
dhcp-range=172.17.2.100,172.17.2.250,12h
no-resolv
# log-facility=/var/log/dnsmasq.log
# log-queries
Uncomment the last two lines if you want to log dnsmasq activity.


Then finally -

Code: Select all

sudo update-rc.d hostapd defaults
sudo update-rc.d dnsmasq defaults
sudo reboot

Once re-booted, from a phone, tablet, wireless laptop or PC you should see "Pi3B-Hotspot" in the list of available access points. That can then be connected to using the passphrase of "blueberry", without the quotes, and note it is not "raspberry".

It should then authenticate and get a private IP Address on the 172.17.2.x network. The RPi is the server-host on 172.17.2.1

Opening a browser and entering any domain name, for example, wwww.xyzzy.net, should then bring up the web page which the Pi's local web server delivers.

Once things are working it would be recommended to change the ssid and wpa_passphrase settings in /etc/hostapd/hostapd.conf

Note that this is not a set-up which is safe for public deployment. It would be recommended not to use it as such without making it safe and secure. Doing that is beyond the scope of this short guide; this is just to help get over the first hurdle.

If others want to build on this guide then please feel free to do so.

Rutger
Posts: 4
Joined: Tue Dec 27, 2016 7:20 pm

Re: Raspberry Pi 3 WiFI hotspot?

Wed Dec 28, 2016 11:41 am

I have the Raspberry Pi 3 working as an hotspot by following this link https://learn.adafruit.com/setting-up-a ... t/overview

Next thing I want to do is adding VPN so that all the pc's connected to the hotspot are using a VPN connection.

Does anybody have a idea how to do this?

sandeepd9876
Posts: 3
Joined: Fri Dec 23, 2016 5:43 am

Re: Raspberry Pi 3 WiFI hotspot?

Thu Dec 29, 2016 8:43 am

I have followed a txt manual found in one of the posts. Just follow the manual and after reboot you are done RPi 3 works as a hotspot which has internet access. Its working. This uses hostapd and isc-dhcp-server. :)

1. install OS, setup basic configurations, update

2. install DHCP
CMD: sudo apt-get install hostapd isc-dhcp-server

3. configure DHCP
CMD: sudo nano /etc/dhcp/dhcpd.conf

*place a # in front of the two option domain-name entries and remove the # in front of authoritive

*at the end of the file enter the below

subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.10 192.168.42.50;
option broadcast-address 192.168.42.255;
option routers 192.168.42.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8,8.8.4.4;
}

*save and exit

4. edit server to work with wireless
CMD: sudo nano /etc/default/isc-dhcp-server

*find INTERFACES and change to:
INTERFACES="wlan0"

*save and exit

5. setup static ip for wireless
CMD: sudo nano /etc/network/interfaces

*edit code after allow-hotplug wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0

*put # in front of wpa roam after "iface wlan0 inet manual"

**you can also put a # in front of allow-hotplug wlan1 and lines associated to wlan1

*save and exit

6. set IP address for wlan0
CMD: sudo ifconfig wlan0 192.168.42.1

7. create WLAN
CMD: sudo nano /etc/hostapd/hostapd.conf

*enter code below

interface=wlan0
driver=nl80211
ssid="your ssid"
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase="your password"
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

*save and exit

8. point hostapd to new file
CMD: sudo nano /etc/default/hostapd

*find line #DAEMON_CONF="" and edit as such and remove the #

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

*save ane exit

9. setup nat for multiple users
CMD: sudo nano /etc/sysctl.conf

*add to bottom of file

net.ipv4.ip_forward=1

*save and exit, then run by entering below

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

10. nat between eth0 and wlan0
CMD: sudo iptables –t nat –A POSTROUTING –o eth0 –j MASQUERADE
CMD: sudo iptables –A FORWARD –i eth0 –o wlan0 –m state --state RELATED,ESTABLISHED –j ACCEPT
CMD: sudo iptables –A FORWARD -i wlan0 –o eth0 –j ACCEPT

*now to have them applied every reboot
CMD: sudo sh –c “iptables-save > /etc/iptables.ipv4.nat”

11. now go back to interfaces and add to the end of the file
CMD: sudo nano /etc/network/interfaces

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

*save and exit

12. setup daemon to run at boot

CMD: sudo service hostapd start
CMD: sudo service isc-dhcp-server start
CMD: sudo update-rc.d hostapd enable
CMD: sudo update-rc.d isc-dhcp-server enable

13. reboot and your done

Return to “Networking and servers”