PiFi Hotel Hotspot based on Raspberry Pi
When complete, connect to:
- SSID: pifi
- Password: set in
etc/hostapd/hostapd.conf
, modify before setting up
For this project the following hardware is required:
- Raspberry Pi 3
- External WiFi USB dongle (such as Edimax EW-7811Un 150Mbps 11n Wi-Fi USB Adapter)
- Travel Keyboard (such as FAVI FE01 2.4GHz Wireless USB Mini Keyboard w Mouse Touchpad)
- HDMI Cable
- Micro USB for power
- SD Card for Operation System
- Power button (optional)
Here is an Amazon Wishlist with all all the hardware you would require: https://amzn.com/w/CWSDWEDT9PY0
Install the latest Raspbian Jessie, available from https://www.raspberrypi.org/downloads/raspbian/.
Prepare the SD Card for the OS following the installation instructions on the download page. Run all updates.
The software installed will turn the internal WiFi, wlan0, into an internal network. All external interfaces will be used to access the internet. Optionally, it can be configured to use an OpenVPN connection for all traffic.
- hostapd
- dnsmasq
- openvpn (optional)
$ sudo apt-get install hostapd dnsmasq openvpn
Copy or symlink all the files under etc
in their respective directories.
Now enable the services to start on boot
$ sudo update-rc.d hostapd enable
$ sudo update-rc.d dnsmasq enable
Optional, setup OpenVPN
$ sudo update-rd.d openvpn enable
OpenVPN in the current setup is configured to connect to a ProXPN premium account. It is recommended to create a local branch and modify etc/openvpn/client.conf
appropriate to your VPN connection. etc/openvpn/auth.txt
will also need to be updated with the correct credentials.
The iptables rules in etc/iptables.ipv4.nat
are configured to send all traffic through tun0
, the virtual connection created when OpenVPN is connected. If OpenVPN is not configured, edit etc/iptables.ipv4.nat
and change tun0
to eth0
or wlan1
, depending on whichever interface is connected to the internet.
There are now iptables rules for passing all traffic through tun0
, eth0
or wlan1
. Simply modify etc/rc.local
and comment out the default iptables-restore
rule and uncomment the appropriate one. The default is pass all traffic through tun0
.
- When in a hotel, connect the Raspberry Pi to the TV.
- Open the default browser and click through the hotel's paywall for WiFi.
- (Optional) If OpenVPN is configured, the service will have to be restarted after a connection has been made
$ sudo service openvpn restart
Do you feel like trying to add a physical power button to turn the pifi on and off. There are scripts now in the repository. There is a script that will listen for shutdown on the GPIO pins 5 and 6. Also included is a systemd startup script to listen to the short on the GPIO. When enabled, it will start listening at startup, cleanly shutdown and restart if it should crash.
I'll leave it up to you for how to solder in the power button.
Check out this article for some help.
- VNC Server - this is to configure the Hotel's paywall without having to connect the Raspberry Pi to the TV first, just open a VNC Connection from a laptop and configure the Hotel's wifi.
- Ad Blocking - configure dnsmasq to block all ad networks