Set Up an OpenConnect VPN Server on your Webdock Ubuntu Server
Last updated: August 19th 2025
Introduction
This guide shows how to install and configure an OpenConnect VPN server on Ubuntu 24.04, secure it with a free Let's Encrypt TLS certificate, and connect clients. It also covers firewall/NAT, IPv6, and common troubleshooting steps.
- Protocol: Cisco AnyConnect-compatible (SSL VPN)
- Works with: OpenConnect (Linux/macOS/Windows/OpenWrt) and Cisco AnyConnect (Android/iOS)
Prerequisites
- An Ubuntu 24.04 server (VPS or dedicated) with a public IPv4 address
- A domain name pointed to your server's IP (e.g., vpn.example.com)
- Shell access with sudo privileges
Install ocserv
$ sudo apt update
$ sudo apt install -y ocserv
Check the service status:
$ sudo systemctl status ocserv --no-pager
By default, ocserv listens on TCP and UDP port 443. If a web server is using 443, you can change ocserv's port later in its configuration.
If a firewall is active, allow HTTP/HTTPS for certificate issuance:
$ sudo ufw allow 80,443/tcp
Install Certbot (Let's Encrypt client)
First, install snapd
$ sudo apt install snapd
Now install certbot with snap
$ sudo snap install --classic certbot
And finally, link in the Certbot binary so it can be run from anywhere
$ sudo ln -s /snap/bin/certbot /usr/bin/certbot
Obtain a Let's Encrypt certificate
Use the standalone method (no web server required):
sudo certbot certonly \
--standalone \
--preferred-challenges http \
--agree-tos \
--email you@example.com \
-d vpn.example.com
This uses port 80 for the HTTP challenge. Ensure the DNS A record for vpn.example.com points to your server.
Certificates will be stored under /etc/letsencrypt/live/vpn.example.com/.
Set up an automated certificate renewal:
$ sudo crontab -e
Add this entry to run daily at 05:00:
0 5 * * * certbot renew --quiet && systemctl restart ocserv
Configure ocserv
Back up the current configuration, then edit /etc/ocserv/ocserv.conf:
$ sudo cp /etc/ocserv/ocserv.conf /etc/ocserv/ocserv.conf.bak-$(date +%F)
$ sudo nano /etc/ocserv/ocserv.conf
Start from the default configuration and make a few changes.
-
Comment out the UDP port. You'll enable TCP BBR later to improve throughput:
# TCP and UDP port number tcp-port = 443 #udp-port = 443
-
Replace the defaults with the paths to the Let's Encrypt server certificate and key files:
server-cert = /etc/letsencrypt/live/vpn.example.com/fullchain.pem server-key = /etc/letsencrypt/live/vpn.example.com/privkey.pem
-
Limit the number of clients. A value of 0 means no limit (subject to internal maximums):
max-clients = 0
-
Set the default domain for clients:
default-domain = vpn.example.com
-
IP addressing — avoid common home LAN ranges by using a dedicated subnet:
ipv4-network = 10.10.10.0 ipv4-netmask = 255.255.255.0
-
Enable IPv6 for clients:
ipv6-network = fda9:4efe:7e3b:03ea::/48 ipv6-subnet-prefix = 64
-
Force all DNS through the VPN and set resolvers:
tunnel-all-dns = true dns = 1.1.1.1 dns = 1.0.0.1 dns = 8.8.8.8
-
Make the server the default gateway (use a default route and comment out specific routes):
route = default #route = 10.0.0.0/8 #route = 172.16.0.0/12 #route = 192.168.0.0/16
Save and restart ocserv:
$ sudo systemctl restart ocserv
Check ocserv is running:
$ sudo systemctl status ocserv
Create VPN user accounts
Create users with ocpasswd (you'll be prompted for a password):
$ sudo ocpasswd -c /etc/ocserv/passwd <username>
Run the same command to reset a user's password.
Enable IP forwarding and TCP BBR
Create a sysctl configuration file:
$ echo "net.ipv4.ip_forward = 1" | sudo tee /etc/sysctl.d/60-custom.conf
# Optional: enable TCP BBR for better throughput/latency
$ echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.d/60-custom.conf
$ echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.d/60-custom.conf
# Apply and persist
$ sudo sysctl -p /etc/sysctl.d/60-custom.conf
Configure NAT (masquerading) and forwarding with UFW
Install and enable UFW:
$ sudo apt install -y ufw
$ sudo ufw allow 22/tcp
Find your main network interface name:
$ ip addr
Edit /etc/ufw/before.rules and append a NAT section (replace eth0 with your interface):
$ sudo nano /etc/ufw/before.rules
Append at the end of the file:
# OpenConnect NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE
COMMIT
# End OpenConnect rules
Allow forwarding for the VPN subnet (add the following after the # ok icmp code for FORWARD
section):
# allow forwarding for trusted network
-A ufw-before-forward -s 10.10.10.0/24 -j ACCEPT
-A ufw-before-forward -d 10.10.10.0/24 -j ACCEPT
Enable or restart UFW:
sudo ufw enable # if not enabled
# or
sudo systemctl restart ufw
Verify NAT POSTROUTING:
$ sudo iptables -t nat -L POSTROUTING --line-numbers -n -v
Check VPN ports are opened
Check that 443/tcp is ALLOWED:
$ sudo ufw status
Connect from clients
Install the OpenConnect client (Ubuntu Desktop):
$ sudo apt install -y openconnect
Connect from the CLI (runs in the background with -b):
$ sudo openconnect -b vpn.example.com
Then enter username and password.
To stop the connection:
$ sudo pkill openconnect
Doing the above non-interactively:
echo -n 'your-password' | sudo openconnect -b vpn.example.com -u your-username --passwd-on-stdin
For a GUI use the NetworkManager plugin, which can be installed with:
$ sudo apt install -y network-manager-openconnect network-manager-openconnect-gnome
Conclusion
That's it. The above instructions should help you set up OpenConnect VPN on your own Webdock server.
Feel free to contact Webdock Support if you face any issues.
Related articles
-
How to install OpenLiteSpeed on Webdock
In this article we show you how you can install the OpenLiteSpeed web server on Ubuntu Jammy.
Last updated: March 29th 2023
-
How to Deploy your First Node.js Application on your Ubuntu Web Server
Deploy a Node.js application on your Ubuntu server and how to issue SSL certificates for your Node application.
Last updated: July 19th 2023
-
How to set up WireGuard on your Webdock Server
This article details how you can quickly and easily install WireGuard on your Webdock Server.
Last updated: February 17th 2025
-
How to set up OpenVPN on your Webdock Server
This article details how you can quickly and easily set up a VPN on your Webdock server.
Last updated: February 17th 2025
-
How to Install and configure aaPanel on Ubuntu
Install aaPanel on Ubuntu as well as building a LEMP stack, pointing your domain to your server and setting SSL certificates with Let's Encrypt.
Last updated: February 24th 2025
-
How to install azuracast on Webdock
This guide shows you how to work around certain issues when installing azuracast on Webdock.
Last updated: February 19th 2025
-
How to set up Runcloud on Webdock
This article details the steps you need to go through in order to install Runcloud on a Webdock server.
Last updated: July 29th 2024
-
How to set up cPanel on Webdock
This article details the steps you need to go through in order to install cPanel on a Webdock server.
Last updated: February 25th 2025
-
How to set up Gridpane on Webdock
This article details the steps you need to go through in order to install Gridpane on a Webdock server.
Last updated: February 25th 2025
-
How to set up Ploi on Webdock
This article details the steps you need to go through in order to install Ploi on a Webdock server.
Last updated: February 25th 2025
-
How to set up Laravel Forge on Webdock
This article details the steps you need to go through in order to install Laravel Forge on a Webdock server.
Last updated: February 25th 2025
-
How to set up Plesk on Webdock
This article details the steps you need to go through in order to install Plesk on a Webdock server.
Last updated: February 26th 2025
-
How to set up Cyberpanel on Webdock
This article details the steps you need to go through in order to install Cyberpanel on a Webdock server.
Last updated: February 22nd 2025
-
How to set up SpinupWP on Webdock
This article details the steps you need to go through in order to installSpinupWP on a Webdock server.
Last updated: March 8th 2025
-
How to set up DirectAdmin on Webdock
This article details the steps you need to go through in order to install DirectAdmin on a Webdock server.
Last updated: February 19th 2025
-
How to set up Hestia on Webdock
This article details the steps you need to go through in order to install Hestia on a Webdock server.
Last updated: February 25th 2025
-
How to set up Virtualmin on Webdock
This article details the steps you need to go through in order to install Virtualmin on a Webdock server.
Last updated: February 25th 2025
-
How to install and create pipelines in Jenkins
This guide describes the step-by-step procedure of installing Jenkins and creating pipelines in Jenkins.
Last updated: February 20th 2025
-
Basic WordPress site setup with aaPanel
In this guide, we will install and setup a basic WordPress site with aaPanel.
Last updated: January 23rd 2023
-
How to use Nginx as reverse proxy and secure connections with SSL certificates
Using Nginx to proxy pass your site with SSL security.
Last updated: February 19th 2025
-
Setting up monitoring with Netdata on your Webdock server
Setting up monitoring on your server to receive alerts and to know real-time resource consumption on your server.
Last updated: February 21st 2025
-
How to Setup Python Web Application With Flask Gunicorn and Nginx
A simple Python Flask web app hosting with Gunicorn and Nginx
Last updated: July 19th 2023
-
How to Daemonize an Application with Systemd
Using systemd to autostart your application on system startup.
Last updated: July 19th 2023
-
Set-up New Relic Monitoring on Your Webdock Server
This guide provides step-by-step instructions to install New Relic to monitor your VPS.
Last updated: February 21st 2025
-
Getting Started with Ruby on Rails on Webdock
In this guide, we will show you how to get started with Ruby on Rails on your Webdock server
Last updated: February 21st 2025
-
How to Install VaultWarden on Your Webdock Server
This guide provided step-by-step instructions to Vaultwarden, an open-source Password Manager on your Webdock Server.
Last updated: July 19th 2023
-
How to Install the Latest Version of HTOP on Ubuntu Server
Instructions to install latest htop package on your Ubuntu server
Last updated: July 29th 2024
-
How to Install ImageMagick 7 on Ubuntu LEMP/LAMP stacks
Simple instructions to install ImageMagick 7 along with the PHP extension
Last updated: November 1st 2023
-
A Quick Guide to Installing Rust on Ubuntu
Instructions to install Rust
Last updated: December 18th 2023
-
How To Install Proxmox on Your Webdock Server
This article provides instructions on how to install Proxmox on your Webdock server
Last updated: July 29th 2024
-
How To Run Nextcloud on Your Webdock Ubuntu Server
Instructions to Install Nextcloud on your server with Docker
Last updated: February 13th 2024
-
The Ultimate Guide to Setting Up Mastodon server
A detailed guide with instructions to set up Mastodon on your Webdock server
Last updated: February 12th 2025
-
A Guide To Setting Up Mindustry Game Server on Ubuntu
Step-by-step instructions to set up your own Mindustry server
Last updated: February 12th 2025
-
A Guide to Installing ERPNext on Your Webdock Server
Step-by-step instructions to install ERPNext - a resource planning software - on your server
Last updated: February 21st 2025
-
A Beginner's Guide to Installing Apache Kafka on Ubuntu
Detailed instructions to get Kakfa running on Ubuntu!
Last updated: February 25th 2025
-
A Quick Guide To Installing Rocket Chat on Ubuntu
Instructions to install Rocket Chat on your Ubuntu server
Last updated: February 12th 2025
-
How to Install Ghost CMS on a Webdock Server
Easily install Ghost CMS on your Webdock server with these instructions!
Last updated: February 24th 2025
-
How to Install cPanel on a Webdock Ubuntu Server
Instructions for setting up cPanel on an Ubuntu server
Last updated: September 23rd 2024
-
How to Install VSCode Server on Your Webdock VPS
A short article on how to install vscode server on your Webdock server to do development right from the browser!
Last updated: January 9th 2025
-
How to Install and Configure Litespeed Cache on WordPress
This guide shows how to configure LightSpeed Cache on your Wordpress site
Last updated: January 13th 2025
-
How to Create a Child Nameserver in WHM
This guides outlines how you can create a child nameserver in WHM
Last updated: January 22nd 2025
-
Upgrading or Downgrading NodeJS Versions with NVM
A short article with instructions to change NodeJS version with Node Version Manager (NVM)
Last updated: February 26th 2025
-
How to Host Pocketbase on Your Webdock Server
A mini guide on hosting Pocketbase to help backend developers with their serverless needs.
Last updated: January 29th 2025
-
How to Install Java on Your Webdock Ubuntu Server
Short article with instructions to install Java on your Ubuntu server
Last updated: February 23rd 2025
-
How To Install Uptime Kuma on Your Webdock Server
Instructions to install UptimeKuma - a fancy selfhosted monitoring tool
Last updated: February 27th 2025
-
Setting Up Opensource VPN (OpenVPN)
Simple instructions for setting up OpenVPN on a Webdock server
Last updated: March 25th 2025
-
How to Install Changedetection.io on Your Webdock Ubuntu Server
This is our favorite change detection software. This article is on how to install it
Last updated: April 21st 2025
-
Selfhost All Your Sites with A Few Clicks using Coolify
Quickly deploy your apps/sites using Coolify
Last updated: May 6th 2025
-
Selfhosting MeiliSearch with Webdock for 5 Bucks
Using Coolify to host MeiliSearch on your Webdock Server
Last updated: May 7th 2025
-
How to Host Redis on Webdock for 5 Bucks
Using Coolify to host Redis on your Webdock Server
Last updated: May 7th 2025
-
Selfhosted PostgreSQL for 5 bucks with Coolify
Using Coolify to host PostgreSQL
Last updated: May 7th 2025
-
How to Install Cal.com on Your Webdock Ubuntu Server
Your own instance of Cal.com on your own Webdock Server
Last updated: June 9th 2025
-
How to Install Activepieces on Your Webdock Ubuntu Server
Instructions to host your own instance of Activepieces on your WD server
Last updated: June 9th 2025
-
How To Install n8n on Your Webdock Server
Instructions to host the n8n automation tool on your own Webdock server
Last updated: August 8th 2025
-
How to Deploy Django on Your Ubuntu Webdock Server
Guide to get Django up and running on your Webdock server
Last updated: July 9th 2025