<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=2142&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / openvpn server and client on same box]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=2142</link>
		<description><![CDATA[The most recent posts in openvpn server and client on same box.]]></description>
		<lastBuildDate>Wed, 20 Jun 2018 21:34:42 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10269#p10269</link>
			<description><![CDATA[<div class="quotebox"><cite>ralph.ronnquist wrote:</cite><blockquote><div><p>Gems of knowledge into my sea of ignorance .. I hope the OP gets to mark this as solved soon.</p></div></blockquote></div><p>Sorry, i hate coming across as a smartass <img src="https://dev1galaxy.org/img/smilies/sad.png" width="15" height="15" alt="sad" /> Anyways, i also hope there will be a satisfying solution.</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Wed, 20 Jun 2018 21:34:42 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10269#p10269</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10254#p10254</link>
			<description><![CDATA[<p>Gems of knowledge into my sea of ignorance .. I hope the OP gets to mark this as solved soon.</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Wed, 20 Jun 2018 00:10:35 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10254#p10254</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10240#p10240</link>
			<description><![CDATA[<div class="quotebox"><cite>ralph.ronnquist wrote:</cite><blockquote><div><p>There are probably many holes in my understanding, but isn&#039;t it so, that the server-vpn program already interacts on eth0 for handling its clients; so it&#039;s response packets are already outbound on eth0 without any routing?</p></div></blockquote></div><p>Well, not saying i am total expert here either. I&#039;ve done a bit of weird stuff like per user routing and so on but it&#039;s not like i deal with this on a regular basis. Still to my best knowledge the kernel doesn&#039;t care where a packet was received when sending a reply. It just goes by what the routing table says. The reply packets disappearing from eth0 as soon as the tunY default route is up imo underlines this. Also when you look into reverse path filtering you&#039;ll see that it deals with exactly such cases (seems it&#039;s not used by default in Devuan - Ubuntu for example does use it by default i think - otherwise OP would have to disable it to not have the kernel outright drop the incoming packets).</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Tue, 19 Jun 2018 12:58:39 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10240#p10240</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10236#p10236</link>
			<description><![CDATA[<p>There are probably many holes in my understanding, but isn&#039;t it so, that the server-vpn program already interacts on eth0 for handling its clients; so it&#039;s response packets are already outbound on eth0 without any routing?</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Tue, 19 Jun 2018 11:46:43 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10236#p10236</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10229#p10229</link>
			<description><![CDATA[<div class="quotebox"><cite>ralph.ronnquist wrote:</cite><blockquote><div><p>mmm ... all 192.168.x.0/24 (ethX) traffic should go out without ado due to the network route.</p></div></blockquote></div><p>Sure but if his internal VPN server gets a connection from the internet that won&#039;t be from 192.168.x.0/24 or any kind of local address but a random WAN IP (which OP doesn&#039;t know beforehand so no chance to set a conventional route for it) and when the server attempts to answer the only route matching the destination IP will be the default route pointing at tunY.</p><p>It&#039;s a bit of a weird setup to actually have a need for routing based on source port (well, at least that&#039;s how i&#039;d single out traffic originating from his internal VPN server) rather than destination IP but in this case i don&#039;t see how it could work otherwise. Well, i guess he might get away with source based routing also but in that case all traffic originating at eth0 (or rather it&#039;s IP) would get routed through eth0 (his normal internet connection). That might spare him the tagging of individual packets but it&#039;s not exactly (as i understand it) what he is asking for and imo it wouldn&#039;t be all that much simpler.</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Tue, 19 Jun 2018 08:01:38 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10229#p10229</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10217#p10217</link>
			<description><![CDATA[<p>mmm ... all 192.168.x.0/24 (ethX) traffic should go out without ado due to the network route.</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Mon, 18 Jun 2018 22:49:09 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10217#p10217</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10214#p10214</link>
			<description><![CDATA[<div class="quotebox"><cite>ralph.ronnquist wrote:</cite><blockquote><div><p>That&#039;s a good set of rules for doing no filtering at all, yes <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>If you don&#039;t mind, rather dump the output if <span class="bbc">iptables-save</span>, just to confirm all the tables. Basically, you shouldn&#039;t need any iptables rules, except the masquerading of the outbound traffic on <span class="bbc">tunY</span>. That one is necessary to allow packets with original source from IP 10.8.x.0/24 (i.e., your server-vpn clients) or 192.168.y.0/24 (your wlanX neighbors), as well as allowing packets from 192.168.x.0/24 (your ethX neighbors) to be forwarded and masqueraded through <span class="bbc">tunY</span>.</p></div></blockquote></div><p>Agreed. He&#039;ll likely need a couple of additional rules to route selected internet traffic (communication with his internal VPN server) over eth0 though. At least that&#039;s the best idea i have to actually have replies (those packet&#039;s will have a non local destination) to packet&#039;s that reach his VPN server ever eth0 exit there again while having a default route that points towards tunY</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Mon, 18 Jun 2018 22:23:08 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10214#p10214</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10213#p10213</link>
			<description><![CDATA[<p>That&#039;s a good set of rules for doing no filtering at all, yes <img src="https://dev1galaxy.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>If you don&#039;t mind, rather dump the output if <span class="bbc">iptables-save</span>, just to confirm all the tables. Basically, you shouldn&#039;t need any iptables rules, except the masquerading of the outbound traffic on <span class="bbc">tunY</span>. That one is necessary to allow packets with original source from IP 10.8.x.0/24 (i.e., your server-vpn clients) or 192.168.y.0/24 (your wlanX neighbors), as well as allowing packets from 192.168.x.0/24 (your ethX neighbors) to be forwarded and masqueraded through <span class="bbc">tunY</span>.</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Mon, 18 Jun 2018 22:02:11 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10213#p10213</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10212#p10212</link>
			<description><![CDATA[<div class="quotebox"><cite>siva wrote:</cite><blockquote><div><p>On the other hand, with <span class="bbc">route-nopull</span> disabled, I saw the packets trying to reach ethX, but as you said, no replies.&#160; And I&#039;ve gotta be totally honest with you, but I have no idea what that means.</p></div></blockquote></div><p>Well, it&#039;s not 100% sure but it pretty much implies that the routing &quot;works&quot;. Sadly not &quot;works&quot; as in does what you but rather does what it says though. I am quite certain the missing replies aren&#039;t really missing but just exit on the wrong interface as the default route that&#039;s in place when you remove route-nopull tells them. I guess you could see them when point tcpdump to tunY rather than eth0. That&#039;s basically what i was aiming at with the custom routing table but it seems that didn&#039;t work for some reason. I am quite sure that would be the way to go though.</p><p>could you post outputs of the following commands</p><div class="codebox"><pre><code>ip route show table isp</code></pre></div><div class="codebox"><pre><code>ip rule show</code></pre></div><div class="codebox"><pre><code>iptables -vnL</code></pre></div><div class="codebox"><pre><code>iptables -t mangle -vnL</code></pre></div><p>before and after running</p><div class="codebox"><pre><code>iptables -A PREROUTING -i eth0 -t mangle -p udp --sport [YOUR-INTERNAL-VPN-SERVER-PORT] -j MARK --set-mark 1
ip rule add fwmark 1 table isp
ip route add default via 192.168.x.1 dev eth0 table isp</code></pre></div><p>I know this is going to be a lot of output but i am trying to wrap my head around where it could go wrong and it&#039;s nothing i can easily test locally. Also your internal OpenVPN server uses UDP and when looking at tcpdump it&#039;s reply packets used [YOUR-INTERNAL-VPN-SERVER-PORT] as source port, right? Otherwise the iptables rule that should mark the packets would be wrong.</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Mon, 18 Jun 2018 21:51:36 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10212#p10212</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10211#p10211</link>
			<description><![CDATA[<div class="quotebox"><cite>ralph.ronnquist wrote:</cite><blockquote><div><div class="quotebox"><blockquote><div><p>What would be the best way to check?</p></div></blockquote></div><p>Remove the rule</p><div class="codebox"><pre><code>iptables -A FORWARD -j REJECT</code></pre></div><p> to see if it works without it.</p></div></blockquote></div><p>Same behavior.&#160; Here&#039;s my current config:</p><div class="codebox"><pre><code># iptables -L --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
2    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
2    ACCEPT     all  --  anywhere             anywhere            
3    ACCEPT     all  --  anywhere             anywhere            
4    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
5    ACCEPT     all  --  anywhere             anywhere            
6    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     udp  --  anywhere             anywhere             udp spt:domain
2    ACCEPT     udp  --  anywhere             anywhere             udp spt:domain</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (siva)]]></author>
			<pubDate>Mon, 18 Jun 2018 21:35:41 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10211#p10211</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10210#p10210</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>What would be the best way to check?</p></div></blockquote></div><p>Remove the rule</p><div class="codebox"><pre><code>iptables -A FORWARD -j REJECT</code></pre></div><p> to see if it works without it.</p><p>Then add it back, preceded by rules that allow forwarding between <span class="bbc">tunX</span> and <span class="bbc">tunY</span>.</p>]]></description>
			<author><![CDATA[dummy@example.com (ralph.ronnquist)]]></author>
			<pubDate>Mon, 18 Jun 2018 21:17:51 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10210#p10210</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10208#p10208</link>
			<description><![CDATA[<div class="quotebox"><cite>devuser wrote:</cite><blockquote><div><p>Well, as long as you have to default route on tunY VPN config should be fine. What i&#039;d do at this point is fire up tcpdump to debug:</p><div class="codebox"><pre><code>tcpdump -ni eth0</code></pre></div><p>Do you see the packets from your client connecting to your internal VPN server? If yes do also see the replies going from the server to the client? If you see the packets from the client but don&#039;t see any replies can you see replies when running</p><div class="codebox"><pre><code>tcpdump -ni tunY</code></pre></div><p>Edit: You can add </p><div class="codebox"><pre><code>port [YOUR-INTERNAL-VPN-SERVER-PORT]</code></pre></div><p> to the tcpdump commandline to filter traffic. Might be a bit hard to spot anything otherwise.</p></div></blockquote></div><p>Okay, so I have no idea why I never thought to run tcpdump, but you nailed part of the diagnosis, which puts me at ease.&#160; With <span class="bbc">route-nopull</span>, I can see packets to-and-from my mobile device, but it doesn&#039;t use tunY.</p><p>On the other hand, with <span class="bbc">route-nopull</span> disabled, I saw the packets trying to reach ethX, but as you said, no replies.&#160; And I&#039;ve gotta be totally honest with you, but I have no idea what that means.</p><div class="quotebox"><blockquote><div><p>Are you sure the packets aren&#039;t getting blocked by iptables?</p></div></blockquote></div><p>Again, in all honesty, I&#039;m not sure.&#160; What would be the best way to check?</p>]]></description>
			<author><![CDATA[dummy@example.com (siva)]]></author>
			<pubDate>Mon, 18 Jun 2018 21:09:44 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10208#p10208</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10081#p10081</link>
			<description><![CDATA[<p>Well, as long as you have to default route on tunY VPN config should be fine. What i&#039;d do at this point is fire up tcpdump to debug:</p><div class="codebox"><pre><code>tcpdump -ni eth0</code></pre></div><p>Do you see the packets from your client connecting to your internal VPN server? If yes do also see the replies going from the server to the client? If you see the packets from the client but don&#039;t see any replies can you see replies when running</p><div class="codebox"><pre><code>tcpdump -ni tunY</code></pre></div><p>Edit: You can add </p><div class="codebox"><pre><code>port [YOUR-INTERNAL-VPN-SERVER-PORT]</code></pre></div><p> to the tcpdump commandline to filter traffic. Might be a bit hard to spot anything otherwise.</p><p>Edit2: It not working with nopull (as that should have eliminated the default route toward tunY) seems a bit fishy to me. If it worked and the default route points towards eth0 i don&#039;t see how it could stop you from connecting from outside. Are you sure the packets aren&#039;t getting blocked by iptables?</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Fri, 15 Jun 2018 23:18:22 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10081#p10081</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10079#p10079</link>
			<description><![CDATA[<div class="quotebox"><cite>devuser wrote:</cite><blockquote><div><div class="codebox"><pre><code>echo 200 isp &gt;&gt; /etc/iproute2/rt_tables
iptables -A PREROUTING -i eth0 -t mangle -p udp --sport [YOUR-INTERNAL-VPN-SERVER-PORT] -j MARK --set-mark 1
ip rule add fwmark 1 table isp
ip route add default via 192.168.x.1 dev eth0 table isp</code></pre></div><p>Obviously can&#039;t really test it but it should basically mark packets coming from your internal VPN server and add a rule to make them use an entirely different routing table which does nothing but send the packets through your ISP instead of the external VPN. Rationale being: I think the problem isn&#039;t really not being able to reach the box from out side (the packets arrive just fine) the packets that the internal VPN server sends back to it&#039;s outer client get routed through the external VPN instead of being routed through your ISP as the client expects.</p></div></blockquote></div><p>Interesting idea.&#160; Unfortunately, the behaviour is the same.&#160; :\&#160; (I tried it with and without route-nopull; those behaviours haven&#039;t changed at all.)&#160; Should this be used in conjunction with some option added to my server/client configs?</p>]]></description>
			<author><![CDATA[dummy@example.com (siva)]]></author>
			<pubDate>Fri, 15 Jun 2018 23:09:39 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10079#p10079</guid>
		</item>
		<item>
			<title><![CDATA[Re: openvpn server and client on same box]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=10075#p10075</link>
			<description><![CDATA[<p>OK, i get it now. Yes, in that case the default route makes sense and your internal VPN server should also have &quot;redirect-gateway def1&quot; (sorry i thought you had access to the external one when asking to remove that). Well, that&#039;s going to be a bit ugly then but something along the lines of the following should work:</p><div class="codebox"><pre><code>echo 200 isp &gt;&gt; /etc/iproute2/rt_tables
iptables -A PREROUTING -i eth0 -t mangle -p udp --sport [YOUR-INTERNAL-VPN-SERVER-PORT] -j MARK --set-mark 1
ip rule add fwmark 1 table isp
ip route add default via 192.168.x.1 dev eth0 table isp</code></pre></div><p>Obviously can&#039;t really test it but it should basically mark packets coming from your internal VPN server and add a rule to make them use an entirely different routing table which does nothing but send the packets through your ISP instead of the external VPN. Rationale being: I think the problem isn&#039;t really not being able to reach the box from out side (the packets arrive just fine) the packets that the internal VPN server sends back to it&#039;s outer client get routed through the external VPN instead of being routed through your ISP as the client expects.</p>]]></description>
			<author><![CDATA[dummy@example.com (devuser)]]></author>
			<pubDate>Fri, 15 Jun 2018 22:37:21 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=10075#p10075</guid>
		</item>
	</channel>
</rss>
