<?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>Full HeartDisk &#187; Setup openvpn</title>
	<atom:link href="http://www.lewiverdatama.com/tag/setup-openvpn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.lewiverdatama.com</link>
	<description>repository of my ideas!</description>
	<lastBuildDate>Wed, 30 Nov 2011 03:48:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setup OpenVPN Server</title>
		<link>http://www.lewiverdatama.com/tutorial/setup-openvpn-server</link>
		<comments>http://www.lewiverdatama.com/tutorial/setup-openvpn-server#comments</comments>
		<pubDate>Sat, 10 Jul 2010 14:53:32 +0000</pubDate>
		<dc:creator>Lewi Verdatama</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Setup openvpn]]></category>

		<guid isPermaLink="false">http://www.lewiverdatama.com/?p=192</guid>
		<description><![CDATA[After learning from various sources, i finally resolve all my problems regarding openvpn setup and its management. I&#8217;m not gonna using openvpn access server from openvpn.net which only gives license for 2 users (free license). So, i will manually create it from SSH Shell/terminal on my VPS. You can follow my step-by-step tutorial below, You [...]]]></description>
			<content:encoded><![CDATA[<p>After learning from various sources, i finally resolve all my problems regarding openvpn setup and its management. I&#8217;m not gonna using openvpn access server from <strong>openvpn.net</strong> which only gives license for 2 users (free license). So, i will manually create it from SSH Shell/terminal on my VPS.</p>
<p>You can follow my step-by-step tutorial below,<span id="more-192"></span></p>
<p>You need <a href="http://dl.bitvise.com/Tunnelier-Inst.exe"><strong>Tunnelier</strong></a> for this tutorial! Download it and install! I&#8217;m using CentOS 5 64bit for this tutorial..</p>
<p>first step is to make sure that tun/tap are enabled.</p>
<pre class="brush:bash">ls -al /dev/net/tun</pre>
<p>if you see that the status is yellow then it&#8217;s mean has been enabled, so go to next step.</p>
<pre class="brush:bash">wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
yum install openvpn</pre>
<p>Then we will setup openvpn client from here..</p>
<pre class="brush:bash">cp -r /usr/share/doc/openvpn-2.0.9/easy-rsa/ /etc/openvpn/
cd /etc/openvpn/easy-rsa/2.0
chmod 755 *
source ./vars
./vars
./clean-all
./build-ca
</pre>
<p>you&#8217;ll be ordered to fill some question, you can fill with whatever you want, but i suggest you to only fill the common name only.<br />
fill the common name with hostname: <strong>name.yourdomain.com</strong><br />
usually the character limit only 6 chars, so better you write down your hostname on notepad and copy/paste to the terminal.</p>
<pre class="brush:bash">./build-key-server server</pre>
<p>you need to fill the form just like before, but now fill the common name with &#8220;<strong>server</strong>&#8221; (without quote)<br />
please empty the challange pass, it will confuse you if you fill it because it will require you to double password.<br />
fill all with Y.</p>
<pre class="brush:bash">./build-dh</pre>
<p>now go to the openvpn directory!</p>
<pre class="brush:bash">cd /etc/openvpn</pre>
<p>check what files exist on that directory.</p>
<pre class="brush:bash">ls</pre>
<p>now edit the server.conf</p>
<pre class="brush:bash">vim server.conf</pre>
<p>if you have no <strong><em>nano/vim</em></strong> text editor, so install it first!</p>
<pre class="brush:bash">yum install nano
yum install vim</pre>
<p>edit the content of <strong>server.conf</strong> like below:</p>
<pre class="brush:bash">local YOUR.IP.PUT.HERE
port YOURPORT
proto udp
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
#-ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 4.2.2.1"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3
;crl-verify /etc/openvpn/easy-rsa/2.0/keys/crl.pem</pre>
<p>now start the openvpn service!</p>
<pre class="brush:bash">service openvpn start</pre>
<p>Now enable ipforward and make a new rules for NAT iptables so you can browse the internet using your VPN</p>
<pre class="brush:bash">echo 1 > /proc/sys/net/ipv4/ip_forward</pre>
<p>To enable NAT, make sure you using VPS or DS, if you using OpenVZ, here&#8217;s the command:</p>
<pre class="brush:bash">iptables -t nat -A POSTROUTING -s 1.2.3.0/24  -j SNAT --to YOUR.IP.PUT.HERE</pre>
<p>and if you use DS or XEN, here&#8217;s the command:</p>
<pre class="brush:bash">iptables -t nat -A POSTROUTING -s 1.2.3.0/24 -o eth0 -j MASQUERADE</pre>
<p>Now create the client certificate:</p>
<pre class="brush:bash">cd /etc/openvpn/easy-rsa/2.0
source ./vars
./vars
./build-key yourclientname</pre>
<p>download the <strong>ca.crt</strong> and the <strong>client.crt</strong> also <strong>client.key</strong> on <strong>/etc/openvpn/easy-rsa/2.0/keys</strong> , use your SFTP and download them all, after that, put them to <strong>C:\Program Files\OpenVPN\config</strong></p>
<p>If done, make the config ovpn for client,<br />
create new file using notepad named <strong>yourclientname.ovpn</strong> and don&#8217;t forget to save as <strong>.ovpn</strong><br />
the content:</p>
<pre class="brush:bash">client
dev tun
proto udp
remote YOUR.IP.PUT.HERE YOURPORT
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ca ca.crt
cert yourclientname.crt
key yourclientname.key
;auth-user-pass
comp-lzo
verb 3</pre>
<p>don&#8217;t forget to put your IP with replacing the &#8220;<strong><em>YOUR.IP.PUT.HERE</em></strong>&#8221; with your IP!<br />
put the file <strong>.ovpn</strong> to folder config like the <strong>ca.crt</strong> before, then running the openvpn gui<br />
don&#8217;t forget to disconnect the SSH terminal first!</p>
<p><strong>NOTE:</strong><br />
For Windows 7 client, go to <strong>C:\Program Files\OpenVPN\bin\</strong><br />
right click the <strong>openvpn-gui-1.0.3.exe</strong>, then choose &#8220;<strong><em>Run as Administrator</em></strong>&#8221;</p>
<p><em>credit to <a href="http://vpn4free.org">2298</a>, <a href="http://vpnsolution.org">oiseng</a>, <a href="http://enyong.com">oner</a>, and <a href="http://paijrut.net">paijrut</a> for helping me out!</em>
<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.lewiverdatama.com%2Ftutorial%2Fsetup-openvpn-server&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=segoe ui&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:23px"></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://www.lewiverdatama.com/tutorial/setup-openvpn-server/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

