Set up your own OpenVPN server

_.:=iTake=:._

Administrator
Staff member
ZeuS
Forum Moderator
+Lifetime VIP+
Contributor
Oct 20, 2018
531
486
93
Credits
7,026
OpenVPN installer for Debian, Ubuntu, Fedora, CentOS and Arch Linux.

This script will let you setup your own secure VPN server in just a few seconds.

You can also check out how to setup WireGuard, a simple, safer, faster and more modern VPN protocol.

Usage
First, get the script and make it executable :

Code:
curl -O https://raw.githubusercontent.com/Angristan/openvpn-install/master/openvpn-install.sh
chmod +x openvpn-install.sh
Then run it :

Code:
./openvpn-install.sh
You need to run the script as root and have the TUN module enabled.

The first time you run it, you'll have to follow the assistant and answer a few questions to setup your VPN server.

When OpenVPN is installed, you can run the script again, and you will get the choice to :

  • Add a client
  • Remove a client
  • Uninstall OpenVPN
In your home directory, you will have .ovpn files. These are the client configuration files. Download them from your server and connect using your favorite OpenVPN client.

Features
  • Installs and configures a ready-to-use OpenVPN server
  • Iptables rules and forwarding managed in a seamless way
  • If needed, the script can cleanly remove OpenVPN, including configuration and iptables rules
  • Customisable encryption settings, enhanced default settings (see Security and Encryption below)
  • OpenVPN 2.4 features, mainly encryption improvements (see Security and Encryption below)
  • Variety of DNS resolvers to be pushed to the clients
  • Choice to use a self-hosted resolver with Unbound (supports already existing Unbound installations)
  • Choice between TCP and UDP
  • NATed IPv6 support
  • Compression disabled by default to prevent VORACLE. LZ4 and LZ0 algorithms available otherwise.
  • Unprivileged mode: run as nobody/nogroup
  • Block DNS leaks on Windows 10
  • Randomised server certificate name
  • Choice to protect clients with a password (private key encryption)
  • Many other little things!
Source: https://github.com/angristan/openvpn-install
 

_.:=iTake=:._

Administrator
Staff member
ZeuS
Forum Moderator
+Lifetime VIP+
Contributor
Oct 20, 2018
531
486
93
Credits
7,026
Running two servers with different configuration

I hardcoded like this

  1. After a clean install with UDP mode
  2. clone server.conf into server2.conf (manual edit UDP => TCP mode)
  3. in server2.conf, change ip 10.8.0.1 to 10.9.0.1
  4. add 10.9.0.1 in IPtables
  5. at line 838 or close to it, add
    sed -i 's|server2.conf' /lib/systemd/system/openvpn/server2.service
  6. service [email protected] restart and service [email protected] restart
  7. try lsof -i:1194 your port number, you will see both UDP & TCP openvpn services are running
 
  • Like
Reactions: Prom3th3uS

Prom3th3uS

Moderator
Staff member
Forum Moderator
+Lifetime VIP+
Contributor
Oct 21, 2018
378
228
43
Unknown
Credits
6,738
Thanks for the tut :)