{"id":4414,"date":"2024-02-23T18:51:46","date_gmt":"2024-02-23T18:51:46","guid":{"rendered":"https:\/\/www.systemfreaks.com\/blog\/?p=4414"},"modified":"2024-02-24T21:03:58","modified_gmt":"2024-02-24T21:03:58","slug":"how-to-setup-a-free-vpn-server-the-easy-way-updated-2024","status":"publish","type":"post","link":"https:\/\/www.systemfreaks.com\/blog\/hosting-tips-tricks\/how-to-setup-a-free-vpn-server-the-easy-way-updated-2024\/","title":{"rendered":"How to Setup a Free VPN Server | The Easy Way (Updated 2024)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">VPN, or virtual private network, is a secure method of connecting remote internet resources as if they were under the same LAN. OpenVPN is a popular implementation that works on Linux, Windows, and Mac operating systems and can create complex, encrypted networks between physically dispersed servers.<br>The OpenVPN Access Server is a solution built on top of traditional OpenVPN used as a complete portal for managing connections, users, and interfaces. It provides the underlying VPN instance, a web interface for managing the suite, and a client that can be used within a web browser.<br>In this guide, we\u2019ll install and configure the OpenVPN Access Server on a CentOS 6.9 VPS instance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why you need a VPN ?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A VPN server can be used to hide your real ip on your PC or Android Device, a VPN server can be used to create a secure network link when you connect to free or open wifi Hot Spots! So OpenVPN is very important for your private data safety<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>First you need a VPS<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">You will need to buy a VPS to host your VPN, <a href=\"https:\/\/www.sovahost.net\/manager\/link.php?id=40\">Sovahost.net<\/a> offers fast VPS for only \u20ac 5.99\/mo you can see the offer following <a href=\"https:\/\/www.sovahost.net\/manager\/link.php?id=40\">this link <\/a>but you can use this guide on any other provider.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Download and Install Packages<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We can obtain the OpenVPN Access Server package for CentOS from the <a href=\"https:\/\/openvpn.net\/vpn-software-packages\/\">project\u2019s website<\/a> .<br>Right-click on the package that matches your version of CentOS and your machine\u2019s architecture. Select the \u201ccopy link address\u201d item or whatever option is closest.<br>On your CentOS VPS, download the package with curl -O (that\u2019s the letter \u201co\u201d, not a zero) followed by the URL you copied from the page. In my case, this turned out to be:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>For Centos 7<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install https:\/\/as-repository.openvpn.net\/as-repo-centos7.rpm\nyum -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>For Centos 8<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install https:\/\/as-repository.openvpn.net\/as-repo-centos8.rpm\nyum -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Ubuntu 22.04<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb http:\/\/as-repository.openvpn.net\/as\/debian bionic main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Ubuntu 20.04<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb http:\/\/as-repository.openvpn.net\/as\/debian bionic main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Ubuntu 18<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb http:\/\/as-repository.openvpn.net\/as\/debian bionic main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Ubuntu 16<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb &#91;arch=amd64] http:\/\/as-repository.openvpn.net\/as\/debian xenial main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Debian 10<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb http:\/\/as-repository.openvpn.net\/as\/debian buster main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">For Debian 9<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update &amp;&amp; apt -y install ca-certificates wget net-tools gnupg\nwget -qO - https:\/\/as-repository.openvpn.net\/as-repo-public.gpg | apt-key add -\necho \"deb http:\/\/as-repository.openvpn.net\/as\/debian stretch main\"&gt;\/etc\/apt\/sources.list.d\/openvpn-as-repo.list\napt update &amp;&amp; apt -y install openvpn-as<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After installing the package, an administration account is created called OpenVPN. However, no password has been set.<br>Set a password for the administrator\u2019s account by typing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo passwd openvpn<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, the command line configuration steps are complete. The rest of the guide will focus on configuring options through the web interface.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Accessing the Web Interface<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We can access our VPN portal by going to our server\u2019s IP address or domain name, at port 943. The server operates using TLS, so we will need to specify the HTTPS protocol.<br>For our initial interaction, we actually want to go to the administrative interface, which is the same, except ending with \/admin:<br>https:\/\/server_ip_or_domain:943\/admin<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can access our VPN portal by going to our server\u2019s IP address or domain name, at port 943. The server operates using TLS, so we will need to specify the HTTPS protocol.<br>For our initial interaction, we actually want to go to the administrative interface, which is the same, except ending with \/admin:<br>https:\/\/server_ip_or_domain:943\/admin<br><br>You will get a warning that the site\u2019s SSL certificates are not trusted:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"229\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-3.png\" alt=\"Image\" class=\"wp-image-4419\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-3.png 690w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-3-300x100.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This is expected and perfectly fine. All that this is telling us is that OpenVPN is using a self-signed SSL certificate, which is not trusted by default by our browser. We can click on the \u201cProceed anyway\u201d button or whatever similar option you have.<br>Note: If you are unable to connect to the web interface, there\u2019s a chance that OpenVPN is bound to the wrong network interface. You can verify this by typing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo netstat -plunt | grep openvpn<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the response does not show your server\u2019s public IP address, you will need to manually reconfigure it by typing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/usr\/local\/openvpn_as\/bin\/ovpn-init<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Delete the current configuration by typing DELETE at the prompt. Next, accept the license agreement and press ENTER to mark this as the primary server. In the next prompt, select (1) all interfaces: 0.0.0.0 to bind to all interfaces. This will ensure that the access server is available in spite of a bind error in the OpenVPN installer. Press ENTER to accept the default values of the remaining prompts.<br>After reconfiguring, you should be able to access the web interface after accepting the SSL certificate in your browser.<br>You will be presented with the admin login page. Use the username openvpn and the password you set for this user:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"383\" height=\"300\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-1.png\" alt=\"Image\" class=\"wp-image-4417\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-1.png 383w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-1-300x235.png 300w\" sizes=\"auto, (max-width: 383px) 100vw, 383px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You will be taken to the OpenVPN Access Server\u2019s EULA, which you will have to agree to if you wish to continue:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"268\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-5.png\" alt=\"Image\" class=\"wp-image-4421\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-5.png 640w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-5-300x126.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Once you log in, you can see the administrative interface, complete with some useful at-a-glance stats on the landing page:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"518\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-6.png\" alt=\"Image\" class=\"wp-image-4422\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-6.png 640w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-6-300x243.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Here, you can configure your VPN server. The access server separates the web interface and the actual VPN access and each can be configured independently.<br>For instance, if you go to the Server Network Settings in the left-hand menu, you will see a page where you can configure the port and interface that each component operates on. You can also specify the address pool that will be available to the clients.<br>Another thing you might want to do is add users and configure the authentication methods. You can add VPN users that match your system users, or add users that you might be controlling through an LDAP server.<br>Logging in as a Client<br>When you are finished configuring things as an admin, you can visit the client portion by going to your IP address or domain name followed by port 943:<br>https:\/\/server_ip_or_domain:943<br>You will have to type in a username of a user that you have configured VPN access for:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"386\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-2.png\" alt=\"Image\" class=\"wp-image-4418\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-2.png 448w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-2-300x258.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you the user that you logged in as has been designated as an OpenVPN admin account, you will see an \u201cAdmin\u201d button that can be used to take you back to the admin control panel. Either way, you will be taken to a page that will allow you to download software for your client to connect to the VPN server:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"640\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-4.png\" alt=\"Image\" class=\"wp-image-4420\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-4.png 599w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-4-281x300.png 281w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If your desktop is Windows or OS X, or if you have an android or iOS device, you can download an OpenVPN Connect client that will operate within your browser. If your desktop is a Linux machine, you will be asked to download the normal VPN client.<br>You should follow the directions of the client of your choice. If you are using the Linux client, you\u2019ll need to download the connection settings profile by clicking on the \u201cYourself\u201d link:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/postimg.cc\/d7TFwXhN\"><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"123\" src=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image.png\" alt=\"Image\" class=\"wp-image-4416\" srcset=\"https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image.png 377w, https:\/\/www.systemfreaks.com\/blog\/wp-content\/uploads\/2024\/02\/image-300x98.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Using the regular Linux openvpn client, you can connect using something like this:<br>sudo openvpn \u2013config client.ovpn<br><strong>Conclusion<\/strong><br>Now, you should have a portal that can be used to configure your VPN access. This is an easy to manage interface that can be set up once and configured on-the-fly. It automatically generates valid configuration files for your users to connect to the server, which can save a lot of headaches with explaining how to configure access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect Using your Android Device<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can download the openVPN application from google store : <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=net.openvpn.openvpn&amp;hl=en\">https:\/\/play.google.com\/store\/apps\/details?id=net.openvpn.openvpn&amp;hl=en<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect Using your PC<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To connect from your PC you will need <a href=\"https:\/\/openvpn.net\/client-connect-vpn-for-windows\/\">https:\/\/openvpn.net\/client-connect-vpn-for-windows\/<\/a> the installation is easy and straight forward.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VPN, or virtual private network, is a secure method of connecting remote internet resources as if they were under the same LAN. OpenVPN is a popular implementation that works on Linux, Windows, and Mac operating systems and can create complex, encrypted networks between physically dispersed servers.The OpenVPN Access Server is a solution built on top [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4424,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"%%post_title%%","_seopress_titles_desc":"","_seopress_robots_index":"","inline_featured_image":false,"footnotes":""},"categories":[73,75],"tags":[],"class_list":["post-4414","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting-tips-tricks","category-vps-cloud-hosting"],"_links":{"self":[{"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/posts\/4414","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/comments?post=4414"}],"version-history":[{"count":4,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/posts\/4414\/revisions"}],"predecessor-version":[{"id":4426,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/posts\/4414\/revisions\/4426"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/media\/4424"}],"wp:attachment":[{"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/media?parent=4414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/categories?post=4414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemfreaks.com\/blog\/wp-json\/wp\/v2\/tags?post=4414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}