Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk10 min

How to Install OpenVPN on an Ubuntu VPS

A complete Ubuntu VPS guide to installing OpenVPN Community Edition, creating certificates with Easy-RSA, configuring firewalls and NAT, starting the named service, and deciding when Access Server fits better.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most Ubuntu VPS users, the best route is OpenVPN Community Edition: install openvpn and easy-rsa, build a certificate authority (CA), create a named server configuration, open the chosen port at every firewall layer, enable IPv4 forwarding, add NAT for the VPN subnet, and start openvpn@myserver. OpenVPN Access Server is a separate, web-managed option when browser administration and automatic profile distribution matter more than a command-line setup.

What you need before installing

This guide assumes an Ubuntu VPS with a public IPv4 address, a user who can run sudo, and a cloud firewall or security-group control. The examples use a configuration named myserver.conf, the conventional VPN network 10.8.0.0/24, and UDP port 1194. Change those values if they conflict with a network already used by the VPS, your office, or a client’s local LAN.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Public addressing: clients must be able to resolve or reach the VPS public IP address (or a DNS name that points to it).
  • Three separate control layers: the VPS provider’s security group, Ubuntu’s host firewall, and Linux routing/NAT are independent. A rule in one layer does not automatically configure the others.
  • Administrative access: keep an existing SSH session open while changing firewall or routing settings so a mistake does not lock you out.
  • Credential handling: the CA private key, server and client private keys, and TLS key are secrets. Transfer them over an encrypted administrative channel and remove temporary copies.

Ubuntu describes OpenVPN as “a flexible, reliable and secure Virtual Private Networking (VPN) solution.” The Community Edition workflow below follows Ubuntu’s package, Easy-RSA, configuration, forwarding, and systemd model.

Choose the edition that fits your VPS

Area Community Edition OpenVPN Access Server
Administration Configuration files, shell commands, systemd, and your chosen firewall tools. Web-based Admin UI in addition to the vendor’s installer and package workflow.
Client onboarding You create certificates and assemble a client configuration, then transfer the credentials securely. The Client UI can provide OpenVPN Connect and a preconfigured connection profile.
Licensing OpenVPN and Easy-RSA are installed from Ubuntu repositories. Product licensing applies; an unlicensed server allows two connections by default.
VPN address pool You select the subnet in the server configuration. The internal VPN subnet defaults to 172.27.224.0/20 and can be changed.

Use Community Edition when you are comfortable maintaining text configuration and certificates. Select Access Server when a web console, browser-based user provisioning, and downloadable profiles justify its separate licensing model. Both editions still need a reachable public address, an allowed port, and correct routing.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Install OpenVPN and Easy-RSA

  1. Refresh Ubuntu’s package index:
    sudo apt update
  2. Install the VPN daemon and the Easy-RSA PKI tools:
    sudo apt install openvpn easy-rsa
  3. Confirm what Ubuntu installed, especially on a long-lived VPS:
    openvpn --version
    Ubuntu’s Jammy manpage archive shows package version 2.5.11-0ubuntu0.22.04.5 as an example; the version on your release can differ.

Do not expose the OpenVPN port until you have a complete server configuration and a plan for the VPN address pool. Installing the package alone does not create a usable tunnel.

Create a certificate-based PKI with Easy-RSA

OpenVPN’s TLS control channel uses X.509 certificates. Create one CA, use it to sign the server certificate, and issue a separate certificate and key for each client. Keep the CA private key offline after issuing credentials; anyone who obtains it can sign certificates that your server may trust.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Prepare a private Easy-RSA working directory

Copy the Easy-RSA files installed by Ubuntu into a directory owned by your administrative account (for example, a directory under your home folder). Work there rather than generating the CA directly in /etc/openvpn. Restrict the directory permissions so other users on the VPS cannot read private keys.

2. Initialize the PKI and CA

Run the Easy-RSA 3 workflow from that directory:

./easyrsa init-pki
./easyrsa build-ca

build-ca asks for a CA passphrase and a common name. Record the name and protect the resulting CA private key. A passphrase-protected CA is safer than an unattended signing key on the VPN host.

3. Issue the server certificate and Diffie-Hellman parameters

./easyrsa gen-req server nopass
./easyrsa sign-req server server
./easyrsa gen-dh

