User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

home:routerhacking [2017/09/15 17:58] (current)
Line 1: Line 1:
 +====== 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:
 + <code c>
 + //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
 + </code>
 +    * 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!
 + <code nginx.conf>
 + 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_pass;
 +            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;
 + }
 + </code>
 +        * 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
 +=== Crashing ===
 +  * 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 =====
 +  * [[|Get SSH Tunneling Working on Tomato]]
 +===== 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 =====
 +==== 3/21/11 ====
 +  * Need to move this all to a webserver thing under programming!
 +  * [[|Good intro tutorial to cron]]
 +  * [[|Cron email gmail...troubleshooting]]
 +  * [[| Great rsync server backup tutorial 1/4 done]]
 +==== 2/28/11 ====
 +  * Installed webmin. Default user is root with password and is located at port 10000
 +==== 2/24/11 ====
 +  * Fix for installing Ubuntu on GX270:
 +  * Setting chmod and chown permissions correctly...finally!
 +//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/
 +  * [[| How to set up a quick LAMP server on Ubuntu]]
 +==== 2/14/11 ====
 +  * 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. 
 +      * Made the mistake of not heating the bottom
 +      * Smelled something weird around 150 degrees C, but kept going until the recommended 230. It varied widely in temperature at that point, and that was probably how I fried the chip or something
 +      * My heat gun temp was at 450 because it wasn't heating up fast enough  >.<
 +      * Forum postings:
 +      * Link to $50-$70 refurbished board:
 +  * 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! 
 +    * Reviews are great for [[|this USB wifi card]] on Amazon for Ubuntu.
 +  * Web Hosting: $6.95 a month...ho hum :P
 +==== 2/7/11 ====
 +  * 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.
 +==== 2/6/11 ====
 +  * Someone wants to give me a broken (but very good condition) Thinkpad T40 for free! [[|Fixes 1]], [[|Fixes 2]]
 +==== 2/4/11 ====
 +  * 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]]
 +==== 2/3/11 ====
 +  * So, getting a SheevaPlug/PogoPlug might be even better! [[|DreamPlug]]
 +  * Not sure on whether this or a tiny netbook would be cheaper/more useful/better wifi range/more inputs. But then I'm up to $150, $200 range?! And router was just $35...
 +  * [[|Setting up Wireless Router on Ubuntu]]. Read EasyRouter, then main page.
 +  * [[|Some guy's super-optimization of his SheevaPlug]]
 +  * [[|SheevaPlug new user howto]]
 +  * [[|Another Ubuntu Setup Tutorial]] that has some additional programs for visualizing server load...etc...what about port forwarding and stuff, easy setup for that?
 +  * Also, to improve range, just tack an antenna on it somehow...antenna from old Linksys B router?
 +  * {{:home:110203-dreamplug-01.jpg?200|}}
 +==== Administration ====
 +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.
 +===== BeagleBoard =====
 +  * {{:home:bb.277215207_std.jpg?200|}}
 +  * 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.
 +    * Images are a little clunky...
 +    * Best documentation is on [[|old Pivot website]]
 +  * [[|FlatPress]] would be second choice. Seems like good support, built similar to WordPress, and has commenting + akismet easily added!
 +  * [[|RazorCMS]], last option.
 +===== Firmware =====
 +  * 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 =====
 +  * {{  :home:asus_wl500gpv2_mini.jpg?50|}} 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//
 +  * Use the DD-WRT tutorial on [[,_the_Right_Way|OptWare the Right Way!]]. However, doesn't seem to include php by default
 +  * [[|Add some additional things (PHP) using OptWare]]
 +===== 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)