Optware on ASUS RT-N16 Stage 2

So you really followed all my posts...
Really... thats good and it means you really want to install things.
So without any more a-due let us continue.

Stage 1 - Formatting and Partitioning USB Storage - Completed 

Stage 2 -  Installing Optware, the Right Way


Installing Optware, the Right Way


This is the latest, greatest and easiest way to enable Optware on your Router. It is recommended that you have a router with USB capable storage (Harddisks (must be self-powered), flash-drives etc.) and the LATEST build! (preferably freshly flashed)
Another aspect to note is that some of these services (i.e Twonky) consume alot of CPU resources, so make sure you check your resource consumptions.
Default Services that will be installed:
  • Bash instead of shell in busybox - (LFS support)
  • Automounting, Unmounting and Hotmounting of storage devices - Automatically mounts all recognized partitions and filesystem formats (including NTFS in K26).
  • Network printing with Watchprinter - Plug a USB printer into your router and let anyone on the LAN (or even WAN) print.
  • Torrent transmission with watchdog - Including Bittorrent transmission with Web Administration
  • Pre-configured Samba share - Samba provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. http://www.samba.org/
  • NFS File Sharing - It is now possible to share files via NFS in a pure Linux environment.
  • Xinetd - A replacement for inetd, the internet services daemon. Controls user defined network services such as printing and SWAT (Samba Web Administration Tool) http://www.xinetd.org/
  • Pound - A lightweight open source reverse proxy program suitable to be used as a web server load balancing solution. http://www.apsis.ch/pound/
  • Vlighttpd - Allows you to get a 2nd IP on your system and run virtual hosting there.
  • Pixelserv - A super minimal webserver, it's one and only purpose is serving a 1x1 pixel transparent gif file. Using some creative firewalling (netfilter/iptables) rules you can redirect some webrequests (for adds for example) to pixelserv. http://proxytunnel.sourceforge.net/pixelserv.php
  • AsiaBlock - A custom iptables firewall that is configurable to block certain countries from accessing your Webserver, FTP or just general Web surfing.
  • Worldblock - Very similar to Asiablock, other than the fact that it is for blocking everything except your country. To properly use this service, you must know how to use Vi editor to add your country.
  • StopHack - This CRON script will check /var/log/messages for pound entries that are malicious and put the IP's in /opt/etc/asia.spam. The AsiaBlock service MUST be running for this to work.
  • Stophammer - Similar to stophack, only it provides firewall services that increase your network security in a very respectable fashion. See Service examples below to understand how it works.
  • Vim with proper terminal support - Vim is an advanced text editor that seeks to provide the power of the de-facto Unix editor 'Vi', with a more complete feature set. http://www.vim.org/about.php
  • Siproxd - A masquerading SIP Proxy Server. Siproxd is a proxy/masquerading daemon for the SIP protocol. It handles registrations of SIP clients on a private IP network and performs rewriting of the SIP message bodies to make SIP connections work via an masquerading firewall (NAT). It allows SIP software clients (like kphone, linphone) or SIP hardware clients (Voice over IP phones which are SIP-compatible).
  • Fixtables - This service is used to fix a firewall rule-set bug that is present in all K26 firmwares. K24 is not affected. The service also contains VITAL security measures against current DD-WRT builds! It is highly recommended to use.
  • Zabbix - Zabbix offers advanced monitoring, alerting and visualization features today which are missing in other monitoring systems, even some of the best commercial ones. This service blows away SNMP, Cacti, Wallwatcher, etc. For more information, search the forums and check out the website! http://www.zabbix.com/features.php
  • Reloc_syslogd - A service that is designed to extend the size of DD-WRT's syslogd and integrate kernel logging into /opt/var/log/messages
  • Service tool - Control all of these services. (Usage explained below)
  • Services running as other users than root
  • Other various useful tools such as net and storage diagnostics..

Connecting the Drive to your Router


1. In the DD-WRT web GUI screen, on the Services USB tab enable the options for:
  • Core USB support
  • USB storage support
  • Printer Support (optional)
  • Automatic Drive Mount
2. From the DD-WRT web GUI screen, click on Save Settings, then Apply Settings 3. If everything was done correctly, this should appear on your Services -> USB Tab:
Image:USBmount.png

IMPORTANT
If using a USB hub to connect multiple devices, make sure NOT to overload the routers power supply. If the devices are self-powered, still be careful. Flashdrives do consume quite a bit of power, and even the I/O of the self-powered devices pulls some current.

Executing the Script

Start a terminal session using telnet or SSH

To do this in Windows, go to Start -> Run and type the following:
telnet 192.168.1.1 (use the ip address of your router if different than 192.168.1.1)
Enter the following at the telnet prompt:

