This repository contains two scripts for automating the setup and maintenance of Private Internet Access (PIA) WireGuard VPN on Firewalla.
This script automates the process of setting up PIA WireGuard VPN on Firewalla.
- Clones or updates the
pia-wg
repository (handles PIA authentication) - Generates a new WireGuard configuration (since PIA tokens expire regularly)
- Copies the
.conf
file to Firewalla’s WireGuard profile directories - Creates Firewalla-specific support files:
.endpoint_routes
.json
.settings
- Copy this script to Firewalla and make it executable:
chmod +x pia-firewalla.sh
- Run the script:
sudo ./pia-firewalla.sh
- Once completed, go to the Firewalla GUI and manually activate the WireGuard profile.
This script continuously monitors the WireGuard VPN connection on Firewalla and automatically restarts it if necessary.
- Monitors the WireGuard VPN connection
- Detects inactivity (no handshake for 2+ minutes)
- Checks VPN traffic (via a ping test)
- If the VPN is down for 5+ minutes, reloads the configuration
- Regenerates WireGuard configuration when the PIA token expires
- Save this script to a file (e.g.,
~/firewalla-vpn-monitor.sh
). - Make the script executable:
chmod +x ~/firewalla-vpn-monitor.sh
- Run it in the background:
nohup ~/firewalla-vpn-monitor.sh &
- (Optional) Add it to system startup using systemd (see instructions below).
For automatic startup and monitoring, you can create a systemd service:
- Create a new systemd service file:
sudo nano /etc/systemd/system/firewalla-vpn-monitor.service
- Add the following content:
[Unit] Description=Firewalla VPN Monitor After=network.target [Service] ExecStart=/path/to/firewalla-vpn-monitor.sh Restart=always User=root [Install] WantedBy=multi-user.target
- Save and exit, then enable the service:
sudo systemctl enable firewalla-vpn-monitor sudo systemctl start firewalla-vpn-monitor
Now, the monitoring script will run automatically on system startup.
This project is licensed under the MIT License.
Pull requests and improvements are welcome! If you find issues, please open an issue on GitHub.
- Private Internet Access (PIA) WireGuard Setup
- Firewalla Official Site
- Private Internet Access wireguard shell scripts github
To download this file directly from GitHub:
- Navigate to the repository on GitHub.
- Click on the
README.md
file. - Click the Raw button.
- Right-click anywhere on the page and select Save As to download the file.
Alternatively, you can clone the repository and access the file locally:
git clone <repository-url>
cd <repository-name>