Extra features in the RouterTech.Org Custom Firmware, v2.97

NOTE: Using unofficial firmwares will void your warranty


Features

  1. User supplied DNS  (you have to disable "Use Peer DNS" on the ISP connection page)
  2. Default date/time is set on boot-up to the date/time that the firmware was built
  3. NAT and memory  optimisations 
  4. Support for routers with ATMEL flash chips (e.g., some DLink G604T/G624T). Note that these DLinks use an incompatible switch. This means that you will be unable to configure the ethernet switch manually from software. The switch will operate in automatic mode and the firmware will still work properly. Most users will never need to configure their router's ethernet switch manually, so this is not a major issue.
  5. Support for the wireless routers using the TNETW1350A wireless chip. This requires a different firmware image from the normal wireless routers.
  6. Facility to choose between different DSP modem driver versions (for wireless routers and routers with 4mb flash and 16 mb RAM only (by setting the appropriate value for a new bootloader environment variable, "dsp_ver")) - e.g., running: setenv dsp_ver dsp70A && /sbin/reboot would select DSP v7.00, AnnexA. Choices are between dsp70A/71A/75A, and dsp70B/71B/75B (i.e., AnnexB). Note also that all these are case-sensitive. The normal default is dsp75A. For the TNETW1350A firmware, the default is dsp71A. From v2.9 onwards, there are separate firmware images for Annex A and Annex B.
  7. Facility to choose between different versions of the LED configuration file. - e.g., running: setenv led_conf led.sar600 && /sbin/reboot would select the LED file for the Solwise/Aztech 600E* series. The default is led.generic. Some batch files are supplied in the "led" directory for Windows users to be able to do this by just executing the appropriate batch file. This will run the (supplied) telnet scripter to update the router's environment as appropriate.
  8. Functional DDNS (with no-ip support)
  9. USB support  (see the "RT Configurations" menu). 
  10. Auto execution of shell scripts at bootup. This requires entries in the bootloader environment. If there is any entry in the bootloader environment that points to a shell script (i.e., ending with the extension ".sh") that shell script will be executed everytime the router boots up.  There is a default "autoexec.sh" provided, which just runs any commands passed to it (there are also autoexec1.sh to autoexec7.sh, which do the same thing)
  11. Several extra commands. See the rt_commands.html for details. Some of them can be used for the auto execution feature
  12.  The "System" menu is easily accessible from the top menu bar
  13.  Detailed information on the startup page
  14.  Date/time stamps in the system log
  15. A functional SNTP (under the "Advanced" menu) - this allows your router to synchronise its date/time from public NTP servers - NOTE that the router will often detect a significant time difference when the date/time is corrected, and will log you out from the web interface if you are logged in - you will need to log in again
  16. Another method for updating the system date/time from a remote time server - the "netdate" command (this uses the RFC868 protocol; not all time servers like this protocol, most preferring NTP). This needs to be run manually from the command line. The "setdate" script provides an easy means of using this facility. It uses a default list of time servers (in /etc/netdate.conf), but you can specify your own (separated by spaces) in the "time_servers" environment variable. Use the environment variable - setdate_enable (set to 1) for the system to run "setdate" automatically each time it gets a WAN connection. This will also create a cron job for setdate to be run every 4 hours or, if a second parameter is given to setdate_enable, uses the value in that parameter - e.g., "setenv setdate_enable 1 3" will enable setdate, and will set the cron job to run every 3 hours). The valid range for the second parameter is between 1 and 23 (default=4). No error-ckecking of the value is done, so it is important to get it right. This feature is a low resource alternative to msntp, because it is not running all the time. If msntp is enabled, then this feature is redundant. The time zone can be set manually with the "TZ" environment variable.
  17.  DNS configuration (under the "Setup" menu) - this allows you to specify your ISP's DNS servers manually
  18.  IPAccount (enabled under the "Advanced" menu, and observable under the "Status" menu) - this allows you to see who is using all your bandwidth!
  19.  System Diagnostics (under the "Tools" menu) - this gives you very detailed information about what is going on inside your router
  20.  Optimise RAM (under the "Tools" menu) - this attempts to recover RAM lost due to memory fragmentation and leakage
  21. Run Command (under the "Tools" menu) - this allows you to run from the web configuration interface almost any command that you can run from the login shell. Use this feature with  CAUTION. You could easily trash your router with it. YOU HAVE BEEN WARNED!
  22. The ability for the router to monitor (at specified hourly intervals) whether the external (WAN) connection is active, and to reboot itself it it has lost its sync upon a check being made. This feature is experimental and is only for those who know what they are doing. The feature is enabled by making an entry for "checksync.sh" in the bootloader environment. Entering the following command (only once) from the command prompt in a telnet or ssh session, and then rebooting the router, will do the job:  setenv checksync.sh 6  (this means "do the sync checks every 6 hours" - you can specify any number between 1 and 24 - and if you want to turn it off, run: unsetenv checksync.sh ). See the "RT Configurations" menu. The test for an external connection is done by trying to ping google.com. If you wish to change the external site being pinged from google, then set PING_URL in the router's environment to point to the desired external site.
  23. Removed the user "isp" and password "isp" from the default config.xml. The presence of these settings in the default config.xml was a serious security risk, in that it meant that anyone with access to your PC can login to the router as "isp, isp" and the begin to wreak havoc with your settings!
  24. Default settings provided for several UK ISPs
  25. Remote web access 
  26. WEP turned on by default, and 4 default keys supplied (which should be changed - but it does mean that the router starts with some level of wireless security enabled)
  27. Extra settings ("Channel Range", "Hairy Configuration", and "Production 1") added to the "Wireless" menu - use with extreme caution! Non-1350A firmwares only
  28. Extra features added to the "Tools" menu ("Log Settings", "Gateway System Information")
  29. A full ftp client ("ftp" - for wireless routers only). This allows you when you telnet or ssh to the router, to ftp files in and out
  30. The "small ftp server" ("sft"). This allows you to upload files direct from your PC (via a client-side "sft") to the router's "/var/" directory (ram disk) without having to install an ftp server on your PC
  31. Scheduling programs/commands to run at specified times, via "cron" (the crontab file is: "/root_cron"). You can add entries to that file manually (in "crontab" format) to do your scheduling, or you can use the built-in commands: cronjob.sh or cronjob-env.sh. The latter makes the scheduled jobs persist between reboots of the router. Run the scripts with no parameter to see the syntax. External programs being run via cron must be given with their full path names.
  32. A "wakelan" command - to wake up PCs on a LAN (also, "ether-wake" does a similar thing). "wol_forward" does the same thing, but from outside the network. "wol_forward" is accessed by the wol_forward environment variable - e.g.,  setenv wol_forward "ppp0 br0 7" -  the parameters in double quotes are passed directly to the wol_forward application, and contain the external interface, internal interface, and port number.
  33. Extra features enabled in Busybox applets
  34. No "manager_get_defaults - !node" bug .
  35. Bandwidth throttling via the "rshaper"  feature. This allows you to limit the bandwidth by IP addresses/ranges - plus a command to configure it: "rshaperctl"
           - e.g., "rshaperctl 192.168.1.6 32768" (will limit the bandwidth of the computer at 192.168.1.6 to 32kbps)
        The rshaper module is NOT loaded by default. You need to enable it in the "RT Configurations" menu. 
  36. Bandwidth throttling via the alternative "netshaper" feature (experimental - and only for wireless firmwares).  This allows you to limit the bandwidth by IP addresses/ranges - plus a command to configure it: "netshaper"
    e.g.,
    "netshaper -d 192.168.1.6 32768" (will limit the bandwidth of the computer at 192.168.1.6 to 32kbps)
    The netshaper module is NOT loaded by default. Run this command to enable it: setenv "netshaper_enable 1" && /sbin/reboot   
    NOTE that the netshaper facility CANNOT be used in conjunction with rshaper. You have to choose one or the other.  Run "netshaper" without any arguments to see the syntax.
  37. Facility for executing commands on bootup - by "RT_cmd_x" entries in the environment ("x") stands for a number or some other distinguishing letter/number: e.g.,
          setenv RT_cmd_1 "rshaperctl 192.168.1.6 32768" (will execute "rshaperctl 192.168.1.6 32768" during bootup - at the tail end of the boot process)
  38. Facility for executing commands at the earliest stages of bootup - by "RT_init_x" entries in the environment ("x") stands for a number or some other distinguishing letter/number: e.g.,
          setenv RT_init_1 "mount -t minix /dev/mtdblock/5 /nvram" (will execute "mount -t minix /dev/mtdblock/5 /nvram" very early in the boot process - and long before the commands loaded via RT_cmd_x)
  39. Friendly text editor - "easyedit" (renamed "edit" in the firmware) (for wireless routers and non-wireless routers with 4mb flash and 16mb RAM)
  40. scp support - allows you to use WinSCP or other scp clients to upload/download files to/from the router (for wireless routers and non-wireless routers with 4mb flash and 16mb RAM). Note that ssh is not supplied, so there is a limit to what can be done with scp.
  41. For wireless routers and non-wireless routers with 4mb flash and 16mb RAM: SMBFS support - with the command "smbmount". This allows you to mount shared network drives on your router. There is a ready-made mountpoint "/smbfs" that can be used for mounting
        Syntax:
        smbmount //<server_ipaddress>/<share_name> <mountpoint> -o username=MyWindowsLoginName,password=MyWindowsPassword
       
        Example:
        smbmount //192.168.1.3/scratch_drive /smbfs -o username=freddy,password=ddyfre   
        This will give you read/write access (at "/smbfs/") to the shared directory "192.168.1.3/scratch_drive"

        WARNING: You MUST unmount any shared drive before any attempt to upgrade a firmware, and before turning off your router.
  42. For wireless routers and non-wireless routers with 4mb flash and 16mb RAM: ftpfs support added. This allows you to mount  directories from an ftp server onto the router. There is a ready-made mountpoint "/ftpfs" that can be used for mounting. Enable the ftpfs support by running "insmod ftpfs.o" at a telnet/ssh login prompt and then running "ftpmount" to do the mounting. You'd better have a decent bandwidth with your ftp server, otherwise performance will suck.
    Syntax:
         ftpmount [user[:password]@]hostname[:port ][/root_dir] mount_point [-own] [-uid=id] [-gid=id] [-fmask=mask] [-dmask=mask] [-active]
    Example:
              insmod ftpfs.o
    ftpmount root:password@myftp.com/root/export /ftpfs   
    This will give you read/write access (at "/ftpfs/") to the directory: directory "/root/export" on the ftp server "myftp.com"
    It is generally a good idea not to supply your password as a parameter, since ftpmount will ask for it.

     WARNING: You MUST unmount the ftpfs mount before any attempt to upgrade a firmware, and before turning off your router.
  43. For wireless routers and non-wireless routers with 4mb flash and 16mb RAM: Minix (read/write) filesystem support. This allows you to create read/write Minix partitions on the router.
    There is a ready-made mountpoint "/nvram" that can be used for mounting. The makemtd.sh command can (if you use the "auto_minix" parameter) help you to create a minix filesystem automatically (e.g., "makemtd.sh mtd5 256 auto_minix").  If you wish to create the minix filesystem manually, then do the following:
            A. create a new mtd partition, in kilobytes - multiples of 64kb. The only valid sizes are: 64; 128; 192; 256; 320; 384; 448; 512; 576; 640; 704; 768; 832; 896  (e.g., "makemtd.sh mtd5 128")
            B. reboot the router
            C. convert it to minix (e.g., "mkfs.minix /dev/mtdblock/5")
            D. mount it (e.g., "mount -t minix /dev/mtdblock/5 /nvram")
               After this, you can write/read from/to "/nvram"
            E. If you want this to be mounted automatically during bootup, use the "RT_cmd_x" functionality
                e.g. setenv RT_cmd_minix1 "mount -t minix /dev/mtdblock/5 /nvram"
            F. The system will look for "/nvram/startup.sh" upon boot up, and will execute it if it is found
            G. Always unmount the partition before rebooting, turning off the router, or flashing a new firmware
               (e.g., "umount /nvram") otherwise you WILL lose data.
         DIRE WARNINGS:
        1.  This feature works okay in our tests - but your mileage may vary. Do NOT use this feature unless you are very familiar with unbricking bricked routers. Most importantly, ensure that there is enough free space on your router's flash for the partition that you want to create, or you will get a VERY BIG crash!
        2. You MUST unmount any minix partition before rebooting or turning off the router, and before any attempt to upgrade a firmware,
         otherwise the upgrade will NOT happen!!!!!
  44. For wireless routers and non-wireless routers with 4mb flash and 16mb RAM: commands for minix filesystem support:
            mkfs.minix - create a new minix filesystem
            fsck.minix - check a minix filesystem
  45. Experimental half-bridge support (see pppHB.sh). See here for details and a FAQ.
  46. New upnp daemon based on miniupnpd (see readme.upnp.txt) 
  47. Experimental script to enable "WAN IP local NAT Loopback" (localnat.sh)
    Usage: "localnat.sh UP" to setup/refresh; "localnat.sh init" to install and update on each ppp-up event; "localnat.sh exit" de-installs. 
  48. User writable /etc/ppp/ip-up and /etc/ppp/ip-down scripts, currently used by half-bridge, localnat and upnp, but can be added to.
  49. darkstat - (non-wireless routers with 4mb flash only) captures network traffic, calculates statistics about usage, and serves reports over HTTP (e.g., "darkstat -i ppp0"). In order to see the output of darkstat, point your brower to http://192.168.1.1:667 (or click on "Darkstat" in the "Status" menu in the router's WEB interface). For wireless routers, because the (closed source) wireless AP driver is incompatible with some tcpdump packets, packets (out interface) will get dropped, and so the stats on that interface will show zero bytes transferred. This problem does not exist with non-wireless firmwares. Unfortunately, since we do not have the sources for the wireless AP driver, we cannot fix the problem with wireless routers. Wireless routers and routers with 2mb flash can run the fetch_ds command. This will download darkstat from the repository, extract it, and run it (this will need to be done each time the router is rebooted). The web interface to view the darkstat statistics is kept for all firmwares.
  50. Support for siproxd (wireless routers only). If the "siproxd_enable" environment variable is set to 1, this will trigger automatic execution of siproxd each time the router boots up, using a default configuration file (/etc/siproxd.conf). Its password configuration file is /etc/siproxd_passwd.cfg. Both configuration files are extracted to the /var/tmp/ directory, and must be fully prepared before the siproxd binary is started. You can prepare these files with the RT_init_x or RT_cmd_x or autoexec.sh commands (all these run before the siproxd binary is executed). See also mjproxy - a very small proxy for SIP, which uses md5 hashes.
  51. Support for defragmenting the router's environment from with the firmware. All of this must be done from a telnet/ssh login session - NOT from the firmware's "Run Command" feature. The relevant command is: setenv DEFRAG DEFRAG (note the capitals). The shell script auto_defragenv.sh  can be used as a shell for this. It defragments the environment after the fragmentation level has passed a specified threshold (default 30 for Adam2, and 50 for PSPboot). This can be changed by supplying "--threshold=<number>" at the command line, or by setting the new environment variable "DEFRAG_THRESHOLD" to the desired number (where "number" stands for a positive whole number). The number should not normally be less than 20 nor exceed 40 (Adam2) or 60 (PSPboot). Note that no check is done as to whether the number is sensible. The defaults are sensible, and should normally left well alone. The command line parameters take precedence over any value in "DEFRAG_THRESHOLD". 

    Example: auto_defragenv.sh --threshold=35

    These commands must only be run as a last resort. As with any low-level operation that writes to the router's flash chip, things can go badly wrong. The recommended way to defragment the Adam2 bootloader environment is to run "fixenv" from the bootloader command prompt. The recommended way to defragment the PSP bootloader environment is to run "defragenv" from the bootloader command prompt. You will need a serial console to run commands from the bootloader command prompt.

  52. Support for resetting the router's configuration to defaults from the firmware's linux command line (with the reset-config.sh command).
  53. Relaying multicast UDP traffic to a client's TCP (HTTP) connection (unicast) through udpxy. This allows you to use IP TV (UDP multicast) services via wifi. 
  54. Ad blocking, through adblock.sh and adblock_multi.sh. For this purpose, adblock.sh downloads and converts one of a number of common internet resources ("small" or "large") of ad servers to be blocked. The largest of these uses a lot of cpu cycles on the router (about 20%) - but since the router's cpu is largely idle most of the time, this is not a major issue. The smallest consumes only about 5% cpu cycles. Run adblock.sh with no parameters to see the syntax. adblock_multi.sh is a shell to adblock.sh, allowing it to download more than one of the internet lists at once  (e.g., "adblock_multi.sh exit small large"). Note that, for routers with low memory (i.e., 8mb RAM), you should never use "large" or "xlarge". In fact, "small" is the only one that such routers will be able to cope with. If you try to download more lists than your free memory can cope with, your router WILL crash! 

    NOTE: you MUST always run "adblock.sh exit" to remove the adblock features from memory, before any attempt to upgrade the firmware.

  55. pixelserv - a tiny webserver that serves up a single pixel to any request. It is useful for blocking adverts in conjunction with adblock.sh.
  56. dnsmasq - its dns caching functions only (not LAN dhcp). The code has been patched, to reduce size by disabling unused options and functions, to ignore command line parameters, and to do all configuration by configuration file. Additional conf files can be added to /tmp/dns.d/. dnsmasq supports many options and enables additional functions such as auto selection of the fastest responding dns server from all configured, and domain blocking - exploited by the adblock functions.
  57. A hook to run a user-supplied script (/var/tmp/onclose.sh) when before rebooting or shutting down the router via the reboot or shutdown commands. When either command is executed, it will first search for "/var/tmp/onclose.sh", and, if it is found, it will be executed immediately. After this, the normal house-cleaning on reboot/shutdown will continue.
  58. Support for adding extra DNS servers from a selection ("All", "OpenDNS", "FamilyShield", "Google", "UltraDNS", "DNSResolvers", or "BT") in dnsmasq format. You can set the "extra_dns" environment variable to any of these, to a combination of them, or to "All", and you can use either their full names, or the first letter of their names - e.g., setenv extra_dns "F U D B" - will select DNS servers from OpenDNS Family Shield, UltraDNS, DNSResolvers, and BT; setenv extra_dns "A" or setenv extra_dns "1" will select all of them.
  59. Support for adding all the extra DNS servers listed above, in resolv.conf format through the environment variable: extra_resolvers. These servers are prepended to /etc/resolv.conf. In the TWNETW1350A firmware, only the first three will be used.
  60. Support for static DNS servers in DHCP connections (as opposed to pppoa/pppoe connection), via the environment variable: static_dns. Set it to 1 to prevent the dhcp server from overwriting your static DNS entries.
  61. Support for blocking a large number of "bad" sites (porn, weapons, etc.) via the block_baddies.sh command, using OpenDNS "Family Shield" and the adblock features. This command must be run from a telnet/ssh login session. If the parameter "--block_thumbs" is supplied, then thumbnails from google image searches will also be blocked. This command only needs to be run ONCE. After that, it will run by itself on every bootup. To remove the blocks, run "block_baddies_undo.sh" (see below).
  62. Support for OpenVPN (wireless and 4mb-flash non-wireless firmwares only). See "openvpn.sh" below, and OpenVPN RouterTech HowTo.pdf.
  63. Support for pptp-based VPNs (wireless and 4mb-flash non-wireless firmwares only).  This comes via the "pptpd" command. This version is based on Poptop.
  64. Protection from DNS rebind attacks, using the block_rebind.sh script or by using the http_addr environment variable.
  65. Experimental support for using a swap file via smbfs. See the swapfile.sh script below.
  66. Support for Wireless Distribution System ("WDS") in the 1350A wireless firmwares only, via the web interface, or, alternatively, via the wds.sh script.

