Setup OpenVPN Server on Linux

OpenVPN is an open source SSL VPN solution.

OpenVPN server installation can be quite complicated. We’ll use a script which manage all installation and configuration step for you.

Installation

Download script and run it, it will ask you for some information:

  • UDP or TCP
  • Network port
  • DNS Servers
  • Client name
wget  -O openvpn-install.sh
bash openvpn-install.sh

You can re-run script to generate new client configuration, revoke old client or uninstall OpenVPN server.

To manage OpenVPN server, you can use openvpn-server@server.service service:

systemctl status openvpn-server@server.service
systemctl enable openvpn-server@server.service

In case of network issue

Once you are connected to OpenVPN server, if ping and HTTP work, but other traffic like SSH or HTTPS are not working, it’s probably due to MTU (Maximum Transmission Unit) problem.

MTU is the maximum size of the data that can be transmitted over the network.

Edit OpenVPN configuration file to set MTU to 1200 and restart OpenVPN server.

vim /etc/openvpn/server/server.conf

Add the following line to the end of the file:

mssfix 1200

Then restart OpenVPN server:

systemctl restart openvpn-server@server.service

Sources