{"id":8453,"date":"2021-07-20T12:22:57","date_gmt":"2021-07-20T12:22:57","guid":{"rendered":"https:\/\/linuxways.net\/?p=8453"},"modified":"2021-07-20T12:22:57","modified_gmt":"2021-07-20T12:22:57","slug":"how-to-set-up-openvpn-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-set-up-openvpn-on-ubuntu-20-04\/","title":{"rendered":"How to Set Up OpenVPN on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>OpenVPN is open-source free software that implements a virtual private network(VPN) and helps you connect securely to an untrusted public network.<\/p>\n<p>It is very useful and provided under the GNU(GPL). VPN is really necessary for government offices and large businesses because it has very high security and privacy. Here we will show you how to deploy a virtual network using OpenVPN on Ubuntu 20.04.<\/p>\n<h2>Step 1 &#8211; Update system<\/h2>\n<p>Run apt command:<\/p>\n<pre>$ sudo apt update<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"288\" class=\"wp-image-8454\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-493.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-493.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-493-300x118.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>Then run:<\/p>\n<pre>$ sudo apt upgrade<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"92\" class=\"wp-image-8455\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-494.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-494.png 599w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-494-300x46.png 300w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/p>\n<h2>Step 2 &#8211; Find your IP address<\/h2>\n<p>Run ip command:<\/p>\n<pre>$ ip -4 a<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"927\" height=\"242\" class=\"wp-image-8456\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-495.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-495.png 927w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-495-300x78.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-495-768x200.png 768w\" sizes=\"auto, (max-width: 927px) 100vw, 927px\" \/><\/p>\n<p>The red part is your IP address then let\u2019s note it down.<\/p>\n<h2>Step 3 &#8211; Install openvpn-install<\/h2>\n<p>Let run the following command:<\/p>\n<pre>$ wget https:\/\/git.io\/vpn -O openvpn-ubuntu-install.sh<\/pre>\n<p>Now let\u2019s use chmod command to set access to script file:<\/p>\n<pre>$ chmod -v +x openvpn-ubuntu-install.sh<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"697\" height=\"62\" class=\"wp-image-8457\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-496.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-496.png 697w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-496-300x27.png 300w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p>Then, let\u2019s install OpenVPN by running openvpn-ubuntu-install.sh script file:<\/p>\n<pre>$ sudo .\/openvpn-ubuntu-install.sh<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"594\" class=\"wp-image-8458\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-497.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-497.png 704w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-497-300x253.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/p>\n<h2>Step 4 &#8211; Checking connection<\/h2>\n<p>Using ping command to ping to the OpenVPN server:<\/p>\n<pre>$ ping -c 4 10.8.0.1<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1274\" height=\"368\" class=\"wp-image-8459\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-498.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-498.png 1274w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-498-300x87.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-498-1024x296.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-498-768x222.png 768w\" sizes=\"auto, (max-width: 1274px) 100vw, 1274px\" \/><\/p>\n<p>If it appears like the picture, you have successfully connected.<\/p>\n<h2>Step 5 &#8211; Add or remove a new client<\/h2>\n<p>You must run openvpn-ubuntu-install.sh script file again:<\/p>\n<pre>$ sudo .\/openvpn-ubuntu-install.sh<\/pre>\n<p>Output <img loading=\"lazy\" decoding=\"async\" width=\"1568\" height=\"1052\" class=\"wp-image-8460\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499.png 1568w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499-300x201.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499-1024x687.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499-768x515.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-499-1536x1031.png 1536w\" sizes=\"auto, (max-width: 1568px) 100vw, 1568px\" \/><\/p>\n<h2>How to start \/ stop \/ restart the OpenVPN server?<\/h2>\n<p>To start, run:<\/p>\n<pre>$ sudo systemctl start openvpn@server.service<\/pre>\n<p>To restart, run:<\/p>\n<pre>$ sudo systemctl restart openvpn@server.service<\/pre>\n<p>To stop, run:<\/p>\n<pre>$ sudo systemctl stop openvpn@server.service<\/pre>\n<p>To display status, run:<\/p>\n<pre>$ sudo systemctl status openvpn-server@server.service<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1626\" height=\"390\" class=\"wp-image-8461\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500.png 1626w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500-300x72.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500-1024x246.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500-768x184.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/07\/word-image-500-1536x368.png 1536w\" sizes=\"auto, (max-width: 1626px) 100vw, 1626px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve already gone through the details of how to set up OpenVPN on Ubuntu 20.04.<\/p>\n<p>Thanks for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction OpenVPN is open-source free software that implements a virtual private network(VPN) and helps you connect securely to an untrusted public network. It is very useful and provided&hellip;<\/p>","protected":false},"author":1,"featured_media":8619,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[429,100],"class_list":["post-8453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-openvpn","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8453","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=8453"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/8453\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/8619"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=8453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=8453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=8453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}