IKEv2 VPN on your own server
A free app for iPhone, iPad, Mac, Android and Windows, and one script that sets up your server: firewall, certificate and logins included. No ads, no tracking.
1Get the IKEv2 VPN app
The built-in VPN of iPhone, Mac, Windows and the strongSwan app on Android also work with the same server.
2Get a server
Any VPS works: Ubuntu 22.04 / 24.04 or Debian 12, 1 CPU and 512 MB are plenty for a family. Pick the country you want your VPN to appear in.
vpn.yourname.com) at the server's IP
with an A record. The script then gets a free Let's Encrypt certificate that every device trusts —
nothing to install on your phones and PCs. With just an IP address it makes its own certificate, which you install once
on each device (step 5).
3Run the script on the server
Log in to the server with SSH as root (or a user with sudo) and run:
wget -O brooog-ikev2.sh https://brooog.com/download/ikev2/brooog-ikev2.sh sudo bash brooog-ikev2.sh
It asks for your domain name (or uses the server's IP) and sets up everything in about a minute: strongSwan, the firewall and forwarding, the certificate, and your first login. At the end it shows your server address, username and password.
Without questions / more options
sudo bash brooog-ikev2.sh --host vpn.yourname.com --email [email protected] --user alice --yes
--hostdomain name or IP the apps connect to--emailfor Let's Encrypt expiry notices (optional)--user/--passwordthe first login (default:vpnuserand a random password)--dns 1.1.1.1,8.8.8.8DNS servers for your devices--own-caits own certificate even with a domain name
Script: brooog-ikev2.sh ·
SHA-256 d32da75af24475c4df15c9fa2606ae8ee63ad65edd9f2be4a8cb94301de4d947
4Open the ports at your provider
The script opens the server's own firewall. Many providers also have a firewall in their control panel (security group, cloud firewall, network rules). Allow there:
- UDP 500 and UDP 4500 (the VPN)
- TCP 80 only if you use a domain name (Let's Encrypt checks it when the certificate is made and renewed)
5Connect
In the IKEv2 VPN app, tap Add VPN and enter what the script showed:
| Server | your domain name or IP |
|---|---|
| Authentication | Username and password |
| Username / Password | your login |
| Remote ID | the same as the server (or leave it empty) |
Only with an IP address (own certificate): trust it once on each device
On the server run sudo brooog-ikev2 --share: it prints download links for 10 minutes
(ca.crt for phones and Macs, ca.cer and windows-setup.ps1 for Windows).
Open the link on the device, then:
- Open the
ca.crtlink in Safari and allow the download. - Settings › Profile Downloaded › Install.
- Settings › General › About › Certificate Trust Settings › turn on the IKEv2 VPN CA.
- Download
ca.crtand double-click it: Keychain Access opens. Add it to the System keychain. - Double-click the certificate › Trust › Always Trust.
- Download
ca.crt. - Settings › Security › Encryption & credentials › Install a certificate › CA certificate, and pick the file.
- Download
ca.cer, double-click it › Install Certificate › Local Machine › Place in Trusted Root Certification Authorities. - Using Windows' built-in VPN instead of the app? Download
windows-setup.ps1next toca.cerand run it in PowerShell as administrator: it trusts the certificate and adds the VPN with strong settings.
Check that the certificate's SHA-256 fingerprint matches the one --share prints.
Manage your VPN
sudo brooog-ikev2 --add-user NAME | a login for another person (random password, or add one after the name) |
sudo brooog-ikev2 --del-user NAME | remove a login |
sudo brooog-ikev2 --show | server address, logins and certificate details |
sudo brooog-ikev2 --share | 10-minute download links for the certificate files |
sudo brooog-ikev2 --status | running? how many devices are connected |
sudo brooog-ikev2 --uninstall | remove everything the script added |
One login can be used on several devices at once. The Let's Encrypt certificate renews by itself. The server keeps no connection logs.
If it doesn't connect
brooog-ikev2 --show).
With an IP address, trust the certificate on the device first (step 5).
sudo brooog-ikev2 --show (they're case-sensitive), and that Authentication is set to username and password.
sudo brooog-ikev2 --status: the firewall should be active. If your provider blocks traffic between
networks, contact them. Rerunning the script fixes changed settings without losing your logins.
Questions? [email protected]