A simple solution to create a Wi-Fi hotspot on Raspberry Pi that routes all traffic through a Tailscale exit node, providing secure internet access for connected devices.
This project allows you to:
- Create a Wi-Fi access point on your Raspberry Pi
- Route all hotspot traffic through a Tailscale exit node
- Provide secure internet access to devices that don't support Tailscale natively
- Bypass network restrictions by using your own exit node
- Raspberry Pi with Wi-Fi capability (Pi 3, Pi 4, or Pi Zero W/2W)
- Raspberry Pi OS with NetworkManager (recommended)
- Tailscale account and at least one exit node configured
-
Install Tailscale (if not already installed):
curl -fsSL https://tailscale.com/install.sh | shfollow instructions to sign in
-
Clone this repository:
git clone <repository-url> cd tailscale-hotspot
-
Configure environment variables:
cp .env.example .env nano .env
-
Run the setup script:
sudo ./setup_hotspot.sh
All configuration is done through the .env file. The .env.example file contains detailed explanations of every configuration option.
Set your key values:
EXIT_NODE: Your Tailscale exit node hostname (find withtailscale status)SSID: Your Wi-Fi network namePASS: Your Wi-Fi passwordREG_DOMAIN: Your country code (US, GB, DE, etc.)
The .env.example file includes comprehensive documentation for all options, troubleshooting tips, and security considerations.
Run the setup script to configure everything:
sudo ./setup_hotspot.shThis script will:
- Check system requirements
- Configure IPv4 forwarding
- Set up NetworkManager
- Create the Wi-Fi hotspot configuration
- Configure Tailscale with your exit node
- Set up routing and NAT rules
- Start the hotspot
After initial setup, use the start script:
sudo ./start_hotspot.shTo stop the hotspot:
sudo nmcli connection down HotspotVerify hotspot is running:
nmcli connection show --active | grep HotspotCheck connected clients:
iw dev wlan0 station dumpVerify Tailscale exit node:
tailscale status
curl -4 ifconfig.meTest from a connected device:
- Connect to your Wi-Fi hotspot
- Visit https://ifconfig.me
- The IP should match your exit node's public IP
1. "AP mode not supported" error
- Some Wi-Fi adapters don't support Access Point mode
- Try a different USB Wi-Fi adapter
- Check with:
iw list | grep -A 8 "Supported interface modes"
2. Hotspot starts but no internet
- Verify Tailscale is connected:
tailscale status - Check if exit node is online in Tailscale admin console
- Ensure exit node allows subnet routing
3. Can't connect to hotspot
- Check if channel is supported:
iw phy phy0 info - Try changing channel in
.envfile - Verify regulatory domain is correct
4. Conflicts with existing network
- Change
SUBNET_CIDRto avoid IP conflicts - Common alternatives:
192.168.50.1/24,172.16.1.1/24
Check NetworkManager status:
systemctl status NetworkManager
nmcli general statusCheck iptables rules:
sudo iptables -L -n
sudo iptables -t nat -L -nMonitor logs:
journalctl -f -u NetworkManager- Wi-Fi Hotspot: Creates an access point using NetworkManager
- DHCP: NetworkManager provides IP addresses to connected devices
- Routing: iptables rules forward traffic from Wi-Fi to Tailscale
- NAT: MASQUERADE rule translates client IPs for Tailscale
- Exit Node: Tailscale routes all traffic through your specified exit node
Client Device → Wi-Fi Hotspot → Raspberry Pi → Tailscale → Exit Node → Internet
(wlan0) (routing) (tailscale0) (your server)
- Change default SSID and password
- Use strong WPA2 passwords (consider WPA3 if supported)
- Regularly update your Raspberry Pi and Tailscale
- Monitor connected devices
- Consider MAC address filtering for additional security
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
If you encounter issues:
- Check the troubleshooting section above
- Search existing GitHub issues
- Create a new issue with:
- Your Raspberry Pi model
- Operating system version
- Complete error messages
- Output of
tailscale status
- Tailscale for their mesh VPN solution
- The Raspberry Pi community for hardware and OS support
- NetworkManager developers for reliable network management