<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenVPN &#8211; Hostry Help Center</title>
	<atom:link href="https://help.hostry.com/article-tags/openvpn/feed/" rel="self" type="application/rss+xml" />
	<link>https://help.hostry.com</link>
	<description>Full information on how to use HOSTRY, provided by 24/7 community based support</description>
	<lastBuildDate>Tue, 01 Dec 2020 08:18:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.13</generator>

<image>
	<url>https://help.hostry.com/wp-content/uploads/cache/2021/01/cropped-apple-icon-180x180-1/836712163.png</url>
	<title>OpenVPN &#8211; Hostry Help Center</title>
	<link>https://help.hostry.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Configure OpenVPN on Debian &#038; Ubuntu</title>
		<link>https://help.hostry.com/knowledge-base/how-to-configure-openvpn-on-debian-ubuntu/</link>
					<comments>https://help.hostry.com/knowledge-base/how-to-configure-openvpn-on-debian-ubuntu/#comments</comments>
		
		<dc:creator><![CDATA[Paul Harris]]></dc:creator>
		<pubDate>Tue, 20 Aug 2019 14:07:22 +0000</pubDate>
				<guid isPermaLink="false">https://help.hostry.com/?post_type=ht_kb&#038;p=532</guid>

					<description><![CDATA[Install OpenPNV and easy-rsa packages user@localhost:~$ sudo apt updateuser@localhost:~$ sudo apt install openvpn easyrsa Basic configuration Configuration file Copy the example from the documentation folder user@localhost:~$ sudo cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn Go to the program settings folder user@localhost:~$ cd /etc/openvpn Open the main configuration file in a text editor user@localhost:~$ sudo [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 id="install-openpnv-and-easy-rsa-packages" >Install OpenPNV and easy-rsa packages</h2>



<p><code>user@localhost:~$ sudo apt update<br>user@localhost:~$ sudo apt install openvpn easyrsa</code></p>



<h2 id="basic-configuration" ><strong>Basic configuration </strong></h2>



<ul><li>Configuration file</li></ul>



<p>Copy the example from the documentation folder</p>



<p><code>user@localhost:~$ sudo cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn</code></p>



<p>Go to the program settings folder</p>



<p><code>user@localhost:~$ cd /etc/openvpn</code></p>



<p>Open the main configuration file in a text editor</p>



<p><code>user@localhost:~$ sudo nano server.conf</code></p>



<p>Set the dh parameter pointing to the file<strong> &#8216;/etc/openvpn/dh.pem&#8217;</strong></p>



<p><code>dh /etc/openvpn/dh.pem </code></p>



<p>After, you need to find the line:</p>



<p><code>;push redirect-gateway def1 bypass-dhcp "</code></p>



<p>Then uncomment it</p>



<p><code>push redirect-gateway def1 bypass-dhcp</code></p>



<p>Find the <strong>user</strong> parameter and set its value to<strong> nobody</strong>:</p>



<p><code><strong>user</strong> nobody</code></p>



<p>The same thing with the group:</p>



<p><code><strong>group</strong> nobody</code></p>



<p>The paths to keys and certificates:</p>



<p><code><strong>ca        /etc/openvpn/ca.crt<br>cert      /etc/openvpn/server.crt<br>key       /etc/openvpn/server.key <br>tls-auth  /etc/openvpn/ta.key 0 </strong></code></p>



<ul><li>Generation of keys and certificates</li></ul>



<p><code>user@localhost:~$ mkdir -p ~/easy-rsa<br>user@localhost:~$ cp cp -rf /usr/share/easy-rsa/3.0.3/* ~/easy-rsa<br>user@localhost:~$ cd ~/easy-rsa</code></p>



<p><code>user@localhost:~$ ./easyrsa init-pki</code></p>



<p>A <strong>pki</strong> folder will be created with utility files in subdirectories</p>



<p><code>user@localhost:~$ ./easyrsa gen-dh</code></p>



<p>It will take some time and the file will be generated in the <strong>easy-rsa / pki / dh.pem folder</strong></p>



<p><code>user@localhost:~$ ./easyrsa build-ca</code></p>



<p>You will be asked for a new password for the private key of your root certificate. </p>



<p>Plese, enter the password and write it down in a safe place, this password will be requested every time that everyone else signs this certificate.</p>



<p><code>user@localhost:~$ ./easyrsa build-server-full server nopass<br>user@localhost:~$ ./easyrsa build-client-full client nopass</code></p>



<p><code>user@localhost:~$ sudo cp pki/ca.crt pki/dh.pem pki/private/server.key pki/issued/server.crt /etc/openvpn/<br>user@localhost:~$ sudo chown root /etc/openvpn/*</code></p>



<p><strong>Check the operability of the configuration</strong></p>



<p><code>user@localhost:~$ sudo openvpn /etc/openvpn/server.conf</code></p>



<p>We get something like this<strong> &#8220;exhaust&#8221;</strong></p>



<blockquote class="wp-block-quote"><p>Tue Aug 13 09:31:11 2019 OpenVPN 2.4.7 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019<br>Tue Aug 13 09:31:11 2019 Diffie-Hellman initialized with 2048 bit key<br>Tue Aug 13 09:31:11 2019 Outgoing Control Channel Authentication: Using 160 bit message hash &#8216;SHA1&#8217; for HMAC authentication<br>Tue Aug 13 09:31:11 2019 Incoming Control Channel Authentication: Using 160 bit message hash &#8216;SHA1&#8217; for HMAC authentication<br>Tue Aug 13 09:31:11 2019 ROUTE_GATEWAY 172.16.2.1/255.255.255.0 IFACE=eth0 HWADDR=52:54:00:10:3b:15<br>Tue Aug 13 09:31:11 2019 TUN/TAP device tun0 opened<br>Tue Aug 13 09:31:11 2019 TUN/TAP TX queue length set to 100<br>Tue Aug 13 09:31:11 2019 /sbin/ip link set dev tun0 up mtu 1500<br>Tue Aug 13 09:31:11 2019 /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2<br>Tue Aug 13 09:31:11 2019 /sbin/ip route add 10.8.0.0/24 via 10.8.0.2<br>Tue Aug 13 09:31:11 2019 Could not determine IPv4/IPv6 protocol. Using AF_INET<br>Tue Aug 13 09:31:11 2019 Socket Buffers: R=[212992-&gt;212992] S=[212992-&gt;212992]<br>Tue Aug 13 09:31:11 2019 UDPv4 link local (bound): [AF_INET][undef]:1194<br>Tue Aug 13 09:31:11 2019 UDPv4 link remote: [AF_UNSPEC]<br>Tue Aug 13 09:31:11 2019 MULTI: multi_init called, r=256 v=256<br>Tue Aug 13 09:31:11 2019 IFCONFIG POOL: base=10.8.0.4 size=62, ipv6=0<br>Tue Aug 13 09:31:11 2019 IFCONFIG POOL LIST<br>Tue Aug 13 09:31:11 2019 Initialization Sequence Completed</p></blockquote>



<p>Press <strong>Ctrl + C </strong>and interrupt the process</p>



<blockquote class="wp-block-quote"><p>Tue Aug 13 09:31:12 2019 event_wait : Interrupted system call (code=4)</p><p>Tue Aug 13 09:31:14 2019 /sbin/ip route del 10.8.0.0/24</p><p>Tue Aug 13 09:31:14 2019 Closing TUN/TAP interface</p><p>Tue Aug 13 09:31:14 2019 /sbin/ip addr del dev tun0 local 10.8.0.1 peer 10.8.0.2</p><p>Tue Aug 13 09:31:14 2019 SIGINT[hard,] received, process exiting</p></blockquote>



<p></p>



<p></p>



<p>We start <strong>OpenVPN</strong> as a service, systemd allows you to run individual configurations by entering a name through <strong>&#8216;@&#8217;</strong></p>



<p><code>user@localhost:~$ sudo systemctl start openvpn@server<br>user@localhost:~$ systemctl status openvpn@server</code></p>



<h2 id="open-port-1194-in-the-firewall" >Open port 1194 in the firewall</h2>



<p>If firewalld is active, we execute the commands</p>



<p><code>user@localhost:~$ sudo firewall-cmd --zone public --add-service=openvpn<br>user@localhost:~$ sudo firewall-cmd --runtime-to-permanent</code></p>



<p>For those who prefer iptables + netfilter-persistent before prohibiting rules, insert something like this</p>



<p>(It depends heavily on the current settings and before adding see what rules are already in <strong>iptables -nvL &#8211;line </strong>command)</p>



<p><code>user@localhost:~$ sudo iptables -I INPUT 4 -p tcp --dport 1194 -j ACCEPT user@localhost:~$ sudo service netfilter-persistent save</code></p>



<p>For those who chose nftables, we add the line in the<strong> /etc/nftables.conf</strong> file in the (chain) input chain before the prohibition rules</p>



<p><code>ip tcp dport 1194 accept</code></p>



<p>Reload the rules</p>



<p> On this, the basic setup on the server side can be considered complete</p>
]]></content:encoded>
					
					<wfw:commentRss>https://help.hostry.com/knowledge-base/how-to-configure-openvpn-on-debian-ubuntu/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
