Complete installation instructions for Pi VPN Hotspot. This guide covers everything from initial setup to advanced configuration.
Use Raspberry Pi Imager to flash the latest Raspberry Pi OS to your microSD card.
# Download from:
https://www.raspberrypi.com/software/
# Enable SSH during imaging:
Advanced Options → Enable SSHBoot your Pi and perform initial system updates.
$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt install git curl wget -yGet your WireGuard configuration file from your VPN provider.
Most VPN providers offer WireGuard configs in their account dashboard. Download the .conf file for your server location.
$ cd ~
$ wget https://github.com/your-repo/pi-vpn-hotspot/archive/main.tar.gz
$ tar -xzf main.tar.gz
$ cd pi-vpn-hotspot-main$ sudo apt install wireguard hostapd dnsmasq iptables-persistent -y
$ sudo systemctl stop hostapd
$ sudo systemctl stop dnsmasqThis installs WireGuard VPN, hostapd (for hotspot), dnsmasq (for DHCP), and iptables for firewall rules.
# Copy your WireGuard config
$ sudo cp /path/to/your/wg0.conf /etc/wireguard/
$ sudo chmod 600 /etc/wireguard/wg0.conf
# Test VPN connection
$ sudo wg-quick up wg0
$ curl ifconfig.me
$ sudo wg-quick down wg0# Edit hostapd configuration
$ sudo nano /etc/hostapd/hostapd.conf
# Add these settings:
interface=wlan0
driver=nl80211
ssid=YourHotspotName
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=YourSecurePassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP$ sudo nano /etc/dnsmasq.conf
# Add these lines:
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
domain=wlan
address=/gw.wlan/192.168.4.1$ sudo chmod +x install.sh
$ sudo ./install.shThe installation script will configure networking, set up the kill switch, and enable all services. Your Pi will reboot when complete.
# Check all services
$ sudo systemctl status wg-quick@wg0
$ sudo systemctl status hostapd
$ sudo systemctl status dnsmasq
# Verify VPN connection
$ sudo wg show
$ curl ifconfig.me# Disconnect VPN and test
$ sudo wg-quick down wg0
$ ping 8.8.8.8
# Should fail - kill switch working
$ sudo wg-quick up wg0
$ ping 8.8.8.8
# Should succeed - VPN activeConnect a device to your hotspot and navigate to the dashboard:
http://192.168.4.1:8080Check WireGuard configuration and firewall rules:
$ sudo wg show
$ sudo journalctl -u wg-quick@wg0Verify hostapd is running and wlan0 is configured:
$ sudo systemctl status hostapd
$ iwconfig wlan0Check IP forwarding and NAT rules:
$ cat /proc/sys/net/ipv4/ip_forward
$ sudo iptables -t nat -LYour Pi VPN Hotspot is now fully configured and operational. All traffic from connected devices will be routed through your VPN with kill switch protection.
→ Next: Read the User Guide for advanced features and SMS control setup