User Tools

Site Tools


Router Hacking

(or, how to make your USB-enabled router (mine is ASUS) into a web-server on the free and cheap)

  • Why? ~10 times reduction in power usage over a desktop, with little drop in performance in ordinary usage situations.
    • @16.2 cents per kilowatt-hour, an 80-watt idle desktop costs $11.50 per month to operate vs an 8-watt router costing $1.15 per month. Good luck beating shared hosting with your desktop, but maybe with a low-power router or Raspberry Pi.
  • Using TomatoUSB, and most things are included already which is awesome!
  • Current steps to reproduce setup:
  • Via command line:
	//Set up flash drive correctly onto /opt directory. Get ipkg somehow
	ipkg install coreutils 	//gives you things like chown
	ipkg install php-fcgi nginx php-gd ...etc
	ipkg files nginx 	//shows you where key nginx files are located
  • The default nginx.conf should work, but change a few things below + maybe add security.
    • The $fastcgi_script_name thing was a really annoying bug!
	location / {
            root   html;
            index  index.html index.htm index.php doku.php;
        # pass the PHP scripts to FastCGI server listening on
        location ~ \.php$ {
            root           html;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /opt/share/nginx/html/$fastcgi_script_name;
	    fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            include     fastcgi_params;
	#prevents external access to dokuwiki data files that aren't php
	location ~ /(data|conf|bin|inc)/ {
	    deny all;
  • Also need to punch a hole in iptables so that you can self-host:
iptables -t filter -I INPUT -p tcp —dport 80 -j ACCEPT


  • It's crashing a lot lately for some reason. Already increased the memory limit for PHP, but based on memory usage it doesn't seem to be the problem. CPU looked pegged, but that should be okay too.
  • Normally PHP crashes every 2.5 days or so, but now I'm setting the router to automatically reboot every day so I can move on with life.
  • Check /opt/share/nginx/error.log and /opt/share/nginx/html/php_error_log.txt
  • One user recommended using an opcode cache like eAccelerator or APC. (eAccelerator looks like it's installed…I checked info.php)

To Do

Web Hosting Ideal Programs

  • SAMBA share
  • SimpleScripts for easy program installing
    • From simplescripts email:
    • Once you have logged in, try clicking on a script from the Script List. You'll need to enter your web hosting account FTP information (your domain name, your FTP username, and your FTP password) the first time you install. The rest should be self explanatory.
  • OpenUpload (for easy and fast temporary file uploading)
  • PHP File Manager eXtplorer, cool, but might not need if you set up SAMBA share. However, might be nice for other people that don't have that sort of access.

Wireless Router in Linux



  • Installed webmin. Default user is root with password and is located at port 10000


//PHP's UID and GID seem to be 33 (www-data) <>
nhergert@Lazarus:~$ sudo chown -R nhergert:www-data /home/nhergert/ServerBackup/ 
nhergert@Lazarus:~$ sudo chmod -R 775 /home/nhergert/ServerBackup/


  • Going to put off working on this until Spring Break due to perseverating on it too much and having a ton of other work I should get to instead! Where I'm at currently:
    • Thinkpad: Heat-gunned the T40 Thinkpad and unfortunately it doesn't even show the IBM boot screen now! (before if I pressed on the palmrest, it sometimes worked). It needs a new motherboard if I want to get it fully working again, which is around $50.
  • Desktop: Needs a Wifi card, or the direct connection to the dorm working correctly. Still takes a ton of power, which I don't really like long-term!
  • Web Hosting: $6.95 a month…ho hum :P


  • Oh boy…shaping up to be an interesting project. I'll have to work for this one. Seems to be an issue with the GPU, which is very interesting as it was the problem my old HP dv4000 probably was having. Anyways, here's a tutorial on fixing it.
    • Be sure to have an IR thermometer, as well as a way to keep the heat from the gun going to other parts of the chip. Tack it down somehow?
    • Also, need solder paste.
  • He also has a good guide on maxing battery life, that might be good for minimizing power usage.
  • Using a SAMBA server for easy access of files seems to be the best method.


  • Someone wants to give me a broken (but very good condition) Thinkpad T40 for free! Fixes 1, Fixes 2


  • Maybe I can just get someone's old laptop and use that instead :P A ton cheaper, and I don't *really* care about the power usage.
  • Ubuntu wireless router setup, someone suggested using Webmin too, although Amahi is another option. (Fedora only for the time being though :()
  • Wireless USB for desktop (or uC if you want wifi) if you want to: $10 at Amazon. here



Re: HOWTO: Setup Ubuntu as a wireless router Some suggestions:

Instead of manipulating iptables directly, consider using shorewall ( it makes configuring iptables much easier and also enables creating “trusted” and “untrusted” zones pretty easily. Also doing NAT/masquerade and port forwarding is also easy.

Second, instead of installing a dhcp server, consider using the dnsmasq package. It's both a DHCP server and a DNS cache and works rather nicely on my Ubuntu software router (I notice you put it in the future plans, though).

For easy web administration, I use webmin ( It's not in the Ubuntu repository but you can find a binary package on their web page. You can configure a lot of settings like that, including shorewall.


  • If it's underpowered, a Beagle Board might be another option…use it for other stuff too! BeagleBoard xM

Ideal Setup/Usage

  • Host Dokuwiki and non-mysql blog on php-enabled web server running on router firmware.
    • Requires dynamic forwarding of domain to home IP address (DynDNS or something like that)
  • Host files (all, including webserver) on NAS or SAMBA (not sure which yet) share for easy editing by all computers on home network(and backup to Dropbox). Society9 Tutorial
  • Allow easy network printing/scanning using attached USB connection (or network cable?)

*Light* Blog/CMS Software

Uses flat files, not MySQL

  • Pivot X A great option, allows for flat files as well, more well-built.
  • FlatPress would be second choice. Seems like good support, built similar to WordPress, and has commenting + akismet easily added!
  • RazorCMS, last option.


  • I like the Tomato Firmware the best for AJAX display of bandwidth usage out of the box. Use Tomato USB for better support of usb and easier setup of web server.

Familiar Routers

  • Asus WL-500g. Faster than old 520gu and has some more space. Specs.
  • Asus WL-520GU. USB 1.1 only, so anything USB is limited to 1.5 MB/sec transfer BOOO. Otherwise very similar

Adding Functionality

like lighttpd, php, etc

Extended Hacking

Adding USB Audio output

  • LifeHacker article with YouTube video (easiest explanation)
  • MightyOhm More in-depth explanation with needing to re-program router with FTDI???
home/routerhacking.txt · Last modified: 2017/09/15 17:58 (external edit)