Pritunl is an open-source VPN server with a web administration panel. It lets you configure the OpenVPN and WireGuard protocols to create the tunnel while using a fairly intuitive web interface that uses MongoDB. You can also configure Google Authenticator for VPN connections with clients. In this article, we will show you how to install, configure, and connect to Pritunl VPN to create a VPN connection using both available protocols.
Links
Installing Pritunl
First, to install it, create the list to add the Pritunl repository:
# tee /etc/apt/sources.list.d/pritunl.list << EOF
deb http://repo.pritunl.com/stable/apt focal main
EOF
Then add the repository key:
# apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
Next, update the repositories and packages:
# apt update && apt upgrade
Then install a prerequisite and add the MongoDB repository:
# apt install gnupg -y && wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
Update the repositories again and install MongoDB and Pritunl:
# apt update && apt install mongodb-org pritunl
Start and enable them once installation is complete:
# systemctl start mongodb pritunl && systemctl enable mongodb pritunl
Check the status of both:
# systemctl status mongodb.service pritunl.service
You should now have access to the Pritunl web administration panel (https://dirección_pública_ejemplo/setup) from a browser using the server's IP address, but it will ask for a key.
To obtain it, run the following:
# pritunl setup-key
Once entered, it will redirect to the login page. To obtain the default credentials, run:
# pritunl default-password
First, to install it, create the list to add the Printunl repository:
# tee /etc/apt/sources.list.d/pritunl.list << EOF
deb http://repo.pritunl.com/stable/apt buster main
EOF
Then add the repository key:
# apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
Next, update the repositories and packages:
# apt update && apt upgrade
Then install a prerequisite and add the MongoDB repository:
# apt install gnupg -y && wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
Update the repositories again and install MongoDB and Pritunl:
# apt update && apt install mongodb pritunl
Start and enable them once installation is complete:
# systemctl start mongodb pritunl && systemctl enable mongodb pritunl
Check the status of both:
# systemctl status mongodb.service pritunl.service
You should now have access to the Pritunl web administration panel (https://dirección_pública_ejemplo/setup) from a browser using the server's IP address, but it will ask for a key.
To obtain it, run the following:
# pritunl setup-key
Once entered, it will redirect to the login page. To obtain the default credentials, run:
# pritunl default-password
First, to install it, create the list to add the Printunl repository:
# tee /etc/yum.repos.d/pritunl.repo << EOF
[pritunl]
name=Pritunl
Repository
baseurl=https://repo.pritunl.com/stable/yum/centos/8/
gpgcheck=1
enabled=1
EOF
Then add the repository key:
# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 7568D9BB55FF9E5287D586017AE645C0CF8E292A
gpg --armor --export 7568D9BB55FF9E5287D586017AE645C0CF8E292A > key.tmp; rpm --import key.tmp; rm -f key.tmp
Next, update the repositories and packages:
# yum update && yum upgrade
Then install a prerequisite and add the MongoDB repository:
# tee /etc/yum.repos.d/mongodb-org-5.0.repo << EOF
[mongodb-org-5.0]
name=MongoDB
Repository
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc
EOF
Update the repositories again and install MongoDB and Pritunl:
# yum update && yum install mongodb-org pritunl
Start and enable them once installation is complete:
# systemctl start mongod pritunl && systemctl enable mongod pritunl
Check the status of both:
# systemctl status mongodb.service pritunl.service
You should now have access to the Pritunl web administration panel (https://dirección_pública_ejemplo/setup) from a browser using the server's IP address, but it will ask for a key.
To obtain it, run the following:
# pritunl setup-key
Once entered, it will redirect to the login page. To obtain the default credentials, run:
# pritunl default-password
Configuring OpenVPN and Wireguard
Once installed and with access to the administration panel, click the "Users" tab. There, you can create your first organization by clicking "Add Organization" (you can add more to separate users between VPN connections through these organizations). This will open the following window, where you must enter a name:
Then add users to the organization in the same "Users" tab by clicking "Add user". The following window will appear, where you must enter the username, select the organization from the drop-down menu, and enter a PIN that the user must provide to connect to the VPN:
Next, configure a VPN connection. To do this, click the "Servers" tab and then the "Add server" button to display the following window:
Here, you must specify the connection name, the port for OpenVPN and the virtual network for the connection. Additionally, if you want to create a VPN connection with Wireguard, click "Enable WireGuard" to specify another port for it and its virtual network (these must be different from OpenVPN's).
Reminder
Don't forget to open the ports configured for VPN connections in the Clouding Firewall profile linked to that server to allow access to it (How to Create a Firewall Rule).
Once finished, you must link the VPN connection to the organization to assign users, so click "Attach Organization" in the same "Servers" tab to select the connection and organization in the window that appears:
Finally, before starting the VPN server, add the route for your servers' internal network under "Add route" so that the route is added to the user's configuration by default:
Additionally, remember to delete the following route if you do not want to redirect all client traffic:
Once you have finished with the routes, click "Start Server" to start the connection.
VPN Client Configuration
To configure the client, you can download each user's configuration in the same Pritunl administration panel, in the "Users" tab, by clicking the download icon or getting a temporary link for the connection, as shown below:
Then, on the user's computer, download the client for their operating system. You can click here to go to the official download page. Once installed, import the configuration file or the temporary link URL and click "Connect" once imported, then finish by entering the PIN configured for that user:
We hope this tutorial has helped you 🙂. Remember, if you have any questions about this or any other issue related to your servers on Clouding, feel free to email soporte@clouding.io We're here for whatever you need!