How to Setup a VPN Server and Clients Using OpenVPN

OpenVPN Server

In this article, I go over how to setup a VPN Server and clients using OpenVPN. this will cover the setup process of the remote machine and then connecting to it via both Linux and Windows client machines.

OpenVPN Server Setup

This is the Installation script I use to setup a secure OpenVPN Server

Run the following script as root or add sudo to the script
curl -O
chmod +x

you will need to enable the OpenVPN service to auto-start so the VPN stays up after reboot.
sudo systemctl enable openvpn


TUN is not available
-Certain VPS servers do not have TUN enabled by default. Create the follow script and run it on startup to fix this issue.

-Create /usr/sbin/
mkdir /dev/net
mknod /dev/net/tun c 10 200
chmod 0666 /dev/net/tun

-Mark /usr/sbin/ executable
chmod +x /usr/sbin/

-Run this script on startup by adding the following to /etc/rc.local
/usr/sbin/ || exit 1
exit 0

Client Setup

Linux Client Setup

Install OpenVPN for Network Manager
Debian-Based sudo apt install network-manager-openvpn
Arch-Based sudo pacman -S networkmanager-openvpn
Gnome-Based DEs sudo apt install network-manager-openvpn-gnome

Copy OVPN file to /etc/openvpn/client/client.ovpn
Test client configuration in Terminal:
sudo openvpn /etc/openvpn/client/client.ovpn

Clicking + under Network Manager and Import VPN Connection…

Network manager Import VPN Connection: client.ovpn
Note: Certificates stored in ~/.local/share/networkmanagement/certificates

Connect via your Network Manager


Example TLS Settings config: static.key manually created from client.ovpn file

Verify TLS key file is enabled and created. This is a known issue on KDE desktops. If it isn’t make sure to create it using the last TLS portion of the ovpn file.

Windows Client Setup

Download OpenVPN client for your Windows @

Copy your client.ovpn from the server (WinSCP to connect and copy) and place the file in C:\Program Files\OpenVPN\config

Run the program and right click the icon in the tray and connect

Video Walkthrough


  1. Nihar

    Hey Chris,
    Amazing tutorial buddy.
    I am wondering how many clients this server can handle?
    I am planning to have a seperate xeon processor setup for my application.
    I want to understand the limitations of OpenVPN.

    1. Chris Titus

      Easily a couple hundred before it would saturate the gigabit connection. You can scale by doing clustering and dynamic routing to multiple vpn servers. This is obviously beyond a how-to article, but it has been done.

  2. Andrew

    Hey I followed this to the t Everytime and I can connect to it but after that I can’t use my internet anymore. I forwarded the ports also. How do I fix it. Also I have a static IP for it to now

    1. Chris Titus

      Sounds like a DNS issue. Try pinging and see if that works and then ping If the ip works and the name doesn’t it means you need to specify your DNS settings.

  3. andrew

    if you could remote in and fix it.that would be super help full and that also would show me what is wrong. even if i have to pay im fine with it. as long as i can get it fixed

  4. Gregor

    How to setup “VPN” icon in the status bar in debian to see all the time we are connected or not

  5. Soren Hansen

    You set up a vpn server on a vps server, but the vps server, does it have to be on it’s own machine, or can the vps server run on a freenas server ?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: