<?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>Zod.hu &#187; vpn</title>
	<atom:link href="http://zod.hu/tag/vpn/feed" rel="self" type="application/rss+xml" />
	<link>http://zod.hu</link>
	<description>Phase one: Linux, phase two: , phase three: profit!</description>
	<lastBuildDate>Wed, 11 Nov 2009 04:16:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Connecting Samba servers through OpenVPN</title>
		<link>http://zod.hu/2009/04/connecting-samba-servers-through-openvpn.html</link>
		<comments>http://zod.hu/2009/04/connecting-samba-servers-through-openvpn.html#comments</comments>
		<pubDate>Thu, 23 Apr 2009 11:26:03 +0000</pubDate>
		<dc:creator>Zod</dc:creator>
				<category><![CDATA[Config]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[multiple subnets]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[windows networking]]></category>

		<guid isPermaLink="false">http://zod.hu/?p=42</guid>
		<description><![CDATA[Connecting two different subnets on different locations with linux firewalls is easy. I did it with OpenVPN because it&#8217;s easy to setup, secure and &#8220;just works&#8221;. Everything worked fine. Email server on one subnet was reachable from the other, the samba server was available with \\ip style address. I thought that was all, work done&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Connecting two different subnets on different locations with linux firewalls is easy. I did it with OpenVPN because it&#8217;s easy to setup, secure and &#8220;just works&#8221;.</p>
<p>Everything worked fine. Email server on one subnet was reachable from the other, the samba server was available with \\ip style address. I thought that was all, work done&#8230;</p>
<p>Not quite.<br />
<span id="more-42"></span><br />
Well we had domain logons with roaming profiles before the subnet split and we wanted it to stay the same. </p>
<p>Before I go into detail about the problems and solutions lets take a look at our simplified network.<br />
The two firewalls are connected with adsl through ppp0.<br />
Subnet1 has an internal network with 192.168.1.0/24 with the server ip 192.168.1.254 and a tun0 interface with 10.8.0.1.<br />
Subnet2 has 192.168.2.0/24 (ip 192.168.2.254) with tun0 10.8.0.6.<br />
Because we have limited number of servers both firewalls are also the samba servers. (However the setup is the same if you have internal samba servers, just change the ip addresses).</p>
<p>Subnet2 has the domain controller for DOMAIN1.</p>
<p>Server on Subnet1 is called SERVER2 on Subnet2 it&#8217;s SERVER, sorry for this we have a switched setup and I don&#8217;t want to tamper with the included logs.</p>
<p><b>Configuration</b></p>
<p>We need a WINS server on our network. Let SERVER (192.168.2.254) be it:</p>
<p>smb.conf on SERVER:</p>
<pre>
netbios name = SERVER
workgroup = DOMAIN1
os level = 128
preferred master = Yes
domain master = Yes
local master = Yes

wins support = Yes
wins proxy = Yes

# If you want domain logons just turn on the relevant options
</pre>
<p>smb.conf on SERVER2</p>
<pre>
netbios name = SERVER2
workgroup = DOMAIN1
os level = 64
preferred master = Yes
domain master = No
local master = Yes

wins support = No
wins proxy = No
wins server = 192.168.2.254
</pre>
<p>It is important to switch on wins support = Yes on only one server per workgroup!</p>
<p>Ok now we have name resolution for NetBIOS names set up.</p>
<p>If you have dhcp for your subnets put option netbios-name-servers 192.168.2.254; in dhcpd.conf so your clients will know about our WINS server (you can also put option netbios-node-type 8; this will change the clients NetBIOS name resolution to WINS server and network broadcast in this order)</p>
<p><b>Problem 1</b></p>
<p>This one is quite important and hard to notice.<br />
If you have </p>
<pre>
interfaces = 127.0.0.0/8 eth1 ...
bind interfaces only = yes
</pre>
<p>Comment it out now! The problem is with this setup is no matter how hard you try to add tun0 (or tun0 ip range) to this config samba will refuse to use this interface because it has no broadcast capability. And the traffic between the two servers will go through the tunnel and use the tun0 ip for source, and in turn samba will refuse inter samba communication from this source.</p>
<p>The relevant log file entries are not too informative:</p>
<p>On the WINS server:</p>
<pre>
[2009/04/22 16:53:16,  3, pid=26633, effective(0, 0), real(0, 0)] nmbd/nmbd_winsserver.c:wins_multihomed_register_query_fail(1491)
  wins_multihomed_register_query_fail: Registering machine at IP 192.168.1.254 failed to answer query successfully for name SERVER2&lt;20&gt;.
</pre>
<p>On the other server:</p>
<pre>
[2009/04/22 16:53:26, 0, pid=30630, effective(0, 0), real(0, 0)] nmbd/nmbd_namelistdb.c:standard_fail_register(305)
  standard_fail_register: Failed to register/refresh name SERVER2&lt;03&gt; on subnet UNICAST_SUBNET
[2009/04/22 16:53:26, 0, pid=30630, effective(0, 0), real(0, 0)] nmbd/nmbd_nameregister.c:register_name_response(130)
  register_name_response: WINS server at IP 192.168.2.254 rejected our name registration of SERVER2&lt;00&gt; IP 192.168.1.254 with error code 5.
</pre>
<p><b>Problem 2</b></p>
<p>On each subnet only the host which reside on the same subnet are visible to the clients. We have to force our other server(s) to sync its browse list with the WINS server. This can be done by adding the following to the config of the WINS server.</p>
<pre>
# This forces samba to announce itself to 192.168.1.254 (our local master browser on the other subnet)
# and also on the broadcast address, just to be sure it reaches the clients.
remote announce = 192.168.1.254 192.168.1.255

# This forces the lmb 192.168.1.254 to sync its browse list with us.
remote browse sync = 192.168.1.254
</pre>
<p><b>Problem 3</b></p>
<p>As I said before we have domain logons enabled. Without the above changes joining the domain was easy (just like with a single subnet) however the clients were unable to log in to the domain. The error was at login time after selecting the domain to log on and entering user/pass information and it said something like &#8220;Domain DOMAIN1 not available&#8221;. No details, no errors. Sometimes I was able to log in but the client machine was unable to mount the network drives from the server. After digging into the problem it boiled down to NetBIOS name resolution. So the changes above seems to solve this issue as well.</p>
<p>Now we are done :)</p>
<p><b>Final thoughts</b></p>
<p>MS networking is complicated and unreliable. I really hate it. Broadcasting, elections, resolution order changes&#8230;<br />
So do not ever trust it! Browsing the network was never easy either and I don&#8217;t think it ever will be. </p>
<p>Oh and also as of samba 3.2.3 XP clients don&#8217;t seem to need the signorseal registry hack, however in local policy/security setting you should disable &#8220;&#8230;signing and encrypting (always)&#8221;. </p>
]]></content:encoded>
			<wfw:commentRss>http://zod.hu/2009/04/connecting-samba-servers-through-openvpn.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