Scripts

This is a list of the RouterTech custom scripts available in the firmware:
  1. 1350A-reset-eeproms.sh - sets the EEPROMs in the 1350A wireless configuration to generic values. Immediately afterwards, the router will reboot - and then you will need to run the Wireless Environment Builder so that it can fix the EEPROMs. This script should not be used except as a VERY LAST RESORT - after every other attempt to recover a trashed 1350A wireless firmware has failed to repair the wireless functionality.
  2. adblock.sh and adblock_multi.sh - to assist in blocking popup adverts and other nasties (if adblock_multi.sh is run with no parameters, it will download a default number of block lists)
  3. ap_restart.sh (wireless firmwares only) - restarts the wireless access point
  4. auto_defragenv.sh - defragments the environment after the fragmentation level has passed a specified threshold (default 30 for Adam2, and 50 for PSPboot) - this should only ever be run from a telnet/ssh login session
  5. autoexec.sh (and autoexec1.sh to autoexec7.sh) - runs whatever is passed to it; useful for running things when the router reboots
  6. bandwidth.sh - allows you to throttle the bandwidths of those who have exceeded a specified transfer bandwidth (default 500mb), and to display bandwidth usage data. Run it without any parameter to see the syntax. Requires IP Account to be enabled
  7. block.sh - to block a host (or redirect it to another IP)
  8. block_baddies.sh - blocks a large number of "bad" web sites, using the force_dns features and OpenDNS Family Shield servers for DNS, plus the adblock features for extra blocking
  9. block_baddies_undo.sh - to undo what was done by block_baddies.sh (the router will be rebooted afterwards). To prevent this command being executed accidentally, you will need to give it the parameters: "--confirmed --proceeed". Any other thing, and it will not run
  10. block_rebind.sh - to block DNS rebind attacks using iptables commands
  11. block_thumbs.sh - to block thumbnails from google image searches
  12. check_ddns.sh - checks whether the dynamic DNS IP address of the supplied host is up-to-date. If not, it will reset the ppp connection (e.g., "check_ddns.sh myhome.noip.com" will check whether the IP address of "myhome.noip.com" is the same as the IP address of the current ppp connection). If no parameter is supplied, then the ddns host name will be fetched from the router's live configuration.
  13. check_env - a rough and ready check to see whether the bootloader environment is fragmented (a return of "0" means that the environment does not appear to be fragmented, and "1" means that it appears to be fragmented)
  14. checkmargins.sh - checks periodically the downstream (DS) and upstream (US) margins, and reset the connection (or optionally reboot the router) if either of them goes below a certain number
  15. checksync.sh - enables sync monitoring in crontab
  16. chksync - checks whether there is a WAN connection, and, if not, reboots the router
  17. cm_reboot.sh - reboots the router, using native cm_cli commands (operates immediately, without doing anything else)
  18. cmd - a command-line shell to cm_cli_ex, to run configuration commands or retrieve configuration values via cm_cli_ex
  19. connections.sh - to provide diagnostic information about your internet connection. It should always be run from a telnet/ssh login session. Run this before reporting connectivity problems.
  20. cron_disable.sh - sets the router to NOT start "crond" automatically (writes to the bootloader environment)
  21. cron_enable.sh - returns to the default (to start "crond" automatically) (writes to the bootloader environment)
  22. cronjob.sh - acts as a shell to set up cron jobs more easily, and makes the cron job persistent by making an entry into the bootloader environment
  23. cronjob-env.sh - acts as a shell to set up cron jobs more easily
  24. cron_la.sh - enables the monitoring of line attenuation in crontab
  25. defragenv - defragments the environment
  26. deletemtd.sh - delete the mtd5 partition and restore the mtd partition table to the values before a new mtd partition was created (wireless routers only)
  27. detachfs - unmounts all mounted minix, smbfs, ftpfs, etc., partitions/mountpoints only
  28. diagnostics.sh - shows router diagnostic information
  29. fetch_driver - fetches the usb driver or the ftpfs driver from the repository, extract the driver module, load the driver, and optionally run a command. Run the command without any parameters to see the syntax.
  30. fetch_ds - fetches darkstat from the repository, extract, and run it. It can either the run manually, or via autoexec.sh.
  31. fetch_smb - for non-wireless firmwares with 2mb flash and 8mb RAM only; to fetch the smbfs driver and support binaries from the RouterTech repository, extract the files, load the driver, and optionally run a command (typically, to run swapfile.sh to create/load a swap file). This is an experimental feature. Treat it as such.
  32. filecomp.sh - compare the sizes of two files
  33. filesize.sh - report the size of a file
  34. fixenv - same as defragenv above
  35. flush - flushes all pending writes to minix/smbfs partitions so that they are not lost if the router is switched off without shutting down properly. Ideally, this command should be run every time you write to a minix/smbfs partition. If you have any mounted smbfs partitions, then you need to supply the username and password to the flush command (these are ignored in respect of minix partitions, but are needed in order to reload smbfs partitions).
  36. force_dns - forces the DNS servers to be set to the ones specified (pppoa/pppoe connections only)
  37. freememory.sh - frees up memory by stopping some services (the http server, USB, darkstat, wireless, SNTP, IPAccount, and the upgrader file)
  38. getconf - shows a configuration variable (in the RouterTech block of config.xml)
  39. getenv - shows the environment variables (in the bootloader environment)
  40. linecount.sh - returns the number of lines in a text file (or "-1" on error)
  41. listconnections.sh - lists the current connections
  42. localnat.sh - enables local NAT loopback - experimental
  43. makemtd.sh - create a new mtd partition (and, optionally, a minix filesystem) automatically (wireless routers only) - this should only ever be run from a telnet/ssh login session
  44. memavail - reports the amount of RAM that is "available" to be used (a combination of free and "inactive" memory)
  45. memchk.sh - enables memory monitoring and optimisation in crontab
  46. memopt.sh - runs the memory optimiser
  47. minix.sh - an easy way to create a new minix partition (this is just a shell to makemtd.sh)
  48. onconnectWAN - this is executed (after being copied to /var/tmp/) by the ip-up script when a WAN connection is achieved; by default it runs crond and darkstat (if they are enabled)
  49. openvpn.sh - run OpenVPN (after fetching the binary, if necessary, from a network sharepoint or from the RouterTech repository. Supply "--help" to see the parameters.
  50. openvpn_stop.sh - stop OpenVPN, and clear its temporary files.
  51. ppp_restore.sh - resets the ppp connection
  52. pppHB.sh - half-bridge script - experimental.
  53. pppoe_bug_fix.sh - to facilitate the fixing of pppoe problems that arise out of an invalid DSL MAC address in the router's environment
  54. pptpd_stop.sh - stop the pptp service
  55. pptpdstart.sh - start the pptp service (after copying the chap-secrets file from a user directory)
  56. printenv - same as getenv
  57. reboot.sh - reboots the router after unmounting certain filesystems (minix, smbfs, ftpfs) and any swap file
  58. reset-config.sh - resets the router's configuration to defaults. Use this command only when everything else fails (i.e., reset from the web interface fails) - this should only ever be run from a telnet/ssh login session
  59. saveall.sh - saves configuration settings to flash
  60. save-reboot.sh - saves all config changes and reboots
  61. setdate - updates the system date/time, using the netdate command
  62. setconf - sets a configuration variable (in the RouterTech block of config.xml); note that any value written with setconf will be wiped out whenever the firmware is reset to defaults.
  63. setenv - sets an environment variable (in the bootloader environment) - run "setenv -h" for further information)
  64. sft_start.sh - starts the "small FTP server" (sft) to receive files on port 5556
  65. showdns.sh - shows the ISP's DNS information
  66. showip.sh - shows your WAN IP (pppoa connections only)
  67. showmacs.sh - displays all the router's stored MAC addresses
  68. show_la.sh - sends line attenuation information to the system log
  69. showlog.sh - shows the contents of the system log
  70. show_nat_settings.sh - shows the current NAT settings
  71. start_httpd.sh - starts the firmware's http server, optionally specifying the http server's port (the default port is 80).
  72. stop_httpd.sh - stops the firmware's http server
  73. ucast_solicit.sh - works around routing problems on the networks of two (which shall remain nameless) UK ISPs (they should really sort out their equipment!).
  74. swapfile.sh - to create/load/unload a swap file via smbfs. This gives the router some virtual memory and gives the router more memory to play with. It requires a network shared directory that is always available to the router on which to create and mount the swap file (a NAS would do just fine - or a shared directory on a PC that is guaranteed to always be switched on). If you try to run with a swapfile on a directory that ceases to be available, the consequences cannot be predicted (but the router will probably crash). This is a highly experimental feature. Treat it as such.
  75. time - displays the current system time
  76. unsetconf - delete a configuration variable from the RouterTech block of config.xml
  77. unsetenv - delete a variable from the bootloader environment
  78. uptime - parses and displays the system uptime information.
  79. usb_disable.sh - sets the router to NOT start USB automatically (writes to the bootloader environment)
  80. usb_enable.sh - returns to the default (to start USB automatically) (writes to the bootloader environment)
  81. usb_start.sh - starts USB
  82. usb_stop.sh - stops USB
  83. ver - displays version information (and a whole load of other useful information).
  84. waitforlan - waits for the LAN to start (or timeout after waiting a while).
  85. waitforwan - waits for a WAN connection (or timeout after waiting a while).
  86. wan_uptime - shows how long the router has been connected to the outside world for
  87. wds.sh - to setup WDS on a 1350A wireless router; run with no parameter to see the syntax
  88. wifi - to start/restart or stop the wireless AP (use with care on 1350A routers; after turning off, you may need to reboot to restart the AP)
  89. wlan_setvalue.sh - to change some wireless settings. This is useful for changing things that are not possible to change from the web interface (e.g., country, etc). Use with great care. If you mess up the wireless settings with this script, you will need to reset the router to defaults. If you are happy with the changes that you have made, run saveall.sh to save the changes.
See also rt_commands.html and history.html.


Environment Variables:
This is a list of the RouterTech custom environment variables that can be used to configure how the firmware behaves:
  1. adblock - schedule adblock_multi.sh to run when a WAN connection is made - the values should be the parameters that you wish to pass to adblock_multi.sh, On routers with 8mb RAM, you should only supply "small" - do NOT try to use the large list on such routers.
  2. atm_ver - specify an alternative tiatm driver (wireless and 4mb-flash firmwares only)
  3. block_icmp - if set to 1, it will provide extra security by blocking most ICMP packets (no NOT use this if you want to run OpenVPN)
  4. block_thumbs - if set to 1, it will block thumbnails from google image searches (pppos/pppoe only)
  5. clamp_mss - specify whether to clamp the MSS. This is enabled automatically on routers with 16MB RAM; see also mss_value, below
  6. DEFRAG_THRESHOLD - specify a different maximum fragmentation threshold for the auto_defragenv.sh script
  7. darkstat_enable - enable darkstat (wireless and 4mb-flash firmwares only)
  8. darkstat_parms - specify parameters to be passed to darkstat
  9. dropbear_timeout - specify the idle timeout (in seconds) for ssh connections. Set to 0 (zero) for an indefinite timeout.
  10. dsp_ver - specify an alternative DSP driver (wireless and 4mb-flash firmwares only)
  11. extra_dns - add OpenDNS and/or Google DNS servers, in dnsmasq format
  12. extra_resolvers - add both the OpenDNS and Google DNS servers, in resolv.conf format (these servers are prepended to /etc/resolv.conf)
  13. force_dns - (for pppoa/pppoe connections only) to force the DNS servers to be set to the ones specified
  14. led_conf - specify an alternative LED configuration file
  15. http_addr - specify the IP address to bind the http server to; this is optional - do not use unless you know what you are doing
  16. http_port - specify a custom port for the http server (if set to "none", then the http server will not be started during the bootup process - this can save significant memory on low memory routers - but you will not be able to open the web configuration with this setting; if you thereafter wish to configure the router from its web interface in such a case, you will need to run start_httpd.sh from the command line, either with no parameters, or with the desired port number). Do NOT set http_port to "none" if you have a 1350A wireless firmware. If you do, there will be big trouble!
  17. min_margins - provide minimum acceptable DS and US (and, optionally, "reboot") for the checkmargins feature. The defaults are set very low (DS=5, and US=10)
  18. min_uptime - specify the minimum period for which the router must have been running before checkmargins should take any action (default=2 hours)
  19. mss_value -  if this is present, and clamp_mss is defined, then the MSS is set to that value
  20. no_auto_vlynq - set this to 1, to prevent the 1350A wireless firmwares from automatically setting "vlynq_polarity" to "low"
  21. openvpn - enable OpenVPN; specify the parameters to pass to openvpn.sh, or set to "--config" to obtain this from the "VPN" variable in the config.xml (set the VPN variable with the "setconf" command); or set to "1" to simply enable OpenVPN (using default parameters, or parameters in other openvpn* environment variables)
  22. openvpn_bin_dir - specify the location of the OpenVPN binaries (or pass the location in "--bin_dir" to openvpn.sh at the command line)
  23. openvpn_cert_dir - specify the location of the OpenVPN certificate files (or pass the location in "--cert_dir" to openvpn.sh at the command line)
  24. PING_URL - specify the value to be used in the WAN connection ping checks (instead of google.com)
  25. pptpd - set to 1 to run pptpdstart.sh automatically when the router boots up
  26. pptpd_user_dir - points to the location of user configuration files for pptpd. The default is /nvram/pptpd/ (i.e., on your minix partition, if any). Use this variable to override the default - otherwise, you will need to run pptpdstart.sh manually, and to pass it the "--pptpd_user_dir" switch pointing to the relevant directory. Everything in this directory will be copied to the /var/tmp/ directory by pptpdstart.sh before starting the pptpd service. So you can have your own custom options.pptpd and pptpd.conf files there. If so, they will override the defaults supplied with the firmware. Your chap-secrets file MUST be in this directory.
  27. RT_cmd_x - execute commands at the later stages of the bootup process - ("x") stands for a number or some other distinguishing letter/number
  28. RT_connect_x - execute commands every time a WAN connection/reconnection is made - ("x") stands for a number or some other distinguishing letter/number 
  29. RT_init_x - execute commands very early during bootup - ("x") stands for a number or some other distinguishing letter/number
  30. save_bootlog - set this to 1 (one) and the kernel's boot messages will be saved in /var/log/boot.log
  31. setdate_enable - set the system to run setdate automatically each time it gets a WAN connection
  32. siproxd_enable - trigger automatic execution of siproxd each time the router boots up (wireless routers only)
  33. siproxd_users - provide user parameters to siproxd on automatic startup (wireless routers only)
  34. static_dns - prevent the dhcp server from overwriting your static DNS entries (DHCP connections)
  35. utelnetd_timeout - specify the idle timeout (in seconds) for telnet connections. Set to 0 (zero) for an indefinite timeout.
  36. usb_enable - enable USB
  37. time_servers - to specify alternative time servers (space-separated) for the setdate command (e.g., setenv time_servers "foo.net bar.com blat.org")
  38. TZ - set the time zone manually for the use of the setdate/netdate commands. See "timezones.txt" in the firmware documentation for the list of available codes. This will cause the /etc/TZ file to be updated with the correct values for setdate and other "time" programs. NOTE: the /etc/TZ file will be overwritten by msntp if you enable sntp.
  39. wol_forward -  wake a machine on the LAN from outside the network
