RouterTech Firmware: extra command line tools (Firmware v2.96)
These commands are mostly in /usr/local/bin/. See features.html for more details.
- 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.
- 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
lnumber of block lists)
- auto_defragenv.sh - a script to defragment the environment after the fragmentation level has passed a specified threshold (default 30 for Adam2, and 50 for PSPboot)
- autoexec.sh (and autoexec1.sh to autoexec7.sh) - runs whatever is passed to it; useful for running things when the router reboots
- 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
- block.sh - block a host (or redirect it to another IP)
- block_baddies.sh - blocks a large number of "bad" web sites
- 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 --proceed". Any other thing, and it will not run.
- block_thumbs.sh - blocks thumbnails from google image searches
- 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.
- 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).
- checkmargins.sh - checks periodically the downstream
(DS) and upstream (US) margins
- checksync.sh - enables sync monitoring in crontab
- chksync - checks whether there is a WAN connection, and, if not, reboots the router
- cm_reboot.sh - reboots the router, using native cm_cli commands (operates immediately, without doing anything else)
- 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.
- cron_disable.sh - sets the router to NOT start "crond" automatically (writes to the bootloader environment)
- cron_enable.sh - returns to the default (to start "crond" automatically) (writes to the bootloader environment)
- cronjob.sh - acts as a
shell to set up cron jobs more easily
- cronjob-env.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
- cron_la.sh - enables the monitoring of line attenuation in crontab
- darkstat - captures network traffic, calculates statistics about usage, and serves reports over HTTP.
- defragenv - defragments the environment
- detachfs - to unmount all mounted minix, smbfs, ftpfs, etc., partitions/mountpoints only
- 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)
- diagnostics.sh - shows router diagnostic information
- edit - easy to use editor (wireless routers only)
- ether-wake (similar to wakelan)
- 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.
- fetch_ds - fetch darkstat from the repository, extract, and run it. It can either the run manually, or via autoexec.sh.
- 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.
- filecomp.sh - compare the sizes of two files
- filesize.sh - report the size of a file
- fixenv - same as defragenv
- flush
- to flush 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)
- force_dns - forces the DNS servers to be set
to the ones specified (pppoa/pppoe connections only)
- freememory.sh - frees up memory by stopping some services
- ftp - ftp client for getting files to/from the router's /var directory (wireless routers only)
- ftpmount
- allows you to mount directories from an ftp server (after loading the
ftpfs driver). Run the command with no parameter for the syntax.
- mjproxy - a very small proxy for SIP.
- getenv - shows the environment variables (in the bootloader environment - "/proc/ticfg/env" for the PSP boot loader, or
"/proc/sys/dev/adam2/environment" for the Adam2 boot loader)
- ipaddr - returns the IP address of the supplied host name
- linecount.sh - returns the number of lines in a text file (or "-1" on error). Empty
lines and comment lines (beginning with a "#") will be ignored. If you
want comment lines to be counted as well, then supply the switch: "--with-comments".
- listconnections.sh - lists the current connections
- localnat.sh - enables local NAT loopback - experimental
- Led - manipulate the router's leds - see here for further documentation.
- makemtd.sh
- create a new mtd partition (and, optionally, a minix filesystem)
automatically (wireless routers only). Run the command with no
parameters to get the syntax.
- memchk.sh - enables memory monitoring and optimisation in crontab
- memopt.sh - runs the memory optimiser
- mjproxy - a very small proxy for SIP
- mjproxyn - a version of mjproxy that supports non-standard SIP devices
- netdate
- updates the system date/time from a remote time server, using the
RFC868 protocol
- netshaper - allows you to limit the bandwidth by IP addresses/ranges (you need to run "setenv netshaper_enable 1" and reboot before you can use it) (wireless routers only)
- 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)
- openvpn.sh
- get OpenVPN from a network sharepoint or from the RouterTech
repository, and run it. Supply "--help" to see the parameters
- pixelserv -
a tiny webserver that serves up a single pixel to any request; it is
useful for blocking adverts by means of "dns poisoning"
- ppp_restore.sh - resets the ppp connection
- pppHB.sh
- half-bridge script - experimental.
- 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
- pptpd_stop.sh - stops the pptpd service
- pptpdstart.sh - starts the pptpd service (after copying the chap-secrets file from a user directory)
- pptpd - a pptp daemon for creating VPNs
- printenv - same as getenv
- reboot.sh - reboots the router after unmounting certain filesystems (minix, smbfs, ftpfs) and any swap file
- reset-config.sh - reset the router's configuration to defaults. Use this command only when everything else fails (i.e., reset from the web interface fails)
- rshaperctl - allows you to limit the bandwidth by IP addresses/ranges (you need to run "setenv rshaper_enable 1" and reboot before you can use it)
- setdate
- to update the system date/time, using the netdate command
- setenv - sets an environment variable (in the bootloader environment) - run "setenv -h" for further information)
- sft_start.sh - starts the "small FTP server" (sft) to receive files on port 5556
- siproxd - starts siproxd (wireless routers only)
- showdns.sh - shows the ISP's DNS information
- showip.sh - shows your WAN IP (pppoa connections only)
- show_la.sh - sends line attenuation information to the system log
- showlog.sh - shows the contents of the system log
- show_nat_settings.sh - shows the current NAT settings
- start_httpd.sh - starts the firmware's http server, optionally specifying the http
server's port (the default port is 80). This script runs during the
boot-up process to start the http server for the web
configuration. You can set the http_port environment variable to a different port if required (or to "none" - meaning don't start the http server at all! Do NOT set http_port to "none" if you have a 1350A wireless firmware. If you do, there will be big trouble!)
- 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!)
- 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.
- time - displays the current system time
- udpxy - allows you to relay multicast UDP traffic to a client's TCP (HTTP) connection
(unicast)
- unsetenv - delete a variable from the bootloader environment
- usb_disable.sh - sets the router to NOT start USB automatically (writes to the bootloader environment)
- usb_enable.sh - returns to the default (to start USB automatically) (writes to the bootloader environment)
- usb_start.sh - starts USB
- usb_stop.sh - stops USB
- ver - display version information (and a whole load of other useful information)
- waitforlan - waits for the LAN to start (or timeout after waiting a while).
- waitforwan - waits for a WAN connection (or timeout after waiting a while).
- wakelan - wakes up PCs on the LAN (run "wakelan --help" for further information)
- wan_uptime - shows how long the router has been connected to the outside world for
- 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
- wol_forward - to wake a machine on the LAN from outside the network
The following are RouterTech firmware helper programs, and should NOT be run directly: rt_dc; rt_word2; mtd3_app; rebt
See other commands below.
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.
Other RouterTech Firmware Commands
/bin/
- chmod
- df
- dmesg (wireless routers only)
- egrep
- grep
- hostname
- kill
- mkdir
- more (wireless routers only)
- mount
- netstat
- rmdir
- sed
- touch
- true
- uname
/usr/bin/
- basename
- clear
- cm_cli_ex (a version of cm_cli that allows redirection of its output)
- du (wireless routers only)
- expr
- find
- free
- id
- killall
- Led (to manipulate the router's leds)
- printf
- sort
- test
- tftp
- which (wireless routers only)
/sbin/
- fsck.minix (check a minix filesystem (wireless routers only))
- mkfs.minix (creates a minix filesystem (wireless routers only))
others (all over the place)
- crond
- crontab
- gunzip
- gzip
- logger
(allows you to write a message to the system log)
- sft
(small ftp server)
- tar
- top
(displays currently running processes and important information about
them)
And a whole host of others ...