The server private key, signed certificate, CA certificate, and generated Diffie-Hellman file are referenced by the server configuration. If you do not want an unencrypted server key, omit nopass and arrange a secure key-unlock method that works during boot.

4. Issue one certificate per client

./easyrsa gen-req client1 nopass
./easyrsa sign-req client client1

Repeat with a different name for every device or person. Revoking one client’s certificate is then possible without replacing every other client’s credentials. Copy only the files required by that client; never distribute the CA private key.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Build the named server configuration

Ubuntu provides a sample configuration. Copy it to the name used by systemd:

sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf /etc/openvpn/myserver.conf

On older Ubuntu releases the sample may be compressed as server.conf.gz; decompress it before copying. Edit /etc/openvpn/myserver.conf and set paths to the CA certificate, server certificate, server private key, Diffie-Hellman file, and TLS key. Use absolute paths so the service behaves consistently at boot.

Core network settings

A typical configuration selects a tunnel device and a private VPN subnet:

port 1194
proto udp
dev tun
server 10.8.0.0 255.255.255.0

Port 1194 is OpenVPN’s official port, but you may choose another UDP or TCP port. The protocol and port in this file must match the cloud firewall, Ubuntu firewall, and every client profile. Avoid a VPN subnet that overlaps a client’s home, office, or another private network; overlapping routes produce apparently random reachability failures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Certificate and control-channel settings

Point the certificate directives at the files created by Easy-RSA, then generate a TLS key:

sudo openvpn --genkey secret ta.key

Reference that key with:

tls-crypt ta.key

Ubuntu notes that releases older than 18.04 may require tls-auth ta.key 0 instead. Use the directive appropriate to the OpenVPN version on both server and clients; do not silently mix the two forms.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Decide whether this is split-tunnel or full-tunnel

In a split-tunnel design, only selected private networks use the VPN. In a full-tunnel design, the client sends ordinary internet traffic through the VPS. A full tunnel requires a route push in the server configuration and working forwarding and NAT; adding a route alone is not enough. Document the intended topology before enabling it, because a wrong route can strand a client or create a loop.

Open the port at every firewall layer

Permit the exact protocol and port selected in myserver.conf in three places:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Cloud firewall or security group: add an inbound rule for UDP 1194 (or your replacement port) to the VPS. Some providers also require an outbound rule for return traffic.
  2. Ubuntu host firewall: allow the same UDP or TCP port. With UFW, an example for the default transport is sudo ufw allow 1194/udp.
  3. Forwarding policy: permit traffic from the tunnel interface to the intended destination interface and allow established return traffic. An INPUT rule that accepts the OpenVPN handshake does not automatically permit forwarded client packets.

If you change to TCP, use 1194/tcp in both firewall layers and proto tcp in the configuration. Do not open both protocols unless you deliberately operate both listeners.

Enable IPv4 forwarding and NAT

Create /etc/sysctl.d/50-enable-ipv4-forwarding.conf with exactly:

net.ipv4.ip_forward = 1

Apply it immediately:

sudo sysctl -p /etc/sysctl.d/50-enable-ipv4-forwarding.conf

Forwarding allows the kernel to pass packets between interfaces; it does not create a return route on the internet. For a full-tunnel internet design, masquerade the VPN subnet on the VPS’s public interface and allow forwarding in the packet filter. The interface is often named eth0, ens3, or something provider-specific, so identify it first with ip route get 1.1.1.1.

An illustrative iptables rule is:

sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o PUBLIC_INTERFACE -j MASQUERADE

Replace PUBLIC_INTERFACE with the actual interface and make the rule persistent using the firewall system you already administer. If clients must reach another private network rather than the public internet, add a route back to 10.8.0.0/24 on that network (or NAT where appropriate). Without a return route, the VPS can receive a client’s packet but the destination cannot reply.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Start and enable the named OpenVPN instance

The filename determines the systemd instance name. For /etc/openvpn/myserver.conf, run:

sudo systemctl start openvpn@myserver
sudo systemctl enable openvpn@myserver

Ubuntu warns that systemctl start openvpn does not start the named configuration. Check the instance explicitly:

sudo systemctl status openvpn@myserver
sudo journalctl -u openvpn@myserver