See also rt_commands.html and history.html.


NOTES:
Of the above shell scripts, the following can be executed on bootup by making entries for them in the bootloader environment ("/proc/ticfg/env" for the PSP boot loader, or "/proc/sys/dev/adam2/environment" for the Adam2 boot loader).

Examples:
1. autoexec.sh (and autoexec1.sh up to autoexec7.sh)
e.g.,
setenv autoexec.sh "wget http://fpp.com/bar.sh -P /var && chmod a+x /var/bar.sh && /var/bar.sh"
This will set up the router to fetch a script (bar.sh) from a website, set its executable flag, and then run it, everytime the router boots up.

2. checksync.sh
e.g.,
setenv checksync.sh "1"
This will set up the router to monitor the router sync status every hour

setenv checksync.sh "1 30"
This will set up the router to monitor the router sync status every 30 minutes

3. cron_la.sh
e.g.,
setenv cron_la.sh "2"
This will set up the router to log the line attenuation figures every 2 hours

4. memchk.sh
e.g.,
setenv memchk.sh "1"
This will set up the router to run the memory optimiser every hour

setenv memchk.sh "1 15"
This will set up the router to run the memory optimiser every 15 minutes of every hour

5. RT_cmd_<x>
Here, "x" stands for a number or other unique identifier (e.g., "RT_cmd_1"). This feature allows you to specify certain commands to be executed automatically when the router boots up.
e.g.,
setenv RT_cmd_1 "rshaperctl 192.168.1.3 524288"
This will set up the router to run the rshaperctl commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.

