<?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; firmware</title>
	<atom:link href="http://www.nikrivers.com/tag/firmware/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>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>
		<item>
		<title>Never simple</title>
		<link>http://www.nikrivers.com/2008/05/27/never-simple</link>
		<comments>http://www.nikrivers.com/2008/05/27/never-simple#comments</comments>
		<pubDate>Tue, 27 May 2008 13:29:22 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[draytek]]></category>
		<category><![CDATA[ethereal]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lunch]]></category>
		<category><![CDATA[pda]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[tcp port 80]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[weekend]]></category>
		<category><![CDATA[wireshark]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?p=46</guid>
		<description><![CDATA[At the weekend I decided to make a major update to the photo gallery, since a large number of photos weren&#8217;t up yet. Although a bit clunky, the gallery software I was using (Gallery2) did the job nicely &#8211; and it even has an accompanying desktop app which lets you upload photos en masse. But [...]]]></description>
			<content:encoded><![CDATA[<p>At the weekend I decided to make a major update to the photo gallery, since a large number of photos weren&#8217;t up yet. Although a bit clunky, the gallery software I was using (<a href="http://gallery.menalto.com/">Gallery2</a>) did the job nicely &#8211; and it even has an accompanying desktop app which lets you upload photos <em>en masse</em>.</p>
<p><span id="more-28"></span>But at the weekend it refused to upload anything successfully, complaining about PHP and web server upload limits &#8211; things over which I have no control. So I went back to using the clunky web interface to upload my photos, only to be greeted by the useless &#8220;Internet Explorer cannot display the webpage&#8221; page on each attempt.</p>
<p>Things didn&#8217;t look good. So I decided to download a cleaner-looking and simpler gallery application (<a href="http://www.plogger.org/">Plogger</a>) to give it a go. Still no luck.</p>
<p>Having ruled out the problem being Gallery2, I decided my website host had changed some things on their side. A quick Google later, and I realised that I couldn&#8217;t upload anything more than small text files to any server. So it&#8217;s not my website host.</p>
<p>Good job I didn&#8217;t send them that email.</p>
<p>But wait, I can upload files to the gallery using a machine on the other side of the corporate VPN&#8230; which uses the corporate Internet connection. So it must be my ISP. It must be. Surely? After another quick Google, I read that a number of ISPs have been caught sending fake TCP reset packets to their users so that &#8216;undesirable&#8217; connections (ie. file sharing applications) are disconnected.</p>
<p>Knowing how to troubleshoot this kind of problem, I proceed to download <a href="http://www.wireshark.org/">Wireshark</a>, a network protocol analyzer (formerly Ethereal). Sure enough, each time I try to upload a .jpeg or .bmp or&#8230; in fact almost <em>any</em> type of file, I receive a TCP RST message &#8211; surely the fake reset message sent to me by my interfering ISP!</p>
<p>However, it seems that my ISP is blameless after all.</p>
<p>It turns out the latest firmware for my Draytek 2800 router adds an innocent-looking option called &#8220;Drop non-http connection on TCP port 80&#8243; which is enabled by default. I feel it should be more accurately called &#8220;break everything&#8221;. Disabling it fixed the problem, but it took an entire lunch break.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/2008/05/27/never-simple/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linksys NSLU2</title>
		<link>http://www.nikrivers.com/linksys-nslu2</link>
		<comments>http://www.nikrivers.com/linksys-nslu2#comments</comments>
		<pubDate>Tue, 22 Apr 2008 18:58:23 +0000</pubDate>
		<dc:creator>Nik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firmware]]></category>
		<category><![CDATA[linksys]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[nslu2]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://www.nikrivers.com/?page_id=35</guid>
		<description><![CDATA[About the NSLU2 The Linksys NSLU2 is a lovely little NAS storage server with 2 USB ports and an Ethernet LAN port. You can attach two USB hard drives to it and connect it to your network, and use it as a file server. Or you can download alternative firmware, run a customised version of [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 206px"><img title="Linksys NSLU2" src="http://ecx.images-amazon.com/images/I/4127FqymOSL._SL500_AA280_.jpg" alt="Linksys NSLU2" width="196" height="196" /><p class="wp-caption-text">Linksys NSLU2</p></div>
<h3>About the NSLU2</h3>
<p>The Linksys NSLU2 is a lovely little NAS storage server with 2 USB ports and an Ethernet LAN port. You can attach two USB hard drives to it and connect it to your network, and use it as a file server.</p>
<p>Or you can download alternative firmware, run a customised version of Linux on it, and use it as a mail server, a torrent server, a print server, a web server, and more.</p>
<p>It supports NTFS, USB hubs, and flash drives. It&#8217;s silent, draws no more than 10W of power, runs at 266MHz, and is the size of two Weetabix.</p>
<p>And it&#8217;s known as a Slug.</p>
<p>Full details, including the data sheet, user guide and firmware, can be found over at the <a href="http://www.linksys.com/servlet/Satellite?c=L_Product_C2&amp;childpagename=US/Layout&amp;cid=1118334819312&amp;pagename=Linksys/Common/VisitorWrapper&amp;lid=1931222279B14">Linksys website</a>, and some information is available at <a href="http://en.wikipedia.org/wiki/NSLU2">Wikipedia</a>.</p>
<p>The NSLU2 is now discontinued, but don&#8217;t let that put you off &#8211; this will only really affect you if you need to return your Slug for replacement under warranty. Flashing your firmware voids the warranty (as does making hardware modifications, which a lot of users seem to do), so its discontinuation seems hardly relevant.</p>
<p>Opinion seems to be divided on this issue, with a few differing viewpoints given on Paul Hutchinson&#8217;s <a href="http://paulhutch.com/wordpress/?p=266">blog</a>. Regardless, I predict the NSLU2 will maintain a cult following of users and developers for quite some time.</p>
<h3>Where to buy</h3>
<p><span style="text-decoration: line-through;">These things aren&#8217;t particularly easy to get hold of in the UK at a decent price, but LambdaTek has them </span><a href="http://www.lambda-tek.com/componentshop/index.pl?origin=gbase6.3&amp;prodID=960362"><span style="text-decoration: line-through;">available</span></a><span style="text-decoration: line-through;"> at around £70, although at dwindling stock levels.</span></p>
<p><span style="text-decoration: line-through;">Or, if you&#8217;re in the market for a second-hand Slug, I have a spare for which I cannot find a use; I&#8217;m more than happy to consider offers on it. It&#8217;s the 266MHz version (as opposed to the 133MHz version) and has a UK power supply. For use outside the UK, a travel adapter should be fine since the power supply is auto-switching, or a generic 5V-2A power supply would do the trick.</span></p>
<p>The Linksys NSLU2 is no longer available &#8211; it seems all retailers have run down their stocks.  You might be lucky on eBay, but if you don&#8217;t own one already I recommend you find an alternative.</p>
<h3>Finding more help</h3>
<p>The NSLU2 community is at <a href="http://www.nslu2-linux.org">www.nslu2-linux.org</a>, where there&#8217;s a LOT of information. However, it&#8217;s a community built on voluntary user contribution, so the information is sometimes incomplete, outdated, or otherwise inaccurate. There&#8217;s also a lot of information about the available packages out there on the Internet, but it doesn&#8217;t necessarily relate to the NSLU2 and often assumes you will be using packages that simply aren&#8217;t available to you.</p>
<p>The <a href="http://www.nslu2-linux.org/wiki/Unslung/HomePage">Unslung</a> firmware is the first custom firmware that most users try. The binary download, which also contains all the information you need to get started, can be found at <a href="http://www.slug-firmware.net/">www.slug-firmware.net</a>.</p>
<p>Getting the Unslung firmware up and running on my Slug was relatively easy. However, finding the information I needed to configure certain software packages proved more difficult, even though the actual installation of each package was quite simple.</p>
<p>In order to document my Slug&#8217;s configuration and to provide a reference point to others, I have created step-by-step NSLU2 instructions for the following tasks:</p>
<ul>
<li><a href="http://www.nikrivers.com/linksys-nslu2/enabling-ssh-access">Enabling SSH access</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/email-with-postfix-and-dovecot">Setting up an email server using Postfix and Dovecot</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/time-server-with-ntp">Setting up an NTP server using ntp</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/print-server-with-cups">Setting up a print server using CUPS</a></li>
<li><a href="http://www.nikrivers.com/linksys-nslu2/ssl-and-tls-for-postfix-and-dovecot">Configuring SSL and TLS for Postfix and Dovecot</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nikrivers.com/linksys-nslu2/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
