<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Openvpn – Yeri Tiete</title><link>https://yeri.be/tag/openvpn/</link><description>Yeri Tiete's blog</description><language>en</language><copyright>© Yeri Tiete</copyright><lastBuildDate>Fri, 26 Jun 2020 18:24:00 +0200</lastBuildDate><atom:link href="https://yeri.be/tag/openvpn/index.xml" rel="self" type="application/rss+xml"/><item><title>Ideal travel router: GL-AR750S</title><link>https://yeri.be/ideal-travel-router-gl-ar750s/</link><pubDate>Fri, 26 Jun 2020 18:24:00 +0200</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/ideal-travel-router-gl-ar750s/</guid><description>&lt;p&gt;Right. With the pandemic and all none of us are going to travel much but still...&lt;/p&gt;
&lt;p&gt;About a year ago I purchased myself an &lt;a class="aioseop-link" rel="noreferrer noopener" href="https://www.gl-inet.com/products/gl-ar750s/" target="_blank"&gt;OpenWRT router&lt;/a&gt; to use on the plane and in hotels.&lt;/p&gt;
&lt;p&gt;And so far I really like both the device and the Hong Kong based brand (launching new and updated products, and releasing relatively regular updates for older products). Pick a device that fits your needs (&lt;a href="https://www.gl-inet.com/products/gl-mt300n-v2/" target="_blank" rel="noreferrer noopener"&gt;USB powered&lt;/a&gt;? &lt;a href="https://www.gl-inet.com/products/gl-e750/" target="_blank" rel="noreferrer noopener"&gt;LTE&lt;/a&gt;? &lt;a href="https://www.gl-inet.com/products/vixmini/" target="_blank" rel="noreferrer noopener"&gt;Small form factor&lt;/a&gt;?). &lt;/p&gt;</description><content:encoded><![CDATA[<p>Right. With the pandemic and all none of us are going to travel much but still...</p>
<p>About a year ago I purchased myself an <a class="aioseop-link" rel="noreferrer noopener" href="https://www.gl-inet.com/products/gl-ar750s/" target="_blank">OpenWRT router</a> to use on the plane and in hotels.</p>
<p>And so far I really like both the device and the Hong Kong based brand (launching new and updated products, and releasing relatively regular updates for older products). Pick a device that fits your needs (<a href="https://www.gl-inet.com/products/gl-mt300n-v2/" target="_blank" rel="noreferrer noopener">USB powered</a>? <a href="https://www.gl-inet.com/products/gl-e750/" target="_blank" rel="noreferrer noopener">LTE</a>? <a href="https://www.gl-inet.com/products/vixmini/" target="_blank" rel="noreferrer noopener">Small form factor</a>?). </p>
<p>The GL-AR750S aka Slate is fully customizable but runs a few nice things out of the box: <a href="https://yeri.be/wireguard" target="_blank" rel="noreferrer noopener">WireGuard</a> (with a physical button to turn it on or off), <a href="https://yeri.be/tag/openvpn" target="_blank" rel="noreferrer noopener">OpenVPN</a>, shell access, Tor (requires the latest firmware), <a href="https://yeri.be/tag/ipv6" target="_blank" rel="noreferrer noopener">IPv6</a>, <a href="https://en.wikipedia.org/wiki/DNS_over_HTTPS" target="_blank" rel="noreferrer noopener">DoH</a> (<a href="https://web.archive.org/web/20210827100952/https://developers.cloudflare.com/1.1.1.1/dns-over-https" target="_blank" rel="noreferrer noopener">Cloudflare</a> only for now), multiple SSIDs (i.e. Guest WiFi), and more. </p>
<p>Oh and I specifically picked this version (compared to <a href="https://www.gl-inet.com/products/" target="_blank" rel="noreferrer noopener">other or cheaper ones</a>) because it had both 2.4Ghz and 5Ghz, as well as 3 Gbit ports (1x WAN, 2x LAN).</p>
<div class="wp-block-image"><figure class="aligncenter size-large"><a href="https://static.yeri.be/2020/06/glinet-compare-1.png" target="_blank" rel="noopener noreferrer"><img src="https://static.yeri.be/2020/06/glinet-compare-1-1024x694.png" alt="" class="wp-image-9088"/></a><figcaption>Pick whatever works for you...</figcaption></figure></div>
<p>I use the device on flights, where I connect to the network once in the air, purchase WiFi or use <a href="https://www.ipass.com/inflight-internet/" target="_blank" rel="noreferrer noopener">iPass</a> "for one device" and then connect to the interwebs behind my <a href="https://en.wikipedia.org/wiki/Network_address_translation" target="_blank" rel="noreferrer noopener">NAT</a>-router from my iPad, phone(s), laptop(s), and even <a href="https://yeri.be/shan-wong-sketching" title="Shan Wong sketching" target="_blank" rel="noreferrer noopener">Shan</a>'s devices if she is travelling with me.</p>
<p>In hotels, I either connect it to the wired ethernet, if still available (tends to be more stable), or connect it to the guest WiFi and then connect my devices to the router: saves me from connecting to a new network and typing the room number and login/password/family name on every device. And once again hides the true number of connected devices; quite handy trick for those pesky hotels providing free access only to two devices.</p>
<p>Sure it takes a bit of setup every time: find a working USB port, sign in to the web interface, search for new networks if this is a new hotel or I haven't travelled on this airline, connect to said network, sign in with iPass, and optionally enable VPN)...</p>
<p>And once in a while some fiddling with VPN or DNS that's borking up or being blocked by overzealous firewalls. </p>
<p>Also, some in-flight entertainment USB ports don't provide enough power (and/or are often broken -- looking at you Lufthansa in economy) so be sure to carry <a href="https://www.apple.com/shop/product/MD810LL/A/apple-5w-usb-power-adapter?fnode=83f41015933a91450d5764c4af01b7dcde6df42b8f2bd3d69b5785e0ebe48054e25d0a20aee428acbd11aa75bf2c77677833fecc12d57e28996bdafa64dfb0a43baa67bb1e79a1e51318f290bc482600cab20f21c35e5c95c94188846e9c860c366a443744dd092235bfa2928b330b8f&amp;fs=fh%3D458e%252B45d4" target="_blank" rel="noreferrer noopener nofollow sponsored">a couple of these</a> (US-plug works best) -- I've already forgotten one on my last flight from <a href="https://my.flightradar24.com/Tuinslak" target="_blank" rel="noreferrer noopener">MUC-SIN</a> on LH, but luckily I have pretty easy access to these. </p>
<p>If you travel a lot it's totally worth the money.</p>
]]></content:encoded><category>Hardware</category><category>Linux</category><category>Networking</category><category>Software</category><category>china</category><category>openvpn</category><category>openwrt</category><category>router</category><category>wifi</category><category>wireguard</category></item><item><title>Graph amount of OpenVPN users to Munin</title><link>https://yeri.be/graph-amount-of-openvpn-users-to-munin/</link><pubDate>Wed, 24 Jul 2013 11:08:20 +0200</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/graph-amount-of-openvpn-users-to-munin/</guid><description>&lt;p&gt;Rather simple script. Using log file instead of management interface.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;a href="https://static.yeri.be/2013/07/vpnusers-day.png"&gt;&lt;/a&gt;&lt;a href="https://static.yeri.be/2013/07/vpnusers-day.png"&gt;&lt;img class="alignnone size-full wp-image-5160" alt="vpnusers-day" src="https://static.yeri.be/2013/07/vpnusers-day.png" width="497" height="292" /&gt;&lt;/a&gt;&lt;/p&gt;
Part has to run as Root (due to Munin most likely not having access to read the log files. Working with the management interface could solve this.
&lt;p&gt;Create &lt;strong&gt;/usr/local/bin/getVpnUsers.sh&lt;/strong&gt;:&lt;/p&gt;
&lt;pre&gt;#!/bin/bash
echo "VPN.value `cat /var/log/openvpn-status.log | sed -e '1,/Common Name/d' | 
sed -e '/ROUTING TABLE/,$d' | wc -l`" &amp;gt; /tmp/.vpn_munin.txt&lt;/pre&gt;
&lt;p&gt;You can change the name of VPN.value to the VPN name and/or add multiple lines (each with a different NAME.value if you&amp;rsquo;re running more than one VPN user. Be sure to cat the right log file).&lt;/p&gt;</description><content:encoded><![CDATA[<p>Rather simple script. Using log file instead of management interface.</p>
<p style="text-align: center;"><a href="https://static.yeri.be/2013/07/vpnusers-day.png"></a><a href="https://static.yeri.be/2013/07/vpnusers-day.png"><img class="alignnone size-full wp-image-5160" alt="vpnusers-day" src="https://static.yeri.be/2013/07/vpnusers-day.png" width="497" height="292" /></a></p>
Part has to run as Root (due to Munin most likely not having access to read the log files. Working with the management interface could solve this.
<p>Create <strong>/usr/local/bin/getVpnUsers.sh</strong>:</p>
<pre>#!/bin/bash
echo "VPN.value `cat /var/log/openvpn-status.log | sed -e '1,/Common Name/d' | 
sed -e '/ROUTING TABLE/,$d' | wc -l`" &gt; /tmp/.vpn_munin.txt</pre>
<p>You can change the name of VPN.value to the VPN name and/or add multiple lines (each with a different NAME.value if you&rsquo;re running more than one VPN user. Be sure to cat the right log file).</p>
<p>And:</p>
<pre>chmod +x /usr/local/bin/getVpnUsers.sh</pre>
<p>Add this to root cron:</p>
<pre>*/5 * * * * /usr/local/bin/getVpnUsers.sh &gt;/dev/null 2&gt;&amp;1</pre>
<p>Now create<strong> /etc/munin/plugins/vpnusers</strong>:</p>
<pre>#!/bin/sh

case $1 in
 config)
 cat &lt;&lt;'EOM'
graph_category network
graph_title oVPN users
graph_vlabel users
VPN.label My oVPN
# add more labels like this:
#isazi.label Isazi VPN
EOM
 exit 0;;
esac

cat /tmp/.vpn_munin.txt</pre>
<p>And:</p>
<pre>chmod +x /etc/munin/plugins/vpnusers</pre>
<p>You&rsquo;ll need the correct NAME.label in the plugin depending on the name you choose in part one.</p>
<p>And restart munin-node:</p>
<pre>/etc/init.d/munin-node restart</pre>
<p>That&rsquo;s it.</p>
<p>Check your Munin under &ldquo;network&rdquo;. It might take ~15+ minutes before the graph is generated.</p>
<p><a href="https://static.yeri.be/2013/07/vpnusers-day-1.png"><img class="alignnone size-full wp-image-5161 aligncenter" alt="vpnusers-day-1" src="https://static.yeri.be/2013/07/vpnusers-day-1.png" width="497" height="280" /></a></p>
]]></content:encoded><category>Linux</category><category>munin</category><category>openvpn</category></item><item><title>OpenVPN: Can't assign requested address</title><link>https://yeri.be/openvpn-cant-assign-requested-address/</link><pubDate>Tue, 12 Feb 2013 13:17:22 +0100</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/openvpn-cant-assign-requested-address/</guid><description>&lt;p&gt;For no clear reason, OpenVPN on Mac with Tunnelblick (any version, had this problem for a few years already) results in these kind of error messages (and refuses to connect):&lt;/p&gt;
&lt;pre&gt;2013-02-05 17:44:31 write UDPv4: Can't assign requested address (code=49)
2013-02-05 17:44:33 write UDPv4: Can't assign requested address (code=49)&lt;/pre&gt;
&lt;p&gt;This seems to appear more often when swapping WiFi/IP range (after my Mac goes into sleep). But also happens when connecting to the same WiFi. It doesn&amp;rsquo;t change anything whether I disconnect OpenVPN before putting the Mac to sleep.&lt;/p&gt;</description><content:encoded><![CDATA[<p>For no clear reason, OpenVPN on Mac with Tunnelblick (any version, had this problem for a few years already) results in these kind of error messages (and refuses to connect):</p>
<pre>2013-02-05 17:44:31 write UDPv4: Can't assign requested address (code=49)
2013-02-05 17:44:33 write UDPv4: Can't assign requested address (code=49)</pre>
<p>This seems to appear more often when swapping WiFi/IP range (after my Mac goes into sleep). But also happens when connecting to the same WiFi. It doesn&rsquo;t change anything whether I disconnect OpenVPN before putting the Mac to sleep.</p>
<p>The solution I&rsquo;ve found to solve this is:</p>
<ol>
	<li><span style="line-height: 13px;">Disconnect OpenVPN (via Tunnelblick)</span></li>
	<li>Turn off WiFi</li>
	<li>Run the script I've attached below (flush.sh)</li>
	<li>Fill in your admin/sudo password</li>
	<li>Hit ctrl+C if it doesn't exit instantly (happens in 99% of the cases)</li>
	<li>Run the script once or twice more to be sure, it will exit correctly this time</li>
	<li>Reconnect to the WiFi</li>
	<li>Reconnect OpenVPN (via Tunnelblick): this time it will work</li>
</ol>
The script (name it flush.sh, chmod +x, and run ./flush.sh via Terminal):
<p><span style="text-decoration: underline;">Edit</span>: updated script (29/01/2014)</p>
<pre>#!/bin/bash
# Change IFACE to match your WiFi interface 
# (en0 on Macbook Air and Retina, en1 on old Macbook Pros with ethernet) 
IFACE=en0
sudo ifconfig $IFACE down
sudo route flush
sudo ifconfig $IFACE up</pre>
<p>In case the script hangs (sometimes, route flush hangs): hit ctrl+C, and execute it again.</p>
]]></content:encoded><category>Apple</category><category>Errors</category><category>Linux</category><category>Networking</category><category>Software</category><category>bash</category><category>openvpn</category></item><item><title>OpenVPN packet drops</title><link>https://yeri.be/openvpn-packet-drops/</link><pubDate>Mon, 08 Mar 2010 17:22:35 +0100</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/openvpn-packet-drops/</guid><description>&lt;p&gt;I recently started to notice following error messages on my openVPN server.&lt;/p&gt;
&lt;address&gt;ovpn-server[6306]: vpn.rootspirit.com/85.234.x.y:62068 MULTI: packet dropped due to output saturation (multi_process_incoming_tun)&lt;/address&gt;This basically means that the TUN or TAP interface is making more packets than the real (TCP) interface can handle.
&lt;p&gt;As I need to run OpenVPN using the TCP protocol (instead of the faster UDP protocol; as UDP is often blocked in networks I use my VPN in) I experimented by increasing the tcp-queue-limit. The default is 64, and I&amp;rsquo;ve set it to 256. So far, everything still seems to be working fine (but more packets will be queued before being dropped by OpenVPN, requiring less retransmissions).&lt;/p&gt;</description><content:encoded><![CDATA[<p>I recently started to notice following error messages on my openVPN server.</p>
<address>ovpn-server[6306]: vpn.rootspirit.com/85.234.x.y:62068 MULTI: packet dropped due to output saturation (multi_process_incoming_tun)</address>This basically means that the TUN or TAP interface is making more packets than the real (TCP) interface can handle.
<p>As I need to run OpenVPN using the TCP protocol (instead of the faster UDP protocol; as UDP is often blocked in networks I use my VPN in) I experimented by increasing the tcp-queue-limit. The default is 64, and I&rsquo;ve set it to 256. So far, everything still seems to be working fine (but more packets will be queued before being dropped by OpenVPN, requiring less retransmissions).</p>
<p>Add this to the OpenVPN server config:</p>
<address>tcp-queue-limit 256</address>And restart the daemon.
]]></content:encoded><category>Errors</category><category>Linux</category><category>Networking</category><category>Software</category><category>openvpn</category><category>vpn</category></item><item><title>OpenVPN &amp; Windows 7</title><link>https://yeri.be/openvpn-windows-7/</link><pubDate>Sun, 14 Feb 2010 17:10:11 +0100</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/openvpn-windows-7/</guid><description>&lt;p&gt;There&amp;rsquo;s a great GUI out for OpenVPN &amp;amp; Windows, located &lt;a href="http://openvpn.se/download.html" target="_blank" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, this GUI includes an old OpenVPN, that is no longer compatible with Windows 7 and Windows Vista.&lt;/p&gt;
&lt;p&gt;The TUN/TAP driver will be blocked due to compatibility issues, and when trying to connect to a VPN, you&amp;rsquo;ll get an error along the lines of:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;All TAP-Win32 adapters on this system are currently in use&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The simplest fix, is to install the GUI package (including the old OpenVPN binaries), and reinstall OpenVPN afterwards.&lt;/p&gt;</description><content:encoded><![CDATA[<p>There&rsquo;s a great GUI out for OpenVPN &amp; Windows, located <a href="http://openvpn.se/download.html" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>However, this GUI includes an old OpenVPN, that is no longer compatible with Windows 7 and Windows Vista.</p>
<p>The TUN/TAP driver will be blocked due to compatibility issues, and when trying to connect to a VPN, you&rsquo;ll get an error along the lines of:</p>
<p><code>All TAP-Win32 adapters on this system are currently in use</code></p>
<p>The simplest fix, is to install the GUI package (including the old OpenVPN binaries), and reinstall OpenVPN afterwards.</p>
<p>You can find the latest OpenVPN binaries <a href="https://web.archive.org/web/20170607163358/https://openvpn.net/release/" target="_blank" rel="noopener noreferrer">here</a> and the latest version, when writing this post <a href="https://web.archive.org/web/20170607163358/https://openvpn.net/release/" target="_blank" rel="noopener noreferrer">here</a>.</p>
<p>This will overwrite the old files and update the driver with a Windows 7 compatible driver.</p>
<p>Try to connect now, everything should work like a charm. :)</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">http://openvpn.se/download.html</div>
]]></content:encoded><category>Errors</category><category>Networking</category><category>Software</category><category>Windows</category><category>openvpn</category><category>vpn</category><category>windows 7</category></item><item><title>OpenVPN Linux + Mac howto</title><link>https://yeri.be/openvpn-linux-mac-howto/</link><pubDate>Sun, 05 Jul 2009 05:14:01 +0200</pubDate><author>Yeri Tiete</author><guid isPermaLink="true">https://yeri.be/openvpn-linux-mac-howto/</guid><description>&lt;p&gt;A short howto, as I was unable to find any clear ones on the net.&lt;/p&gt;
&lt;p style="text-align: left;"&gt;I'm using Mac OS X (Leopard) as client, and a &lt;a href="http://home.tiete.be" target="_blank" rel="noopener"&gt;Gentoo server&lt;/a&gt; as server/host.&lt;/p&gt;
&lt;p style="text-align: left;"&gt;I both tried &lt;a href="http://www.viscosityvpn.com/" target="_blank" rel="noopener"&gt;Viscosity&lt;/a&gt; and &lt;a href="https://tunnelblick.net/" target="_blank" rel="noopener"&gt;Tunnelblick&lt;/a&gt; on my Mac as OpenVPN software, and Viscosity is probably somewhat easier to configure (using the GUI), it was shareware. So I ended up using Tunnelblick and it seems to be doing its job quite well.&lt;/p&gt;
&lt;p style="text-align: left;"&gt;First of all, make sure Gentoo is set up and working as intended. I used my home router as VPN server (having both eth0 and eth1 (= ppp0).&lt;/p&gt;</description><content:encoded><![CDATA[<p>A short howto, as I was unable to find any clear ones on the net.</p>
<p style="text-align: left;">I'm using Mac OS X (Leopard) as client, and a <a href="http://home.tiete.be" target="_blank" rel="noopener">Gentoo server</a> as server/host.</p>
<p style="text-align: left;">I both tried <a href="http://www.viscosityvpn.com/" target="_blank" rel="noopener">Viscosity</a> and <a href="https://tunnelblick.net/" target="_blank" rel="noopener">Tunnelblick</a> on my Mac as OpenVPN software, and Viscosity is probably somewhat easier to configure (using the GUI), it was shareware. So I ended up using Tunnelblick and it seems to be doing its job quite well.</p>
<p style="text-align: left;">First of all, make sure Gentoo is set up and working as intended. I used my home router as VPN server (having both eth0 and eth1 (= ppp0).</p>
<p style="text-align: left;">Using this <a href="http://forums.gentoo.org/viewtopic-p-5849651.html" target="_blank" rel="noopener">howto</a>, you'll be able to get the server up and running.</p>
<p style="text-align: left;">Besides the installation, and perhaps (config) file locations it should be pretty similar on other Linux distros.</p>
<p style="text-align: left;">As I have dnsmasq running on my server (taking care of DNS) I added the following to the server.conf:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">push <span class="s2">&#34;dhcp-option DNS 10.0.0.1&#34;</span>
</span></span><span class="line"><span class="cl">push <span class="s2">&#34;redirect-gateway def1&#34;</span>
</span></span><span class="line"><span class="cl">client-config-dir ccd
</span></span><span class="line"><span class="cl">route 10.20.30.0 255.255.255.252
</span></span></code></pre></div><p>Don&rsquo;t forget to allow DNS requests over tun0 interface in dnsmasq.conf.</p>
<p>The first line tells the server to hand out 10.0.0.1 as DNS server to its connecting clients (10.0.0.1 being the internal eth0 IP of my server).</p>
<p>The 2nd line, tells all clients to route ALL of their traffic through the VPN. I used the VPN to access a website that allowed only Belgian IPs, and I was in The Netherlands at the time I had to access the site (Skynet&rsquo;s Rock Werchter stream). So I connected through my server at home.</p>
<p>And the 3rd and 4th line are needed if the client access the VPN is on a private IP subnet (like being connected on a WiFi router, using IP 192.168.178.x).</p>
<p>You&rsquo;ll have to add, in the client-config directory a file per username connecting to the VPN with something similar to this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iroute 192.168.178.0 255.255.255.0
</span></span></code></pre></div><p>I&rsquo;m not entirely sure if you can add multiple iroutes; something I&rsquo;ll have to figure out when being on a different network.</p>
<p>This is what my client config looks like (vpn-server-name.conf, located in ~<em>/</em>Library/openvpn/):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">client
</span></span><span class="line"><span class="cl">dev tun
</span></span><span class="line"><span class="cl">proto udp
</span></span><span class="line"><span class="cl">remote home.tiete.be <span class="m">9000</span>
</span></span><span class="line"><span class="cl">resolv-retry infinite
</span></span><span class="line"><span class="cl">nobind
</span></span><span class="line"><span class="cl">tun-mtu <span class="m">1500</span>
</span></span><span class="line"><span class="cl">tun-mtu-extra <span class="m">32</span>
</span></span><span class="line"><span class="cl">mssfix <span class="m">1200</span>
</span></span><span class="line"><span class="cl">persist-key
</span></span><span class="line"><span class="cl">persist-tun
</span></span><span class="line"><span class="cl">ca <span class="s2">&#34;ca.crt&#34;</span>
</span></span><span class="line"><span class="cl">cert <span class="s2">&#34;yeri.crt&#34;</span>
</span></span><span class="line"><span class="cl">key <span class="s2">&#34;yeri.key&#34;</span>
</span></span><span class="line"><span class="cl">tls-auth <span class="s2">&#34;ta.key&#34;</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">comp-lzo
</span></span><span class="line"><span class="cl">verb <span class="m">3</span>
</span></span></code></pre></div><p>Yeri being my username. Don&rsquo;t forget to download and add the ca.crt, user.crt, user.key (located in /usr/share/openvpn/easy-rsa/keys/) and ta.key (located in /etc/openvpn/) you&rsquo;ve created on the server.</p>
<p>If your client asks for &ldquo;directions&rdquo;, pick 1.</p>
<p>Start up server and client software.</p>
<p>Hitting connect in Tunnelblick should connect you to the VPN server, and (in my case) giving me an IP similar to 10.20.30.6. You can check this using &ldquo;ifconfig&rdquo; in Terminal.</p>
<p>Client:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">tun0: <span class="nv">flags</span><span class="o">=</span><span class="m">8851</span> mtu <span class="m">1500</span>
</span></span><span class="line"><span class="cl">    inet 10.20.30.6 --&gt; 10.20.30.5 netmask 0xffffffff
</span></span><span class="line"><span class="cl">    open <span class="o">(</span>pid 20551<span class="o">)</span>
</span></span></code></pre></div><p>Server:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
</span></span><span class="line"><span class="cl">inet addr:10.20.30.1  P-t-P:10.20.30.2  Mask:255.255.255.255
</span></span><span class="line"><span class="cl">UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
</span></span><span class="line"><span class="cl">RX packets:407595 errors:0 dropped:0 overruns:0 frame:0
</span></span><span class="line"><span class="cl">TX packets:574351 errors:0 dropped:0 overruns:0 carrier:0
</span></span><span class="line"><span class="cl">collisions:0 txqueuelen:100
</span></span><span class="line"><span class="cl">RX bytes:27473209 <span class="o">(</span>26.2 MiB<span class="o">)</span>  TX bytes:603524377 <span class="o">(</span>575.5 MiB<span class="o">)</span>
</span></span></code></pre></div><p>Don&rsquo;t forget; when using &ldquo;tun&rdquo; as driver, your gateway/VPN server will always have the IP ending on .1 (e.g.: 10.20.30.1).</p>
<p>Now, if you want to route all traffic throug the VPN, like I did, you&rsquo;ll have to change some stuff in iptables (as the server is also acting as my home router, I already did have a few rules in it).</p>
<p>Allow all traffic through tun0 interface:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -A OUTPUT -o tun0 -j ACCEPT
</span></span><span class="line"><span class="cl">iptables -A INPUT -i tun0 -j ACCEPT
</span></span></code></pre></div><p>Allow traffic through the external port 9000 (UDP):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -A INPUT -i ppp0 -p udp -m udp --dport <span class="m">9000</span> -j ACCEPT
</span></span></code></pre></div><p>Enable forwarding and NAT:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -A FORWARD -s 10.20.30.0/24 -i tun0 -j ACCEPT
</span></span><span class="line"><span class="cl">iptables -A FORWARD -d 10.20.30.0/24 -i ppp0 -j ACCEPT
</span></span><span class="line"><span class="cl">iptables -A POSTROUTING -o ppp0 -j MASQUERADE
</span></span></code></pre></div><p>And lastly, as I have Squid running on my server, I want to transparently forward all port 80 requests to the Squid server running on port 8080:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">iptables -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport <span class="m">80</span> -j REDIRECT --to-ports <span class="m">8080</span>
</span></span></code></pre></div><p>That&rsquo;s about it. You should have a running VPN from your current location to your VPN server. And you&rsquo;re able to use it as a gateway.</p>
<p>You can always traceroute/tracepath to your VPN server (10.20.30.1). It should only find one hop.</p>
]]></content:encoded><category>Apple</category><category>Linux</category><category>Networking</category><category>Apple</category><category>Linux</category><category>gentoo</category><category>openvpn</category><category>vpn</category></item></channel></rss>