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.

  1. 1 · Get the app
  2. 2 · Get a server
  3. 3 · Run the script
  4. 4 · Open the ports
  5. 5 · Connect

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.

Recommended: a domain name. Point a name (for example 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
  • --host domain name or IP the apps connect to
  • --email for Let's Encrypt expiry notices (optional)
  • --user / --password the first login (default: vpnuser and a random password)
  • --dns 1.1.1.1,8.8.8.8 DNS servers for your devices
  • --own-ca its 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:

Serveryour domain name or IP
AuthenticationUsername and password
Username / Passwordyour login
Remote IDthe 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:

  1. Open the ca.crt link in Safari and allow the download.
  2. Settings › Profile Downloaded › Install.
  3. Settings › General › About › Certificate Trust Settings › turn on the IKEv2 VPN CA.
  1. Download ca.crt and double-click it: Keychain Access opens. Add it to the System keychain.
  2. Double-click the certificate › Trust › Always Trust.
  1. Download ca.crt.
  2. Settings › Security › Encryption & credentials › Install a certificate › CA certificate, and pick the file.
  1. Download ca.cer, double-click it › Install Certificate › Local Machine › Place in Trusted Root Certification Authorities.
  2. Using Windows' built-in VPN instead of the app? Download windows-setup.ps1 next to ca.cer and 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 NAMEa login for another person (random password, or add one after the name)
sudo brooog-ikev2 --del-user NAMEremove a login
sudo brooog-ikev2 --showserver address, logins and certificate details
sudo brooog-ikev2 --share10-minute download links for the certificate files
sudo brooog-ikev2 --statusrunning? how many devices are connected
sudo brooog-ikev2 --uninstallremove 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

UDP 500 and 4500 are blocked: open them in your provider's firewall (step 4). Some public Wi-Fi networks block VPNs; try mobile data.

The Server field must be exactly the address the script used (domain or IP, see brooog-ikev2 --show). With an IP address, trust the certificate on the device first (step 5).

Check the username and password with sudo brooog-ikev2 --show (they're case-sensitive), and that Authentication is set to username and password.

Run 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.

Don't want to run a server?

Brooog VPN: servers in many countries, ready in one tap, with IKEv2, WireGuard, VLESS and more.

Get Brooog VPN

Questions? [email protected]