File: README.md
Algo VPN
Algo VPN is a set of Ansible scripts that simplify the setup of a personal WireGuard and IPsec VPN. It uses the most secure defaults available and works with common cloud providers.
See our release announcement for more information.
Features
- Supports only IKEv2 with strong crypto (AES-GCM, SHA2, and P-256) for iOS, MacOS, and Linux
- Supports WireGuard for all of the above, in addition to Android and Windows 11
- Generates .conf files and QR codes for iOS, macOS, Android, and Windows WireGuard clients
- Generates Apple profiles to auto-configure iOS and macOS devices for IPsec - no client software required
- Includes helper scripts to add, remove, and manage users
- Blocks ads with a local DNS resolver (optional)
- Sets up limited SSH users for tunneling traffic (optional)
- Privacy-focused with minimal logging, automatic log rotation, and configurable privacy enhancements
- Based on Ubuntu 22.04 LTS with automatic security updates
- Installs to DigitalOcean, Amazon Lightsail, Amazon EC2, Vultr, Microsoft Azure, Google Compute Engine, Scaleway, OpenStack, CloudStack, Hetzner Cloud, Linode, or your own Ubuntu server (for advanced users)
Anti-features
- Does not support legacy cipher suites or protocols like L2TP, IKEv1, or RSA
- Does not install Tor, OpenVPN, or other risky servers
- Does not depend on the security of TLS
- Does not claim to provide anonymity or censorship avoidance
- Does not claim to protect you from the FSB, MSS, DGSE, or FSM
Deploy the Algo Server
The easiest way to get an Algo server running is to run it on your local system or from Google Cloud Shell and let it set up a new virtual machine in the cloud for you.
Setup an account on a cloud hosting provider. Algo supports DigitalOcean (most user friendly), Amazon Lightsail, Amazon EC2, Vultr, Microsoft Azure, Google Compute Engine, Scaleway, DreamCompute, Linode, other OpenStack-based cloud hosting, CloudStack-based cloud hosting, or Hetzner Cloud.
Get a copy of Algo. The Algo scripts will be run from your local system. There are two ways to get a copy:
Download the ZIP file. Unzip the file to create a directory named
algo-mastercontaining the Algo scripts.Use
git cloneto create a directory namedalgocontaining the Algo scripts:bashgit clone https://github.com/trailofbits/algo.git
Set your configuration options. Open
config.cfgin your favorite text editor. Specify the users you want to create in theuserslist. Create a unique user for each device you plan to connect to your VPN. You should also review the other options before deployment, as changing your mind about them later may require you to deploy a brand new server.Start the deployment. Return to your terminal. In the Algo directory, run the appropriate script for your platform:
macOS/Linux:
bash./algoWindows:
powershell.\algo.ps1The first time you run the script, it will automatically install the required Python environment (Python 3.11+). On subsequent runs, it starts immediately and works on all platforms (macOS, Linux, Windows via WSL). The Windows PowerShell script automatically uses WSL when needed, since Ansible requires a Unix-like environment. There are several optional features available, none of which are required for a fully functional VPN server. These optional features are described in the deployment documentation.
That's it! You can now set up clients to connect to your VPN. Proceed to Configure the VPN Clients below.
"# Congratulations! #"
"# Your Algo server is running. #"
"# Config files and certificates are in the ./configs/ directory. #"
"# Go to https://whoer.net/ after connecting #"
"# and ensure that all your traffic passes through the VPN. #"
"# Local DNS resolver 172.16.0.1 #"
"# The p12 and SSH keys password for new users is XXXXXXXX #"
"# The CA key password is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #"
"# Shell access: ssh -F configs/<server_ip>/ssh_config <hostname> #"Configure the VPN Clients
Certificates and configuration files that users will need are placed in the configs directory. Make sure to secure these files since many contain private keys. All files are saved under a subdirectory named with the IP address of your new Algo VPN server.
Important for IPsec users: If you want to add or delete users later, you must select yes at the Do you want to retain the keys (PKI)? prompt during the server deployment. This preserves the certificate authority needed for user management.
Apple
WireGuard is used to provide VPN services on Apple devices. Algo generates a WireGuard configuration file, wireguard/.conf, and a QR code, wireguard/.png, for each user defined in config.cfg.
On iOS, install the WireGuard app from the iOS App Store. Then, use the WireGuard app to scan the QR code or AirDrop the configuration file to the device.
On macOS, install the WireGuard app from the Mac App Store. WireGuard will appear in the menu bar once you run the app. Click on the WireGuard icon, choose Import tunnel(s) from file..., then select the appropriate WireGuard configuration file.
On either iOS or macOS, you can enable "Connect on Demand" and/or exclude certain trusted Wi-Fi networks (such as your home or work) by editing the tunnel configuration in the WireGuard app. (Algo can't do this automatically for you.)
If you prefer to use the built-in IPsec VPN on Apple devices, or need "Connect on Demand" or excluded Wi-Fi networks automatically configured, see the Apple IPsec client setup guide for detailed configuration instructions.
Android
WireGuard is used to provide VPN services on Android. Install the WireGuard VPN Client. Import the corresponding wireguard/<name>.conf file to your device, then set up a new connection with it. See the Android setup guide for detailed installation and configuration instructions.
Windows
WireGuard is used to provide VPN services on Windows. Algo generates a WireGuard configuration file, wireguard/.conf, for each user defined in config.cfg.
Install the WireGuard VPN Client. Import the generated wireguard/.conf file to your device, then set up a new connection with it. See the Windows setup instructions for more detailed walkthrough and troubleshooting.
Linux
Linux clients can use either WireGuard or IPsec:
WireGuard: WireGuard works great with Linux clients. See the Linux WireGuard setup guide for step-by-step instructions on configuring WireGuard on Ubuntu and other distributions.
IPsec: For strongSwan IPsec clients (including OpenWrt, Ubuntu Server, and other distributions), see the Linux IPsec setup guide for detailed configuration instructions.
OpenWrt
For OpenWrt routers using WireGuard, see the OpenWrt WireGuard setup guide for router-specific configuration instructions.
Other Devices
For devices not covered above or manual configuration, you'll need specific certificate and configuration files. The files you need depend on your device platform and VPN protocol (WireGuard or IPsec).
- ipsec/manual/cacert.pem: CA Certificate
- ipsec/manual/.p12: User Certificate and Private Key (in PKCS#12 format)
- ipsec/manual/.conf: strongSwan client configuration
- ipsec/manual/.secrets: strongSwan client configuration
- ipsec/apple/.mobileconfig: Apple Profile
- wireguard/.conf: WireGuard configuration profile
- wireguard/.png: WireGuard configuration QR code
Setup an SSH Tunnel
If you turned on the optional SSH tunneling role, local user accounts will be created for each user in config.cfg, and SSH authorized_key files for them will be in the configs directory (user.pem). SSH user accounts do not have shell access, cannot authenticate with a password, and only have limited tunneling options (e.g., ssh -N is required). This ensures that SSH users have the least access required to set up a tunnel and can perform no other actions on the Algo server.
Use the example command below to start an SSH tunnel by replacing and with your own. Once the tunnel is set up, you can configure a browser or other application to use 127.0.0.1:1080 as a SOCKS proxy to route traffic through the Algo server:
ssh -D 127.0.0.1:1080 -f -q -C -N @algo -i configs//ssh-tunnel/.pem -F configs//ssh_configSSH into Algo Server
Your Algo server is configured for key-only SSH access for administrative purposes. Open the Terminal app, cd into the algo-master directory where you originally downloaded Algo, and then use the command listed on the success message:
ssh -F configs//ssh_config <hostname>where `` is the IP address of your Algo server. If you find yourself regularly logging into the server, it will be useful to load your Algo SSH key automatically. Add the following snippet to the bottom of ~/.bash_profile to add it to your shell environment permanently:
ssh-add ~/.ssh/algo > /dev/null 2>&1Alternatively, you can choose to include the generated configuration for any Algo servers created into your SSH config. Edit the file ~/.ssh/config to include this directive at the top:
Include <algodirectory>/configs/*/ssh_configwhere <algodirectory> is the directory where you cloned Algo.
Adding or Removing Users
Algo makes it easy to add or remove users from your VPN server after initial deployment.
For IPsec users: You must have selected yes at the Do you want to retain the keys (PKI)? prompt during the initial server deployment. This preserves the certificate authority needed for user management. You should also save the p12 and CA key passwords shown during deployment, as they're only displayed once.
To add or remove users, first edit the users list in your config.cfg file. Add new usernames or remove existing ones as needed. Then navigate to the algo directory in your terminal and run:
macOS/Linux:
./algo update-usersWindows:
.\algo.ps1 update-usersAfter the process completes, new configuration files will be generated in the configs directory for any new users. The Algo VPN server will be updated to contain only the users listed in the config.cfg file. Removed users will no longer be able to connect, and new users will have fresh certificates and configuration files ready for use.
Privacy and Logging
Algo takes a pragmatic approach to privacy. By default, we minimize logging while maintaining enough information for security and troubleshooting.
What IS logged by default:
- System security events (failed SSH attempts, firewall blocks, system updates)
- Kernel messages and boot diagnostics (with reduced verbosity)
- WireGuard client state (visible via
sudo wg- shows last endpoint and handshake time) - Basic service status (service starts/stops/errors)
- All logs automatically rotate and delete after 7 days
Privacy is controlled by two main settings in config.cfg:
strongswan_log_level: -1- Controls StrongSwan connection logging (-1 = disabled, 2 = debug)privacy_enhancements_enabled: true- Master switch for log rotation, history clearing, log filtering, and cleanup
To enable full debugging when troubleshooting, set both strongswan_log_level: 2 and privacy_enhancements_enabled: false. This will capture detailed connection logs and disable all privacy features. Remember to revert these changes after debugging.
After deployment, verify your privacy settings:
ssh -F configs/<server_ip>/ssh_config <hostname>
sudo /usr/local/bin/privacy-monitor.shPerfect privacy is impossible with any VPN solution. Your cloud provider sees and logs network traffic metadata regardless of your server configuration. And of course, your ISP knows you're connecting to a VPN server, even if they can't see what you're doing through it.
For the highest level of privacy, treat your Algo servers as disposable. Spin up a new instance when you need it, use it for your specific purpose, then destroy it completely. The ephemeral nature of cloud infrastructure can be a privacy feature if you use it intentionally.
Additional Documentation
- FAQ
- Troubleshooting
- How Algo uses Firewalls
Setup Instructions for Specific Cloud Providers
- Configure Amazon EC2
- Configure Azure
- Configure DigitalOcean
- Configure Google Cloud Platform
- Configure Vultr
- Configure CloudStack
- Configure Hetzner Cloud
Install and Deploy from Common Platforms
- Deploy from macOS
- Deploy from Windows
- Deploy from Google Cloud Shell
- Deploy from a Docker container
Setup VPN Clients to Connect to the Server
- Setup Windows clients
- Setup Android clients
- Setup Linux clients with Ansible
- Setup Ubuntu clients to use WireGuard
- Setup Linux clients to use IPsec
- Setup Apple devices to use IPsec
- Setup Macs running macOS 10.13 or older to use WireGuard
Advanced Deployment
- Deploy to your own Ubuntu server, and road warrior setup
- Deploy from Ansible non-interactively
- Deploy onto a cloud server at time of creation with shell script or cloud-init
- Deploy to an unsupported cloud provider
If you've read all the documentation and have further questions, create a new discussion.
Endorsements
I've been ranting about the sorry state of VPN svcs for so long, probably about
time to give a proper talk on the subject. TL;DR: use Algo.
-- Kenn White
Before picking a VPN provider/app, make sure you do some research
https://research.csiro.au/ng/wp-content/uploads/sites/106/2016/08/paper-1.pdf ... โ or consider Algo
-- The Register
Algo is really easy and secure.
-- the grugq
I played around with Algo VPN, a set of scripts that let you set up a VPN in the cloud in very little time, even if you donโt know much about development. Iโve got to say that I was quite impressed with Trail of Bitsโ approach.
-- Romain Dillet for TechCrunch
If youโre uncomfortable shelling out the cash to an anonymous, random VPN provider, this is the best solution.
-- Thorin Klosowski for Lifehacker
Contributing
See our Development Guide for information on:
- Setting up your development environment
- Using prek hooks for code quality
- Running tests and linters
- Contributing code via pull requests
Support Algo VPN
All donations support continued development. Thanks!
- We accept donations via PayPal and Patreon.
- Use our referral code when you sign up to Digital Ocean for a $10 credit.
- We also accept and appreciate contributions of new code and bugfixes via Github Pull Requests.
Algo is licensed and distributed under the AGPLv3. If you want to distribute a closed-source modification or service based on Algo, then please consider purchasing an exception . As with the methods above, this will help support continued development.
File: docs/aws-credentials.md
AWS Credential Configuration
Algo supports multiple methods for providing AWS credentials, following standard AWS practices:
Methods (in order of precedence)
Command-line variables (highest priority)
bash./algo -e "aws_access_key=YOUR_KEY aws_secret_key=YOUR_SECRET"Environment variables
bashexport AWS_ACCESS_KEY_ID=YOUR_KEY export AWS_SECRET_ACCESS_KEY=YOUR_SECRET export AWS_SESSION_TOKEN=YOUR_TOKEN # Optional, for temporary credentials ./algoAWS credentials file (lowest priority)
- Default location:
~/.aws/credentials - Custom location: Set
AWS_SHARED_CREDENTIALS_FILEenvironment variable - Profile selection: Set
AWS_PROFILEenvironment variable (defaults to "default")
- Default location:
Using AWS Credentials File
After running aws configure or manually creating ~/.aws/credentials:
[default]
aws_access_key_id = YOUR_KEY_ID
aws_secret_access_key = YOUR_SECRET_KEY
[work]
aws_access_key_id = WORK_KEY_ID
aws_secret_access_key = WORK_SECRET_KEY
aws_session_token = TEMPORARY_TOKEN # OptionalTo use a specific profile:
AWS_PROFILE=work ./algoSecurity Considerations
- Credentials files should have restricted permissions (600)
- Consider using AWS IAM roles or temporary credentials when possible
- Tools like aws-vault can provide additional security by storing credentials encrypted
Troubleshooting
If Algo isn't finding your credentials:
- Check file permissions:
ls -la ~/.aws/credentials - Verify the profile name matches:
AWS_PROFILE=your-profile - Test with AWS CLI:
aws sts get-caller-identity
If credentials are found but authentication fails:
- Ensure your IAM user has the required permissions (see EC2 deployment guide)
- Check if you need session tokens for temporary credentials
File: docs/client-android.md
Android client setup
Installation via profiles
- Install the WireGuard VPN Client.
- Open QR code
configs//wireguard/.pngand scan it in the WireGuard app
File: docs/client-apple-ipsec.md
Using the built-in IPSEC VPN on Apple Devices
Configure IPsec
Find the corresponding mobileconfig (Apple Profile) for each user and send it to them over AirDrop or other secure means. Apple Configuration Profiles are all-in-one configuration files for iOS and macOS devices. On macOS, double-clicking a profile to install it will fully configure the VPN. On iOS, users are prompted to install the profile as soon as the AirDrop is accepted.
Enable the VPN
On iOS, connect to the VPN by opening Settings and clicking the toggle next to "VPN" near the top of the list. If using WireGuard, you can also enable the VPN from the WireGuard app. On macOS, connect to the VPN by opening System Settings -> Network (or VPN on macOS Sequoia 15.0+), finding the Algo VPN in the left column, and clicking "Connect." Check "Show VPN status in menu bar" to easily connect and disconnect from the menu bar.
Managing "Connect On Demand"
If you enable "Connect On Demand", the VPN will connect automatically whenever it is able. Most Apple users will want to enable "Connect On Demand", but if you do then simply disabling the VPN will not cause it to stay disabled; it will just "Connect On Demand" again. To disable the VPN you'll need to disable "Connect On Demand".
On iOS, you can turn off "Connect On Demand" in Settings by clicking the (i) next to the entry for your Algo VPN and toggling off "Connect On Demand." On macOS, you can turn off "Connect On Demand" by opening System Settings -> Network (or VPN on macOS Sequoia 15.0+), finding the Algo VPN in the left column, unchecking the box for "Connect on demand", and clicking Apply.
File: docs/client-linux.md
Linux client setup
Provision client config
After you deploy a server, you can use an included Ansible script to provision Linux clients too! Debian, Ubuntu, CentOS, and Fedora are supported. The playbook is deploy_client.yml.
Required variables
client_ip- The IP address of your client machine (You can uselocalhostin order to deploy locally)vpn_user- The username. (Ensure that you have valid certificates and keys in theconfigs/SERVER_ip/pki/directory)ssh_user- The username that we need to use in order to connect to the client machine via SSH (ignore if you are deploying locally)server_ip- The vpn server ip address
Example
ansible-playbook deploy_client.yml -e 'client_ip=client.com vpn_user=jack server_ip=vpn-server.com ssh_user=root'Additional options
If the user requires sudo password use the following argument: --ask-become-pass.
OS Specific instructions
Some Linux clients may require more specific and details instructions to configure a connection to the deployed Algo VPN, these are documented here.
Fedora Workstation
(Gnome) Network Manager install
First, install the required plugins.
dnf install NetworkManager-strongswan NetworkManager-strongswan-gnome(Gnome) Network Manager configuration
In this example we'll assume the IP of our Algo VPN server is 1.2.3.4 and the user we created is user-name.
- Go to Settings > Network
- Add a new Network (
+bottom left of the window) - Select IPsec/IKEv2 (strongswan)
- Fill out the options:
- Name: your choice, e.g.: ikev2-1.2.3.4
- Gateway:
- Address: IP of the Algo VPN server, e.g:
1.2.3.4 - Certificate:
cacert.pemfound at/path/to/algo/configs/1.2.3.4/ipsec/.pki/cacert.pem
- Address: IP of the Algo VPN server, e.g:
- Client:
- Authentication: Certificate/Private key
- Certificate:
user-name.crtfound at/path/to/algo/configs/1.2.3.4/ipsec/.pki/certs/user-name.crt - Private key:
user-name.keyfound at/path/to/algo/configs/1.2.3.4/ipsec/.pki/private/user-name.key
- Options:
- Check Request an inner IP address, connection will fail without this option
- Optionally check Enforce UDP encapsulation
- Optionally check Use IP compression
- For the later 2 options, hover to option in the settings to see a description
- Cipher proposal:
- Check Enable custom proposals
- IKE:
aes256gcm16-prfsha512-ecp384 - ESP:
aes256gcm16-ecp384
- Apply and turn the connection on, you should now be connected
File: docs/client-linux-ipsec.md
Linux strongSwan IPsec Clients (e.g., OpenWRT, Ubuntu Server, etc.)
Install strongSwan, then copy the included ipsec_user.conf, ipsec_user.secrets, user.crt (user certificate), and user.key (private key) files to your client device. These will require customization based on your exact use case. These files were originally generated with a point-to-point OpenWRT-based VPN in mind.
Ubuntu Server example
sudo apt install strongswan libstrongswan-standard-plugins: install strongSwan/etc/ipsec.d/certs: copy<name>.crtfromalgo-master/configs/<server_ip>/ipsec/.pki/certs/<name>.crt/etc/ipsec.d/private: copy<name>.keyfromalgo-master/configs/<server_ip>/ipsec/.pki/private/<name>.key/etc/ipsec.d/cacerts: copycacert.pemfromalgo-master/configs/<server_ip>/ipsec/manual/cacert.pem/etc/ipsec.secrets: add youruser.keyto the list, e.g.<server_ip> : ECDSA <name>.key/etc/ipsec.conf: add the connection fromipsec_user.confand ensureleftcertmatches the<name>.crtfilenamesudo ipsec restart: pick up config changessudo ipsec up <conn-name>: start the ipsec tunnelsudo ipsec down <conn-name>: shutdown the ipsec tunnel
One common use case is to let your server access your local LAN without going through the VPN. Set up a passthrough connection by adding the following to /etc/ipsec.conf:
conn lan-passthrough
leftsubnet=192.168.1.1/24 # Replace with your LAN subnet
rightsubnet=192.168.1.1/24 # Replace with your LAN subnet
authby=never # No authentication necessary
type=pass # passthrough
auto=route # no need to ipsec up lan-passthroughTo configure the connection to come up at boot time replace auto=add with auto=start.
Notes on SELinux
If you use a system with SELinux enabled, you might need to set appropriate file contexts:
semanage fcontext -a -t ipsec_key_file_t "$(pwd)(/.*)?"
restorecon -R -v $(pwd)See this comment.
File: docs/client-linux-wireguard.md
Using Ubuntu as a Client with WireGuard
Install WireGuard
To connect to your AlgoVPN using WireGuard from Ubuntu, make sure your system is up-to-date then install WireGuard:
# Update your system:
sudo apt update && sudo apt upgrade
# If the file /var/run/reboot-required exists then reboot:
[ -e /var/run/reboot-required ] && sudo reboot
# Install WireGuard:
sudo apt install wireguard
# Note: openresolv is no longer needed on Ubuntu 22.04 LTS+For installation on other Linux distributions, see the Installation page on the WireGuard site.
Locate the Config File
The Algo-generated config files for WireGuard are named configs//wireguard/.conf on the system where you ran ./algo. One file was generated for each of the users you added to config.cfg. Each WireGuard client you connect to your AlgoVPN must use a different config file. Choose one of these files and copy it to your Linux client.
Configure WireGuard
Finally, install the config file on your client as /etc/wireguard/wg0.conf and start WireGuard:
# Install the config file to the WireGuard configuration directory on your
# Linux client:
sudo install -o root -g root -m 600 .conf /etc/wireguard/wg0.conf
# Start the WireGuard VPN:
sudo systemctl start wg-quick@wg0
# Check that it started properly:
sudo systemctl status wg-quick@wg0
# Verify the connection to the AlgoVPN:
sudo wg
# See that your client is using the IP address of your AlgoVPN:
curl ipv4.icanhazip.com
# Optionally configure the connection to come up at boot time:
sudo systemctl enable wg-quick@wg0If your Linux distribution does not use systemd you can bring up WireGuard with sudo wg-quick up wg0.
Using a DNS Search Domain
As of the v1.0.20200510 release of wireguard-tools WireGuard supports setting a DNS search domain. In your wg0.conf file a non-numeric entry on the DNS line will be used as a search domain. For example, this:
DNS = 172.27.153.31, fd00::b:991f, mydomain.comwill cause your /etc/resolv.conf to contain:
search mydomain.com
nameserver 172.27.153.31
nameserver fd00::b:991fFile: docs/client-macos-wireguard.md
MacOS WireGuard Client Setup
The WireGuard macOS app is unavailable for older operating systems. Please update your operating system if you can. If you are on a macOS High Sierra (10.13) or earlier, then you can still use WireGuard via their userspace drivers via the process detailed below.
Install WireGuard
Install the wireguard-go userspace driver:
brew install wireguard-toolsLocate the Config File
Algo generates a WireGuard configuration file, wireguard/.conf, and a QR code, wireguard/.png, for each user defined in config.cfg. Find the configuration file and copy it to your device if you don't already have it.
Note that each client you use to connect to Algo VPN must have a unique WireGuard config.
Configure WireGuard
You'll need to copy the appropriate WireGuard configuration file into a location where the userspace driver can find it. After it is in the right place, start the VPN, and verify connectivity.
# Copy the config file to the WireGuard configuration directory on your macOS device
mkdir /usr/local/etc/wireguard/
cp .conf /usr/local/etc/wireguard/wg0.conf
# Start the WireGuard VPN
sudo wg-quick up wg0
# Verify the connection to the Algo VPN
wg
# See that your client is using the IP address of your Algo VPN:
curl ipv4.icanhazip.comFile: docs/client-openwrt-router-wireguard.md
OpenWrt Router as WireGuard Client
This guide explains how to configure an OpenWrt router as a WireGuard VPN client, allowing all devices connected to your network to route traffic through your Algo VPN automatically. This setup is ideal for devices that don't support VPN natively (smart TVs, IoT devices, game consoles) or when you want seamless VPN access for all network clients.
Use Cases
- Connect devices without native VPN support (smart TVs, gaming consoles, IoT devices)
- Automatically route all connected devices through the VPN
- Create a secure connection when traveling with multiple devices
- Configure VPN once at the router level instead of per-device
Prerequisites
You'll need an OpenWrt-compatible router with sufficient RAM (minimum 64MB recommended) and OpenWrt 23.05 or later installed. Your Algo VPN server must be deployed and running, and you'll need the WireGuard configuration file from your Algo deployment.
Ensure your router's LAN subnet doesn't conflict with upstream networks. The default OpenWrt IP is 192.168.1.1 - change to 192.168.2.1 if conflicts exist.
This configuration has been verified on TP-Link TL-WR1043ND and TP-Link Archer C20i AC750 with OpenWrt 23.05+. For compatibility with other devices, check the OpenWrt Table of Hardware.
Install Required Packages
Web Interface Method
- Access your router's web interface (typically
http://192.168.1.1) - Login with your credentials (default: username
root, no password) - Navigate to System โ Software
- Click "Update lists" to refresh the package database
- Search for and install these packages:
wireguard-toolskmod-wireguardluci-app-wireguardwireguardkmod-crypto-sha256kmod-crypto-sha1kmod-crypto-md5
- Restart the router after installation completes
SSH Method
- SSH into your router:
ssh [email protected] - Update the package list:bash
opkg update - Install required packages:bash
opkg install wireguard-tools kmod-wireguard luci-app-wireguard wireguard kmod-crypto-sha256 kmod-crypto-sha1 kmod-crypto-md5 - Reboot the router:bash
reboot
Locate Your WireGuard Configuration
Before proceeding, locate your WireGuard configuration file from your Algo deployment. This file is typically located at:
configs/<server_ip>/wireguard/.confYour configuration file should look similar to:
[Interface]
PrivateKey = <your_private_key>
Address = 10.49.0.2/16
DNS = 172.16.0.1
[Peer]
PublicKey = <server_public_key>
PresharedKey =
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = <server_ip>:51820
PersistentKeepalive = 25Configure WireGuard Interface
- In the OpenWrt web interface, navigate to Network โ Interfaces
- Click "Add new interface..."
- Set the name to
AlgoVPN(or your preferred name) and select "WireGuard VPN" as the protocol - Click "Create interface"
In the General Settings tab:
- Check "Bring up on boot"
- Enter your private key from the Algo config file
- Add your IP address from the Algo config file (e.g.,
10.49.0.2/16)
Switch to the Peers tab and click "Add peer":
- Description:
Algo Server - Public Key: Copy from the
[Peer]section of your config - Preshared Key: Copy from the
[Peer]section of your config - Allowed IPs:
0.0.0.0/0, ::/0(routes all traffic through VPN) - Route Allowed IPs: Check this box
- Endpoint Host: Extract the IP address from the
Endpointline - Endpoint Port: Extract the port from the
Endpointline (typically51820) - Persistent Keep Alive:
25
Click "Save & Apply".
Configure Firewall Rules
Navigate to Network โ Firewall
Click "Add" to create a new zone
Configure the firewall zone:
- Name:
vpn - Input:
Reject - Output:
Accept - Forward:
Reject - Masquerading: Check this box
- MSS clamping: Check this box
- Covered networks: Select your WireGuard interface (
AlgoVPN)
- Name:
In the Inter-Zone Forwarding section:
- Allow forward from source zones: Select
lan - Allow forward to destination zones: Leave unspecified
- Allow forward from source zones: Select
Click "Save & Apply"
Reboot your router to ensure all changes take effect
Verification and Testing
Navigate to Network โ Interfaces and verify your WireGuard interface shows as "Connected" with a green status. Check that it has received the correct IP address.
From a device connected to your router, visit https://whatismyipaddress.com/. Your public IP should match your Algo VPN server's IP address. Test DNS resolution to ensure it's working through the VPN.
For command line verification, SSH into your router and check:
# Check interface status
wg show
# Check routing table
ip route
# Test connectivity
ping 8.8.8.8Configuration File Reference
Your OpenWrt network configuration (/etc/config/network) should include sections similar to:
config interface 'AlgoVPN'
option proto 'wireguard'
list addresses '10.49.0.2/16'
option private_key '<your_private_key>'
config wireguard_AlgoVPN
option public_key '<server_public_key>'
option preshared_key ''
option route_allowed_ips '1'
list allowed_ips '0.0.0.0/0'
list allowed_ips '::/0'
option endpoint_host '<server_ip>'
option endpoint_port '51820'
option persistent_keepalive '25'Troubleshooting
If the interface won't connect, verify all keys are correctly copied with no extra spaces or line breaks. Check that your Algo server is running and accessible, and confirm the endpoint IP and port are correct.
If you have no internet access after connecting, verify firewall rules allow forwarding from LAN to VPN zone. Check that masquerading is enabled on the VPN zone and ensure MSS clamping is enabled.
If some websites don't work, try disabling MSS clamping temporarily to test. Verify DNS is working by testing nslookup google.com and check that IPv6 is properly configured if used.
For DNS resolution issues, configure custom DNS servers in Network โ DHCP and DNS. Consider using your Algo server's DNS (typically 172.16.0.1).
Check system logs for WireGuard-related errors:
# View system logs
logread | grep -i wireguard
# Check kernel messages
dmesg | grep -i wireguardAdvanced Configuration
For split tunneling (routing only specific traffic through the VPN), change "Allowed IPs" in the peer configuration to specific subnets and add custom routing rules for desired traffic.
If your Algo server supports IPv6, add the IPv6 address to your interface configuration and include ::/0 in "Allowed IPs" for the peer.
For optimal privacy, configure your router to use your Algo server's DNS by navigating to Network โ DHCP and DNS and adding your Algo DNS server IP (typically 172.16.0.1) to the DNS forwardings.
Security Notes
Store your private keys securely and never share them. Keep OpenWrt and packages updated for security patches. Regularly check VPN connectivity to ensure ongoing protection, and save your configuration before making changes.
This configuration routes ALL traffic from your router through the VPN. If you need selective routing or have specific requirements, consider consulting the OpenWrt WireGuard documentation for advanced configurations.
File: docs/client-windows.md
Windows Client Setup
This guide will help you set up your Windows device to connect to your Algo VPN server.
Supported Versions
- Windows 10 (all editions)
- Windows 11 (all editions)
- Windows Server 2016 and later
WireGuard Setup (Recommended)
WireGuard is the recommended VPN protocol for Windows clients due to its simplicity and performance.
Installation
- Download and install the official WireGuard client for Windows
- Locate your configuration file:
configs/<server-ip>/wireguard/.conf - In the WireGuard application, click "Import tunnel(s) from file"
- Select your
.conffile and import it - Click "Activate" to connect to your VPN
Alternative Import Methods
- QR Code: If you have access to the QR code (
wireguard/.png), you can scan it using a mobile device first, then export the configuration - Manual Entry: You can create a new empty tunnel and paste the contents of your
.conffile
IPsec/IKEv2 Setup (Legacy)
While Algo supports IPsec/IKEv2, it requires PowerShell scripts for Windows setup. WireGuard is strongly recommended instead.
If you must use IPsec:
- Locate the PowerShell setup script in your configs directory
- Run PowerShell as Administrator
- Execute the setup script
- The VPN connection will appear in Settings โ Network & Internet โ VPN
Troubleshooting
"The parameter is incorrect" Error
This is a common error that occurs when trying to connect. See the troubleshooting guide for the solution.
Connection Issues
- Check Windows Firewall: Ensure Windows Firewall isn't blocking the VPN connection
- Verify Server Address: Make sure the server IP/domain in your configuration is correct
- Check Date/Time: Ensure your system date and time are correct
- Disable Other VPNs: Disconnect from any other VPN services before connecting
WireGuard Specific Issues
- DNS Not Working: Check if "Block untunneled traffic (kill-switch)" is enabled in tunnel settings
- Slow Performance: Try reducing the MTU in the tunnel configuration (default is 1420)
- Can't Import Config: Ensure the configuration file has a
.confextension
Performance Optimization
- Use WireGuard: It's significantly faster than IPsec on Windows
- Close Unnecessary Apps: Some antivirus or firewall software can slow down VPN connections
- Check Network Adapter: Update your network adapter drivers to the latest version
Advanced Configuration
Split Tunneling
To exclude certain traffic from the VPN:
- Edit your WireGuard configuration file
- Modify the
AllowedIPsline to exclude specific networks - For example, to exclude local network: Remove
0.0.0.0/0and add specific routes
Automatic Connection
To connect automatically:
- Open WireGuard
- Select your tunnel
- Edit โ Uncheck "On-demand activation"
- Windows will maintain the connection automatically
Multiple Servers
You can import multiple .conf files for different Algo servers. Give each a descriptive name to distinguish them.
Security Notes
- Keep your configuration files secure - they contain your private keys
- Don't share your configuration with others
- Each user should have their own unique configuration
- Regularly update your WireGuard client for security patches
Need More Help?
- Check the main troubleshooting guide
- Review WireGuard documentation
- Create a discussion for help