6. RT_init_<x>
Here, "x" stands for a number or other unique identifier (e.g., "RT_init_sys1"). This feature allows you to specify certain commands to be executed automatically when the router boots up, at a very early stage of the bootup process.
e.g.,
setenv RT_init_rshaper "rshaperctl 192.168.1.3 524288"
This will set up the router to run the rshaperctl commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.
or
setenv RT_init_shaper2 "netshaper -d 192.168.1.3 524288"
This will set up the router to run the netshaper commmand on bootup, to throttle the bandwidth of the computer at 192.168.1.3 to no more than 512kbps.

Known issues

  1. SNMP will probably still kill the router, requiring a reboot (it eats memory, until the router runs of out RAM and crashes). The IPAccount feature provides some of the information that would normally be sought by using SNMP. Normally, you should refrain from using the SNMP feature.
  2. Low memory situations can often occur with non-wireless routers (especially after heavy P2P sessions) causing the router to need a reboot. If you get this problem often, then you can free up some memory by turning off IP Account and disabling the USB driver and the rshaper driver if you have loaded it (or run "freememory.sh").
  3. If you have a serial console cable, you may see "select: bad file descriptor" messages on the serial console when navigating the router's web interface. This is not a problem and the messages should be ignored.
  4. Adam2 is seriously broken and is generating much noise in our forum. In most relevant respects, Adam2's problems cannot be fixed, due to problems in closed source binaries that we do not have the source code for, and therefore cannot fix ourselves. There are several problems with Adam2-based routers that therefore can not and will not be fixed. The manufacturers all abandoned this bootloader several years ago, and for very good reason. Our firmwares have extended the lives of many such routers, but the inherent problems are still there. If people can change their bootloader to PSPboot, then fine. However, this is something that we do NOT recommend, because it is very difficult to achieve, and a major brick (which would require a serial cable and/or JTAG to fix) is a very probable result of trying to do so. Those with Adam2-based routers may simply have to live with the problems of a broken bootloader.

Some useful RouterTech firmware tools

Visit our forum (http://www.routertech.org/)