<?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>nikrivers.com &#187; upgrade</title>
	<atom:link href="http://www.nikrivers.com/tag/upgrade/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nikrivers.com</link>
	<description></description>
	<lastBuildDate>Tue, 07 Sep 2010 16:42:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Why Linux isn&#8217;t ready</title>
		<link>http://www.nikrivers.com/2010/03/07/why-linux-isnt-ready</link>
		<comments>http://www.nikrivers.com/2010/03/07/why-linux-isnt-ready#comments</comments>
		<pubDate>Sun, 07 Mar 2010 12:46:06 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=643</guid>
		<description><![CDATA[There are plenty of people around who will happily slate Microsoft (sorry, that should be Micro$oft), Windoze, and Internet Exploder.  The majority of these people will, unprompted, extoll the virtues of Linux. I won&#8217;t lie, I like Microsoft.  I think Windows is the best all-round family of operating systems available.  And I use Internet Explorer [...]]]></description>
			<content:encoded><![CDATA[<p>There are plenty of people around who will happily slate Microsoft (sorry, that should be Micro$oft), Windoze, and Internet Exploder.  The majority of these people will, unprompted, extoll the virtues of Linux.</p>
<p>I won&#8217;t lie, I like Microsoft.  I think Windows is the best all-round family of operating systems available.  And I use Internet Explorer as my default browser, even though I have Firefox and Chrome installed.</p>
<p>But I also run a Linux server.  It is a modest beast.  It has a Sempron processor, three hard disks around 200-500GB each, and about 1GB of RAM.  It doesn&#8217;t need much, even though it acts as a mail server, a web server, and a DNS and network file server for my home LAN.  It runs Fedora 11, which is actually quite nice.</p>
<p>I started using Linux with no experience, and with the help of some patience, a few good Internet resources, and good old intuition, I pretty much know what I&#8217;m doing.</p>
<p>About a week ago, my Internet connection started to die sporadically, at unpredictable intervals, for no apparent reason.  I traced the lack of connectivity down to the DNS server not responding to requests, and this led me to realise that the Linux box would not respond to any kind of request at all: SSH, HTTP, or even ping.</p>
<p>So imagine my surprise, when after a lot of investigation (and I really do mean a LOT of investigation) it turned out to be Samba, the service which handles network file shares.</p>
<p><span id="more-643"></span>I had recently updated Samba from v3.3 to v3.4 using yum, assuming it to be a bug-free release which wouldn&#8217;t break anything.  How wrong I was.  From v3.4, Samba has been changed to use a different authentication mechanism by default.  It used to use <strong>smbpasswd</strong> up to v3.3, but now uses <strong>tdbsam</strong>.</p>
<p>Ok, no problem really &#8211; until the upgrade from v3.3 to v3.4 <em>changes</em> your <strong>smb.conf</strong> without leaving an <strong>smb.conf.backup</strong> or something similar sitting next to it.  So without knowing it, your Samba installation now uses tdbsam.  Now, the problem with this is that there is a known <a href="https://bugzilla.redhat.com/show_bug.cgi?id=525861" target="_blank">bug</a> whereby Windows clients become unable to authenticate and connect.</p>
<p>It was disappointing to have to find this out the hard way &#8211; by which I mean trawling around the web.  But still, it should be easy enough to edit <strong>smb.conf</strong> and change the authentication back to smbpasswd, right?  Wrong, because it seems the upgrade deleted the file containing the smbpasswd credentials (<strong>/var/lib/samba/private/smbpasswd</strong>).</p>
<p>Redhat&#8217;s Bugzilla entry explains how to convert smbpasswd account credentials to tdbsam format, so presumably you can do the reverse.  Well, technically you can &#8211; but only if the tdbsam credentials file (<strong>/var/lib/samba/private/passdb.tdb</strong>) isn&#8217;t empty!  That&#8217;s right, the upgrade failed (or didn&#8217;t even try) to convert the smbpasswd account credentials to the tdb format.</p>
<p>The solution is to run <strong>smbpasswd -a username</strong> for every Samba account you lost.  I&#8217;m glad I only had two.</p>
<p>This is why I think Linux is a long long way from being ready to take over the world.  I don&#8217;t think the Linux community appreciates how much help the average desktop user needs when they encounter problems.  This is demonstrated by the fact that Linux gives you no help at all; even the noddy &#8216;How do I&#8230;&#8217; help topics in Windows destroy the assistance Linux offers.</p>
<p>From the very start, Linux makes it very clear you&#8217;re on your own.</p>
<p>While I admit that the change to Samba was publicised in the <a href="http://www.samba.org/samba/history/samba-3.4.0.html" target="_blank">Samba release notes</a>, I simply do not have the time to read through the release notes of, and perform impact analysis upon, every update I install.  I want to be confident that each update is the best thing for my system &#8211; much like Windows Update.</p>
<p>For now, I will stick with the majority of users, and keep current with Windows updates for the advantage of not having to enter the root user&#8217;s password whenever I want to do something.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2010/03/07/why-linux-isnt-ready/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netgear DG834G and NAT loopback</title>
		<link>http://www.nikrivers.com/2009/10/26/netgear-dg834g-and-nat-loopback</link>
		<comments>http://www.nikrivers.com/2009/10/26/netgear-dg834g-and-nat-loopback#comments</comments>
		<pubDate>Mon, 26 Oct 2009 21:13:33 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[nat loopback]]></category>
		<category><![CDATA[netgear dg834g]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[pda]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[tcp port 80]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=591</guid>
		<description><![CDATA[UPDATE 18th April 2010: Netgear have since released a firmware update for the DG834Gv4 which supports NAT loopback.  It took them long enough! Yesterday I made the decision (read: mistake) to update my Netgear DG834G router (hardware v4, firmware v5.01.09) to firmware v5.01.14 &#8211; and, as is the way with these things, it brought trouble.  After the upgrade I [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff6600;"><strong>UPDATE 18th April 2010:</strong> Netgear have since released a </span><a href="http://kb.netgear.com/app/answers/detail/a_id/13354" target="_blank"><span style="color: #ff6600;">firmware update</span></a><span style="color: #ff6600;"> for the DG834Gv4 which supports NAT loopback.  It took them long enough!</span></p>
<p>Yesterday I made the decision (read: mistake) to update my Netgear DG834G router (hardware v4, firmware v5.01.09) to firmware v5.01.14 &#8211; and, as is the way with these things, it brought trouble.  After the upgrade I couldn&#8217;t reach <a href="http://www.nikrivers.com">www.nikrivers.com</a> from the LAN side of the router.</p>
<p>The problem is caused by the way the router handles traffic coming from an internal IP address and destined for the WAN (i.e. external) IP address.  In this situation it requires that the router first transfers the traffic from the internal network to the external network, and then immediately passes it back whilst applying any firewall or routing rules that are relevant to incoming external traffic.</p>
<p><span id="more-591"></span>This behaviour is called &#8216;NAT loopback&#8217;, and it seems the vast majority of routers built for the home market have this ability turned off, or do not have the ability at all.  It can be a big problem if you host a website and wish to access that same website using its domain name.  The domain name will resolve to the WAN IP address of your router, and any traffic headed there (such as an HTTP GET request on port 80) from the internal network will be ignored by the router.</p>
<p>There are a few ways to solve this, but none of them are ideal.</p>
<ol>
<li>Use the server name instead of the domain name to access your website</li>
<li>Modify the list of known network hosts on each client to point your domain name straight to the server in question.</li>
<li>Run your own DNS server, using a view to return the server&#8217;s local IP address to requests for your domain name originating from your network.</li>
</ol>
<p>Of course, the situation gets more complex if you&#8217;re also using your router to send TCP traffic on port 80 to your webserver and UDP traffic on port 8668 to a game server.</p>
<p>The solution is to get NAT loopback working on your router.  With some routers, such as the Touchspeed 535 as provided by Be Broadband, this feature can be enabled using a <a href="http://thicksliced.blogspot.com/2006/08/speedtouch-and-nat-loopback.html" target="_blank">simple CLI command</a>.  For other routers, such as the Netgear DG834G, it&#8217;s not quite so easy.</p>
<p>For the purposes of this post I&#8217;ll assume the internal network is on the 192.168.0.x range, the router is 192.168.0.254, and the web server is 192.168.0.1.  <strong>You will need to modify these IP addresses according to your own network setup</strong>.</p>
<p>The first thing to do is to enable debug mode on the router.  Simply go to <a href="http://192.168.0.254/setup.cgi?todo=debug">http://192.168.0.254/setup.cgi?todo=debug</a> and you&#8217;ll be rewarded with an appropriate message, &#8220;Debug Enable!&#8221;.  Nice.</p>
<p>Now connect to the router with &#8216;telnet 192.168.0.254&#8242; to gain access to the router&#8217;s cut-down installation of Linux.  All that is required is to add one additional entry to the router&#8217;s iptables (which is a standard Linux feature; <a href="http://www.google.com/search?q=iptables+tutorial" target="_blank">Google it</a> or more info).  Type the following, amending any IP addresses according to the network setup:</p>
<blockquote><p>iptables -t nat -A POSTROUTING -d 192.168.0.1 -s 192.168.0.0/24 -p tcp &#8211;dport 80 -j SNAT &#8211;to 192.168.0.254</p></blockquote>
<p>This adds a rule to the POSTROUTING chain on the nat table which applies to all TCP traffic on port 80 (HTTP) coming from the private network and headed to the router.  The rule redirects the traffic to the server, and then processing jumps to the SNAT chain.</p>
<p>If the server is more than just a simple web server, such as an NTP server or mail server as well, the above step needs to be performed (changing the -p and &#8211;dport parameters accordingly) for each port and protocol combination you require.  Alternatively, those parameters could be omitted altogether, which will allow all traffic types on all ports through:</p>
<blockquote><p>iptables -t nat -A POSTROUTING -d 192.168.0.1 -s 192.168.0.0/24 -j SNAT &#8211;to 192.168.0.254</p></blockquote>
<p>If you do this, I recommend you run a firewall on your server, with only the appropriate ports opened.</p>
<p>There is more information in <a href="http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO-10.html" target="_blank">section 10</a> of Rusty Russell&#8217;s <a href="http://www.netfilter.org/documentation/HOWTO/NAT-HOWTO.html" target="_blank">Linux 2.4 NAT Howto</a>.</p>
<p>Unfortunately, the iptables change isn&#8217;t retained when the router restarts, so it is necessary to go through the process every time &#8211; which is a pain in the backside.  Fortunately, however, the Netgear support website has a download link for previous firmware versions, so I downgraded my router back to <a href="http://kb.netgear.com/app/answers/detail/a_id/271" target="_blank">firmware v5.01.09</a> and everything worked fine again&#8211;including NAT loopback&#8211;with no iptables hack required.</p>
<h3>A robust solution with DNS</h3>
<p>Simply put, proper DNS is the best way to get around a router&#8217;s lack of/poorly implemented NAT loopback.</p>
<p>If you have the resources to host a website then you most likely also have the resources to host a DNS server for your internal network.  Simply create an ACL list describing all the clients on your internal network (probably as simple as specifying the CIDR block for your network, maybe something like 192.168.1.0/24).  Then create a view whose clients match that ACL, and define that view as a master DNS server for your website domain.  You then need to create a zone file for that domain &#8211; but instead of using an external IP for your webserver, use its internal IP.</p>
<p>All requests for other domains will be routed to the DNS forwarders, but requests for your webserver&#8217;s domain will be handled locally, and internal IP addresses will be returned.</p>
<p>The benefit is that you avoid traversing your gateway router to simply come back inside your network.  It doesn&#8217;t make sense that you rely on your gateway router to access a website within your own network.  In addition, the firewall on your router can be hardened to a much greater degree: for example, you needn&#8217;t leave FTP ports open on your router if you&#8217;re only connecting locally.  Or, to put it another way, you&#8217;re likely going to want to give yourself more access to your server than you want to give to the outside world; configuring a router&#8217;s firewall rules for this kind of conditional logic is simply asking for trouble.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2009/10/26/netgear-dg834g-and-nat-loopback/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