A successful start should create a tun0 interface (or the device name selected in the configuration). If the service fails, the journal usually identifies a missing certificate, an unreadable key, an invalid directive, or a port conflict.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a client profile securely

Install OpenVPN on the client or use a compatible graphical client. Assemble a profile that matches the server’s public endpoint, protocol, port, CA certificate, client certificate, client key, and TLS key:

client
dev tun
proto udp
remote VPS_PUBLIC_IP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
ca ca.crt
cert client1.crt
key client1.key
tls-crypt ta.key

Replace VPS_PUBLIC_IP with the VPS address or DNS hostname and use the actual filenames. Keep the profile and referenced keys readable only by the intended user. If you embed certificates inside the profile instead of using separate files, protect the combined file as a private credential.

Import the profile into the client’s OpenVPN application and connect. The client log should show a completed TLS handshake and assignment of an address from the VPN subnet. A handshake proves that the control channel works; it does not prove that internet or private-network routing is correct.

Troubleshoot by symptom

The client cannot connect at all

  • Check sudo systemctl status openvpn@myserver and sudo journalctl -u openvpn@myserver.
  • Confirm the cloud security group and Ubuntu firewall allow the configured protocol and port.
  • Verify that the client uses the same UDP/TCP choice and port as myserver.conf.
  • Confirm DNS resolves to the VPS public address and that no second process already owns the port.

The client connects but cannot reach the internet

  • Confirm that tun0 exists and that IPv4 forwarding is enabled.
  • Check the client’s routes. A full tunnel needs a default-route push; a split tunnel needs explicit routes for the intended networks.
  • Verify the packet filter allows forwarding from tun0 to the public interface and permits established return traffic.
  • Verify NAT covers the actual VPN subnet and public interface. A masquerade rule for the wrong subnet or interface has no effect.
  • Check DNS separately. If an IP address works but hostnames do not, the tunnel may be healthy while the client lacks a usable DNS path.

The client reaches the VPS but not another private network

Inspect routes on both sides. The destination network needs a return route to the VPN subnet through the VPS, unless you intentionally NAT VPN traffic. Also check intermediate firewalls; allowing the OpenVPN handshake does not authorize forwarded traffic to every internal host.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The service starts manually but not after reboot

Confirm the file is exactly /etc/openvpn/myserver.conf, enable openvpn@myserver rather than the generic service, and inspect the journal after a reboot. Absolute certificate and key paths prevent failures caused by a different working directory.

When OpenVPN Access Server is the better fit

Access Server uses the vendor’s Ubuntu installer and package workflow, then provides browser-based Admin and Client UIs. Configure the VPS public IP address or DNS hostname in the product, create users in the Admin UI, and let users download OpenVPN Connect and a preconfigured profile from the Client UI.

An unlicensed Access Server permits two connections by default; licensing changes that limit. Its default internal VPN subnet is 172.27.224.0/20, which can be changed when it overlaps an existing network. The web interface simplifies onboarding, but cloud firewall exposure, host firewall rules, forwarding, NAT, and return routes remain your responsibility.

Operational checklist

  • Use a non-overlapping VPN subnet and record whether the design is split-tunnel or full-tunnel.
  • Keep the CA private key offline after issuing server and client credentials.
  • Issue a distinct client certificate for every device or user; revoke and replace credentials when a device is lost.
  • Protect client keys and the TLS key during transfer and storage.
  • Allow only the selected protocol and port at the provider firewall and Ubuntu firewall.
  • Persist forwarding and NAT rules using the firewall tooling used on the VPS.
  • Monitor openvpn@myserver logs and verify that the service is enabled at boot.
  • Do not treat a successful TLS handshake as proof that forwarding, NAT, DNS, or private-network return routes work.

Frequently Asked Questions

Which port does OpenVPN use on Ubuntu?

Port 1194 is the official OpenVPN port. The server can use another UDP or TCP port, but the configuration, cloud firewall, Ubuntu firewall, and client profile must all match.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does systemctl start openvpn not start my server?

Ubuntu uses named instances for configuration files. With /etc/openvpn/myserver.conf, start sudo systemctl start openvpn@myserver and enable the same instance at boot.

Do I need NAT if IPv4 forwarding is enabled?

Usually yes for a full-tunnel internet VPN. Forwarding permits packet transit, while NAT or an equivalent return route lets external destinations reply to VPN addresses.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.