login:root

password: router's admin password to the web interface.


NOTE When entering your password, the characters will not show up. This is normal for security. If it doesn't work the first time, make sure you don't make a typo or that the caps lock is not on when entering it.



In Windows, telnet can be accessed from a command prompt... Start ->Run, while a program like PuTTY will allow for either telnet or SSH sessions and is a much more flexible and secure shell prompt. It does not even need to be installed..

NOTE - Can't login via SSH

If you find that you can't log in to SSH after installation, check that you're using a build greater than, and including 12827. The reason is that bash is used as shell after installation, but older firmware builds don't allow for shells other than /bin/sh to be used in SSH.
Once logged in:

Make sure you are able to connect to the internet through the router. Pinging a domain is a good example:
 
ping yahoo.com (or any other domain of your choice)
You should get a multi-line response along the lines of:
PING yahoo.com (72.30.2.43): 56 data bytes
64 bytes from 72.30.2.43: icmp_seq=0 ttl=52 time=106.551 ms
64 bytes from 72.30.2.43: icmp_seq=1 ttl=52 time=102.864 ms
64 bytes from 72.30.2.43: icmp_seq=2 ttl=52 time=101.219 ms
64 bytes from 72.30.2.43: icmp_seq=3 ttl=52 time=100.507 ms
64 bytes from 72.30.2.43: icmp_seq=4 ttl=52 time=96.661 ms

Once you see a few lines of that, hit CTRL+C to return to a root prompt.
If you do NOT see output as mentioned above, you need to troubleshoot to establish an internet connection first.

Some possibilities:


A) Reboot the router. (this alone may help. If not, continue to suggestion B)

B) Power off your cable modem, then the router.
Wait 30 seconds, then power on the cable modem.
Wait 30 seconds and power on the router.
Wait 30 seconds, then telnet back into the router and repeat the ping test demonstrated above.

Now you should have a connection. If so, continue with the following steps.

Enter the following commands into Busybox/Telnet:
 
wget -O /tmp/prep_optware http://wd.mirmana.com/prep_optware 

sh /tmp/prep_optware


Upgrade Command is the same

This will load all the necessary Optware and supporting scripts that Frater wrote from the ground up.
This will take about 10-20 mins depending on your connection and your router CPU clock. Close your Web Interface as this consumes precious memory and CPU resources
Once everything has completed, wait you will be returned to a root prompt. Wait a minimum of 1 minute, then type reboot into either the BusyBox/Telnet Shell (why not, you're right there) or reboot via Web Interface.
Important After rebooting, wait again at least another minute before logging back into the Telnet/SSH session!

Ensure Partitions are mounted

In either telnet or SSH, enter the command mount , or the other commands underlined in red , if everything is working properly, it should look like this:


Image:EnsuringFSMount.png



Important To keep track of your drives free space, issue the command df -h


You will get an output like this:


root@Asus:~# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                5.7M  5.7M     0 100% /
/dev/root             5.7M  5.7M     0 100% /
/dev/discs/disc0/part1
                     756M  215M  534M  29% /opt
/dev/sda4             293G  173G  117G  60% /mnt
/dev/sda3             504M   17M  483M   4% /tmp/c
root@Asus:~#





Using PuTTy to enable/disable Services

Image:ServiceNew.png



BusyBox/Telnet Commands for services:
service - show all services (enabled/disabled)
service <service name> - if "status" parameter is supported, will show service status, otherwise will show whether specified service is running
service <service name> on - Enable the script, allowing execution (chmod +x  /opt/etc/init.d/S<servicescript>)
service <service name> off - Disable the script, disallowing execution (chmod -x  /opt/etc/init.d/S<servicescript>)
service <service name> start - Start/execute the script, as long as service is enabled (i.e. permissions allow execution)
service <service name> stop Stop/kill the script, if the service is running
service <service name> restart Stop/kill the script, if the service is running, and then start/execute the script, as long as service is enabled
service <service name> <parameter> - Run the script with the parameter.
For a service to work it must be first switched on*, and then told to start.
service <service name> on
service <service name> start
  • Once you enable a service with the on parameter, the service is set to allow execution, and will run the next time you restart your router. You will need to issue a start directly proceeding it to initiate the service if you wish to start the service without restarting your router. A service must be set to on before it can be started.
For downloading torrents you need to enable and start transmission service.
command is
service transmission start
Then wait for 2 minutes and then goto address 192.168.1.2:9091

Turn off the twonky server as it consumes lot of resources


service twonky stop
service twonky off

Now you are done and enjoy your router's super performance.

Leave comment if you like it...

No comments:

Post a Comment