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

Re: Raspberry Pi 3 WiFI hotspot?

Thu Dec 29, 2016 12:28 pm

sandeepd9876 wrote: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

Looks like the same tutorial I followed, works great.

After doing this I would like to make my Raspberry accesspoint a VPN accesspoint so that all the Raspberry clients are connected to my IPVanish VPN server.

Any idea how to do that?

chris57100
Posts: 522
Joined: Wed Sep 12, 2012 7:23 pm
Location: Thionville
Contact: Website

Re: Raspberry Pi 3 WiFI hotspot?

Thu Jul 06, 2017 2:33 pm

For those wanting an easy way to build a wifi hotspot with a captive portal and user management, you can use a simple script called Kupiki-Hotspot-Script that will perfom all in one step : https://github.com/pihomeserver/Kupiki-Hotspot-Script

Once the script is executed, you will get :
* A Wifi hotspot using the integrated wifi chipset
* A custom captive portal based on coovachilli
* The portal is served by the high performance web server Nginx
* The design of the portal can be easily modified for anyone who has knowledge in HTML and Javascript
* An authentication process based on freeRadius
* An interface for freeRadius management
* daloRadius is installed by default, served by Nginx web server
* A full management of the hotspot, with batch for user creation, vouchers, NAS, etc.

What are the requirements ?

* A Raspberry Pi 3
* An ethernet cable
* A power supply for the Raspberry Pi
* An internet access of course
* A micro SD card with a raspbian-like OS installed (recommanded one is the official raspbian jessie lite )
Raspberry Pi Home Server : http://www.pihomeserver.fr
Software and electronic tutorials : Samba, Airplay, CUPS, Time machine, Nginx, Owncloud, rTorrent, Wordpress, etc.
Full Wi-Fi hotspot installation on a RPi 3 including a captive portal and freeradius management: https://github.com/pihomeserver/Kupiki-Hotspot-Script

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Raspberry Pi 3 WiFI hotspot?

Sun Jul 09, 2017 4:17 pm

NAT is very powerful, but sometimes you do not want/need to give your clients that much access. Actually, the easiest way to provide (only) http/https access is to run some kind of proxy software ...
I am the Umbrella man

Nicolas6316
Posts: 2
Joined: Sun Dec 10, 2017 6:37 am

Re: Raspberry Pi 3 WiFI hotspot?

Mon Feb 19, 2018 1:50 pm

hippy wrote:
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


Thanks this one works

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Raspberry Pi 3 WiFI hotspot?

Mon Feb 19, 2018 1:59 pm

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.
If this is the case, your install/setup failed.

Edit: ...unless you are using this as a captive localnet (no internet access). I presume this resolves all requests to your RPi server, except https.

Code: Select all

address=/#/172.17.2.1 
My advice applies to RaspiOS only. Please mention if you use another OS.

Return to “Networking and servers”