<?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>Professional Geekism &#187; Netgear</title>
	<atom:link href="http://www.ninjabadger.net/category/netgear/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ninjabadger.net</link>
	<description>Ninjas. Badgers. Linux. Me.</description>
	<lastBuildDate>Wed, 17 Feb 2010 23:06:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>TFTP Server via Netgear DB834GT</title>
		<link>http://www.ninjabadger.net/2008/01/14/tftp-server-via-netgear-db834gt/</link>
		<comments>http://www.ninjabadger.net/2008/01/14/tftp-server-via-netgear-db834gt/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 00:35:52 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Netgear]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[VOIP]]></category>

		<guid isPermaLink="false">http://www.ninjabadger.net/2008/01/14/tftp-server-via-netgear-db834gt/</guid>
		<description><![CDATA[I&#8217;ve written a short guide on how to configure a Netgear DB834GT (and possibly other variants of the DB834) to forward a device to a TFTP server, via the router&#8217;s built-in busybox/linux-based udhcpd server. I&#8217;ve recently been setting up a Cisco IP phone at home, and this functionality has proven to be extremely useful. Disclaimer: [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written a short guide on how to configure a <a href="http://www.netgear.co.uk/wireless_broadband_router_dg834gt.php">Netgear DB834GT</a> (and possibly other variants of the DB834) to forward a device to a <a href="http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol">TFTP server</a>, via the router&#8217;s built-in <a href="http://www.busybox.net/">busybox</a>/linux-based <a href="http://udhcp.busybox.net/">udhcpd</a> server. I&#8217;ve recently been setting up a Cisco IP phone at home, and this functionality has proven to be extremely useful.</p>
<p><strong>Disclaimer: I am NOT responsible if you screw up, over-write your config, brick your router, forget your password, kill your dog or set fire to the living room. There&#8217;s no reason why you should do any of these things, given the simple commands below, but if you do see fit to go a-wandering through the files stored within your router, then it&#8217;s not my fault if you break it!</strong></p>
<p>Anyway, to start, you&#8217;ll need to enable the debug mode on your Netgear router. Simply construct a link like the one below, paste it into your web browser and login with your username (most-likely &#8216;admin&#8217;) and the configured password:</p>
<p><code>http://192.168.0.1/setup.cgi?todo=debug</code></p>
<p>Of course, you&#8217;ll need to replace &#8217;192.168.0.1&#8242; with the LAN IP that you&#8217;ve chosen for your router.</p>
<p>Now for the fun part. We need to see what the DHCP server is configured to do at present, so issue the following command:</p>
<p><code>cat /etc/udhcpd.conf</code></p>
<p>You should see the contents of the udhcp.conf file printed out. It will look something like this:<br />
<code><br />
server          192.168.0.1<br />
start           192.168.0.20<br />
end             192.168.0.254<br />
interface       br0<br />
option  subnet  255.255.255.0<br />
option  router  192.168.0.1<br />
option  dns     208.67.222.222<br />
option  dns     208.67.220.220<br />
option  lease   259200<br />
</code><br />
To setup the TFTP server re-direction, you first need to add a line to this config file. I had to look up a <a href="http://udhcp.busybox.net/udhcpd.conf">sample config file for udhcpd</a>, but thankfully it lists a number of DHCP options that can be utilised (but aren&#8217;t directly supported by the web interface) to extend its usefulness.</p>
<p>Sadly there&#8217;s no text file editor included on the router, but one can achieve the same effect with simple shell operators:</p>
<p><code>echo "option  tftp    192.168.0.20" >> /etc/udhcpd.conf</code></p>
<p>This simply prints a line and appends it to the file. You can check your addition by using the &#8216;cat&#8217; command above.</p>
<p>Now you need to stop the DHCP server and restart it. This is so that udhcpd will re-load it&#8217;s configuration file and take note of your changes. If you issue the command &#8216;ps&#8217;, you&#8217;ll see something like this:<br />
<code><br />
# ps<br />
  PID  Uid     VmSize Stat Command<br />
    1 root        252 S   init<br />
    2 root            SWN [ksoftirqd/0]<br />
    3 root            SW< [events/0]<br />
    4 root            SW< [khelper]<br />
    5 root            SW< [kblockd/0]<br />
   17 root            SW  [pdflush]<br />
   18 root            SW  [pdflush]<br />
   19 root            SW  [kswapd0]<br />
   20 root            SW< [aio/0]<br />
   26 root            SW  [mtdblockd]<br />
  104 root        244 S   /sbin/klogd<br />
  147 root        400 S   /usr/sbin/hostapd -B /etc/hostapd.conf<br />
  163 root        260 S   /usr/sbin/netgear_ntp -z GMT+0 -h 208.69.32.170<br />
  165 root        256 S   /usr/sbin/mini_httpd -d /www -r NETGEAR DG834GT  -c *<br />
  172 root        268 S   /sbin/syslogd -f /etc/syslog.conf<br />
  173 root        244 S   /usr/sbin/crond<br />
  175 root        168 S   /usr/sbin/scfgmgr<br />
  179 root        184 S   /usr/sbin/cmd_agent_ap<br />
  180 root        168 S   /usr/sbin/pb_ap<br />
  193 root        252 S   init<br />
  602 root        220 S   /usr/sbin/utelnetd -d<br />
 1835 root        524 S   /usr/sbin/pppd plugin pppoa 0.38 user lol@adsl.net<br />
 2056 root        300 S   /usr/sbin/reaim<br />
 2153 root        244 S   /usr/sbin/udhcpd /etc/udhcpd.conf<br />
 2155 root        396 S   /bin/sh<br />
 2157 root        268 R   ps<br />
</code><br />
As you can see by this line:</p>
<p></code>2153 root        244 S   /usr/sbin/udhcpd /etc/udhcpd.conf</p>
<p>..the udhcpd server is running with PID 2153. To stop it, just kill it:</p>
<p><code>kill 2153</code></p>
<p><strong>Note: Although <em>my</em> example shows udhcpd using PID 2153, yours will most-certainly be different, so remember to substitute the the kill command above with one that uses the <em>correct</em> PID value. Killing the wrong PID could mean that you break something vital, and you&#8217;ll need to start over again (ie. restart the router, and go back to the beginning of this guide.)</strong></p>
<p>Issuing &#8216;ps&#8217; once more should show that the udhcpd server has been sucessfully stopped (it won&#8217;t appear in the list of running processes). The router won&#8217;t restart udhcpd by itself thankfully. Note that whilst you have the DHCP server disabled, any clients expecting a lease or renew won&#8217;t get it. I can only recommend that the machine you do this from is assigned a static IP, to avoid any [possible, however unlikely] hassle.</p>
<p>Since we&#8217;ve pre-edited the udhcpd.conf file, all that is left to do is restart udhcpd:</p>
<p><code>/usr/sbin/udhcpd /etc/udhcpd.conf &#038;</code></p>
<p>The ampersand at the end is important, don&#8217;t forget it!</p>
<p>Finally, issue another &#8216;ps&#8217; command to check that udhcpd has been restarted successfully, and you&#8217;re all done.</p>
<p>Unfortunately these changes will not be permanent. If your router is restarted, or power cycled, you will lose these settings. At present, I do not know of a way to successfully add the TFTP option to the configuration saved within the router&#8217;s non-volatile memory. It would be nice if Netgear could build some of this functionality into their firmwares (and thus the web interface), and whilst third-party firmwares do exist, I&#8217;ve not had the beef to test one out as of yet.</p>
<p>Still, this helped me configure my SIP phone, so hopefully it&#8217;ll help someone else. <img src='http://www.ninjabadger.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjabadger.net/2008/01/14/tftp-server-via-netgear-db834gt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
