{"id":16465,"date":"2022-04-02T05:24:33","date_gmt":"2022-04-02T05:24:33","guid":{"rendered":"https:\/\/linuxways.net\/?p=16465"},"modified":"2022-04-02T05:25:35","modified_gmt":"2022-04-02T05:25:35","slug":"how-to-setup-a-vpn-on-ubuntu","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-setup-a-vpn-on-ubuntu\/","title":{"rendered":"How to Setup a VPN on Ubuntu"},"content":{"rendered":"<p>A VPN abbreviated as Virtual Private Network enables a private network to be extended across a public network. It allows users to send and receive data as if their computer equipment were physically linked to the private network. For example, suppose you need to connect to your workplace&#8217;s local network while on a business trip. You&#8217;d find an internet connection (maybe at a motel) and then connect to your company&#8217;s VPN. Although it looks like you are directly linked to the network at work, you are connected to the network via the hotel&#8217;s internet connection. VPN connections are normally encrypted to prevent unauthenticated users from accessing the local network to which you&#8217;re connected.<\/p>\n<h2><strong>Methods to Setup a VPN on Ubuntu<\/strong><\/h2>\n<p>There are two ways in which you can set up a VPN on your Ubuntu:<\/p>\n<ul>\n<li>Setup VPN Using Command Line Method<\/li>\n<li>Setup VPN Using GUI (Graphical User Interface) Method<\/li>\n<\/ul>\n<p>A brief description of both approaches is detailed below:<\/p>\n<p>Method 1: Setup VPN Using Command Line Method<\/p>\n<p>The following are the steps involved in the installation and set-up of VPN in Ubuntu using the CLI method:<\/p>\n<h3>Step 1: Update System<\/h3>\n<p>To ensure that all your Ubuntu packages are up to date, update your operating system using the following command:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"693\" height=\"219\" class=\"wp-image-16466\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-2.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-2.png 693w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-2-300x95.png 300w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/p>\n<p>Then to upgrade your operating system, use the following command:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo apt upgrade<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"694\" height=\"136\" class=\"wp-image-16467\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-3.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-3.png 694w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-3-300x59.png 300w\" sizes=\"auto, (max-width: 694px) 100vw, 694px\" \/><\/p>\n<h3><strong><strong>Step 2: Check the IP Address<\/strong><\/strong><\/h3>\n<p>You can check your system&#8217;s IP address using the following command:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ ip addr show<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"325\" class=\"wp-image-16468\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-4.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-4.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-4-300x136.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<h3><strong>Step 3: Installation of OpenVPN<\/strong><\/h3>\n<p>You can install OpenVPN using the following command:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ wget https:\/\/ git.io\/vpn \u2013O openvpn-ubuntu-install.sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"565\" class=\"wp-image-16469\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-5.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-5.png 722w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-5-300x235.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p>Now we&#8217;ll use the \u201cchmod\u201d command to change the permissions on the script file:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ chmod \u2013v +x openvpn-ubuntu-install.sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"179\" class=\"wp-image-16470\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-6.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-6.png 723w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-6-300x74.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/p>\n<p>Then, using the following mentioned script file, install OpenVPN:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo .\/openvpn-ubuntu-install.sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"573\" class=\"wp-image-16471\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-7.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-7.png 729w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-7-300x236.png 300w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/p>\n<h3><strong>Step 4: Check Connection<\/strong><\/h3>\n<p>Run the following \u201cPing\u201d command to ping the OpenVPN server:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ ping \u2013c 4 10.8.0.1<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"197\" class=\"wp-image-16472\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-8.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-8.png 600w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-8-300x99.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h3><strong>Step 5: Addition or removal of clients<\/strong><\/h3>\n<p>By using the following mentioned script file, you can either add or remove clients or revoke existing clients:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo .\/openvpn-ubuntu-install.sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"521\" class=\"wp-image-16473\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-9.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-9.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-9-300x217.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<h3><strong>Commands to start\/stop\/restart OpenVPN<\/strong><\/h3>\n<p>Using the following mentioned command, you can start OpenVPN:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo systemctl start <\/strong><a href=\"mailto:openvpn@server.service\"><strong>openvpn@server.service<\/strong><\/a><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Using the following mentioned command, you can stop OpenVPN:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo systemctl stop <\/strong><a href=\"mailto:openvpn@server.service\"><strong>openvpn@server.service<\/strong><\/a><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Using the following command, you can restart OpenVPN:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo systemctl restart <\/strong><a href=\"mailto:openvpn@server.service\"><strong>openvpn@server.service<\/strong><\/a><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Using the following mentioned command, you can display the status of OpenVPN:<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo systemctl status <\/strong><a href=\"mailto:openvpn-server@server.service\"><strong>openvpn-server@server.service<\/strong><\/a><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"514\" class=\"wp-image-16474\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-10.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-10.png 726w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/text-description-automatically-generated-10-300x212.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><\/p>\n<h2><strong>Method 2: Setup VPN Using GUI Method<\/strong><\/h2>\n<p>The following are the steps involved in the installation and set-up of VPN in Ubuntu using the CLI method:<\/p>\n<h3><strong>Step 1: Settings Icon<\/strong><\/h3>\n<p>Open the Ubuntu Activities (depicted by a nine-dot symbol) in the left corner of the screen, then seek for and select the &#8220;Settings&#8221; option:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"239\" class=\"wp-image-16475\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-1.png\" alt=\"Graphical user interface, application Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-1.png 457w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-1-300x157.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/p>\n<h3><strong>Step 2: Network Icon<\/strong><\/h3>\n<p>After tapping the &#8220;settings&#8221; button, the Network Settings Menu will appear. Go to &#8220;Network&#8221; in the settings options. To add a new VPN connection, click the Add button at the bottom of the left-hand list of VPN interfaces.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"733\" height=\"572\" class=\"wp-image-16476\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-text-application-email-2.png\" alt=\"Graphical user interface, text, application, email Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-text-application-email-2.png 733w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-text-application-email-2-300x234.png 300w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/p>\n<h3><strong>Step 3: Choose a VPN<\/strong><\/h3>\n<p>After clicking on the &#8220;+&#8221; option, select the type of VPN connection you have among the list of VPN connections. In my case, I&#8217;m choosing an OpenVPN connection:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"557\" class=\"wp-image-16477\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-2.png\" alt=\"Graphical user interface, application Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-2.png 727w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-description-2-300x230.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/p>\n<h3><strong>Step 4: Add VPN<\/strong><\/h3>\n<p>After selecting the VPN, add details about the VPN. Once you&#8217;ve completed filling out the VPN connection details, click Add:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"581\" class=\"wp-image-16478\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-website-de.png\" alt=\"Graphical user interface, application, website Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-website-de.png 728w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-website-de-300x239.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/graphical-user-interface-application-website-de-150x120.png 150w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/p>\n<p>You can see that after setting up the information, the connection is being added. All you have to do is turn it &#8220;on&#8221; to connect to the VPN. You may be required to enter a password before the connection is established. After entering the password, you will be able to connect to the VPN. Again, to remove the VPN, you can switch the button off.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>This article provides a basic understanding of VPNs and how they work. This article also covers the two distinct methods for setting up VPN in Ubuntu Linux. These methods include command line and graphical user interface (GUI) approaches. In addition, the CL method includes several commands that can be used to set up a VPN in Ubuntu.<\/p>","protected":false},"excerpt":{"rendered":"<p>A VPN abbreviated as Virtual Private Network enables a private network to be extended across a public network. It allows users to send and receive data as if&hellip;<\/p>","protected":false},"author":1,"featured_media":16480,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[31,963],"class_list":["post-16465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-ubuntu","tag-vpn"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=16465"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16465\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/16480"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=16465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=16465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=16465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}