MyPage

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 16:41, 13 January 2010 (edit)
Gi-minni (Talk | contribs)
(Configuration)
← Previous diff
Revision as of 16:44, 13 January 2010 (edit) (undo)
Gi-minni (Talk | contribs)
(Status)
Next diff →
Line 4: Line 4:
<span style="color:#b40404; font-weight:bold;">Be careful and consider that things written/showed here can be different to the current available version.<br /></span> <span style="color:#b40404; font-weight:bold;">Be careful and consider that things written/showed here can be different to the current available version.<br /></span>
<span style="color:#b40404; font-weight:bold;">This info will be immediately deleted after the official announcement was posted in the forum.<br /><br /></span> <span style="color:#b40404; font-weight:bold;">This info will be immediately deleted after the official announcement was posted in the forum.<br /><br /></span>
-<span style="color:#b40404; font-weight:bold;">Thanks and I apologize for any inconvenience caused to you.<br /></span> [[User:Gi-minni|gi-minni]]+<span style="color:#b40404; font-weight:bold;">Thanks for your understanding and I apologize for any inconvenience caused to you.<br /></span> [[User:Gi-minni|gi-minni]]
== Introduction == == Introduction ==

Revision as of 16:44, 13 January 2010

Contents

Status

This wiki page is currently under construction to reflect changes upcoming with Version 0.13.
Be careful and consider that things written/showed here can be different to the current available version.
This info will be immediately deleted after the official announcement was posted in the forum.

Thanks for your understanding and I apologize for any inconvenience caused to you.
gi-minni

Introduction

The main advantage to expand the DD-WRT web interface with your own scripts is the ability to quickly see what happens with your router without opening an ssh or telnet shell and thinking around which command must be executed to see some useful results.

Many of us that use DD-WRT have small or no Linux skill, so it is great to have the most useful Linux command executed inside a web page, just click one of this tabs and be happy.

Mypage depends on the NVRAM variable mypage_scripts. Usually this variable is not set and normally you don't care about it. To enable Mypage you must set this variable to test if the Mypage tab appear right hand of the status tab.

If you cannot see the Mypage tab, upgrade your firmware to the latest build and read carefully the next sections to understand what are the prerequisites needed and how to install and configure this pages.


Prerequisite

You need at least Eko's or Brainslayer's firmware builds equal or greater than revision level svn13309. (See DD-WRT Download)

Look at the syntax of some useful Linux commands. (See Useful Scripts)

Look how to use Telnet or SSH to gain access to the command shell. (See Telnet/SSH)

Look how to setup the variable using nvram. (See Hardware)

Look how to mount a partition on USB storage. (See USB Storage)

Requirements

The scheme of mypage_scripts is:

mypage_scripts="</storage/www/mypage[1].sh> </storage/www/mypage[2].sh> ... </storage/www/mypage[n-1].sh> </storage/www/mypage[n].sh>"

Exchange storage with your underlying filesystem /jffs, /mmc, /mnt, ...

Currently there are twelve scripts named mypage1.sh, ..., mypage12.sh.

Feel free to use only some of them. If this is the case set the order of mypage_scripts accordingly. Right now the filename is not important. Important is the order inside the mypage_scripts variable.

mypage1.sh is named Host.
This script shows different information about your device like device name, firmware, kernel version, memory, CPU and loaded kernel modules. All running processes since boot time are also displayed.

mypage2.sh is named Wireless.
This script shows wireless info like driver core, interface, status, version and capabilities of your device. Single and dual band router are currently supported.

mypage3.sh is named Storage.
This script shows all information about the partition/disk in use like internal/external disks and flash. It also contains a backup feature for downloading CFE and NVRAM to a safe place on your computer.

mypage4.sh is named Network.
This script shows network related stuff like open ports, interfaces, routing table, arp table and domain name server of your device.

mypage5.sh is named Filter.
This script shows the ip filter nat, log and nat2wan chains of your device.

mypage6.sh is named Kernel.
This scripts shows all the kernel messages emitted during the booting time of your device.

mypage7.sh is named NVRAM.
This scripts shows all the variables stored inside the NVRAM space of your device. The variables are sorted alphabetically.

mypage8.sh is named OPT.
This scripts shows all the installed and available software packages from the OPTware distribution on your device.

mypage9.sh is named Procs.
This scripts shows periodically all the top processes sorted by CPU and memory of your device. This is an autorefresh page.

mypage10.sh is named Ports.
This scripts shows periodically all the open and established network ports of your device. This is an autorefresh page.

mypage11.sh is named Logs.
This scripts shows periodically the last 20 lines of syslogd kernel and user messages of your device. This is an autorefresh page.

mypage12.sh is named Traffic.
This scripts shows periodically all physical, bridged and virtual network traffic of your device. This is an autorefresh page.

Download

This files are stored inside the forum pages:

mypage-files-v0.13-20100113-00323.tgz
mypage-shots-v0.13-2010013-00323.tgz

Please download it from the My Page thread to /opt/www

Installation

Download the tgz file from the download section and find a useful place where to store it. In my case I store the file under /opt/www. This directory is a symlink to /jffs/opt/www. Choose whatever directory you like, don't forget to choose a persistent partition that survive a device reboot. Don't use /tmp, because it is a volatile RAM area.

You can choose another place, depending which filesystem you own. (SD,MMC,USB,CIFS)

Go to /opt/www and extract the file with:

tar -xvzf mypage-files-v0.13-20100113-00323.tgz .

Set the read flags for all files with:

chmod -R 644 /opt/www/*

Note: Set the executable flags for all sh- and asp files! Otherwise the scripts will not work!

chmod -R 755 /opt/www/*.sh /opt/www/*.asp
chmod -R 755 /opt/www/inst/*.sh

Root must own the files with:

chown root.root *

In your target directory there must be the following files:

root@rtgate01:/opt/www# ls -l
drw-r--r--    2 root     root            0 Jan 12 14:58 images
drw-r--r--    2 root     root            0 Jan 13 16:26 inst
drw-r--r--    2 root     root            0 Jan 12 14:58 js
drw-r--r--    2 root     root            0 Jan 12 14:58 logs
-rwxr-xr-x    1 root     root         4394 Jan 13 14:02 mypage.inst.sh
-rwxr-xr-x    1 root     root          119 Jan 13 16:26 mypage.live.asp
-rwxr-xr-x    1 root     root        18519 Jan 13 16:26 mypage1.sh
-rwxr-xr-x    1 root     root        10928 Jan 13 16:26 mypage10.sh
-rwxr-xr-x    1 root     root        12011 Jan 13 16:26 mypage11.sh
-rwxr-xr-x    1 root     root        13951 Jan 13 16:26 mypage12.sh
-rwxr-xr-x    1 root     root        12748 Jan 13 16:26 mypage2.sh
-rwxr-xr-x    1 rood    root        13924 Jan 13 16:26 mypage3.sh
-rwxr-xr-x    1 root     root        13245 Jan 13 16:26 mypage4.sh
-rwxr-xr-x    1 root     root        15251 Jan 13 16:26 mypage5.sh
-rwxr-xr-x    1 root     root        10711 Jan 13 16:26 mypage6.sh
-rwxr-xr-x    1 root     root        12740 Jan 13 16:26 mypage7.sh
-rwxr-xr-x    1 root     root        12797 Jan 13 16:26 mypage8.sh
-rwxr-xr-x    1 root     root        10415 Jan 13 16:26 mypage9.sh
-rwxr-xr-x    1 root     root         2715 Jan 13 14:37 mypage_english.sh
-rwxr-xr-x    1 root     root         3138 Jan 13 14:37 mypage_german.sh
drw-r--r--    2 root     root            0 Jan 12 14:58 style


Here you find all the related files for the installation script. Whenever you like go to /opt/www/inst and execute mypage_inst.sh to view or hide some Mypage scripts from the web interface.

root@rtgate01:/opt/www/inst# ls -l
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage10
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage11
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage12
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage5
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage6
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage7
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage8
-rw-r--r--    1 root     root             0 Jan 13 16:26 mypage9
-rwxr-xr-x   1 root     root        3016 Jan 13 16:26 mypage_english.sh
-rwxr-xr-x   1 root     root        3474 Jan 13 16:26 mypage_german.sh
-rwxr-xr-x 1 root   root        3365 Jan 13 16:26 mypage_inst.sh
-rwxr-xr-x   1 root     root        5979 Jan 13 16:26 mypage_lib.sh


Don't forget to symbolic link /opt/www to /tmp/www (See below)

root@rtgate01:/tmp# ls -l
drw-r--r--    2 root     root            0 Jan 12 14:57 cron.d
-rw-r--r--    1 root     root             0 Jan 12 14:57 crontab
-rw-r--r--    1 root     root         229 Jan  1  1970 dnsmasq.conf
-rw-r--r--    1 root     root           89 Jan 13 08:45 dnsmasq.leases
drw-r--r--    2 root     root            0 Jan  1  1970 etc
-rw-r--r--    1 root     root           41 Jan  1  1970 hosts
-rw-r--r--    1 root     root         231 Jan 12 14:57 igmpproxy.conf
-rw-r--r--    1 root     root           86 Jan  1  1970 loginprompt
-rw-r--r--    1 root     root             4 Jan  1  1970 nas.wl0lan.pid
drw-r--r--    3 root     root             0 Jan  1  1970 oet
-rw-r--r--    1 root     root           41 Jan  1  1970 resolv.conf
-rw-r--r--    1 root     root           23 Jan  1  1970 resolv.dnsmasq
drw-r--r--    3 root     root             0 Jan  1  1970 root
lrwxrwxrwx  1 root     root            8 Jan  1  1970 udhcpc -> /sbin/rc
-rw-r--r--    1 root     root             6 Jan  1  1970 udhcpc.expires
drw-r--r--   10 root     root            0 Jan  1  1970 var 
lrwxrwxrwx  7 root  root           0 Jan 13 14:37 www -> /opt/www
NOTE: In this example I use /opt/www, feel free to use a different directory instead.
In this case reference everything to this directory. This directory must be persistent!
It must survive a reboot of your device!

Configuration

To set the nvram variable login into your device using telnet or ssh and at the command line execute:

nvram set mypage_scripts="/opt/www/mypage1.sh /opt/www/mypage2.sh /opt/www/mypage3.sh /opt/www/mypage4.sh /opt/www/mypage5.sh /opt/www/mypage6.sh /opt/www/mypage7.sh /opt/www/mypage8.sh /opt/www/mypage9.sh /opt/www/mypage10.sh /opt/www/mypage11.sh /opt/www/mypage12.sh"

Don't forget to make the changes persistent with:

nvram commit

The script order is important. It can be called with http://192.168.1.1/MyPage.asp?1, ..., http://192.168.1.1/MyPage.asp?12

With version 0.9 theme and national language support (NLS) is available. All the DD-WRT themes are supported. Currently only english and german translation is available.

Everyone who are able and willing to translate, are kindly requested to contact me (gi-minni).

With NLS there is a need to have a symbolic link from the place where you stored the files to /tmp/www and a startup script that mount this place to /tmp/www after every reboot.

To test it the first time manually, please do:

# Link /opt/www to /tmp/www for mypage i18n support
if [ -d /tmp/www ]; then rm -rf /tmp/www; fi
ln -s /opt/www /tmp/www

In the /etc/config directory store a startup script named opt.startup

I use /jffs because my device (ASUS RT-N16) has enough space to store things inside the flash partition.

#!/bin/ash
# Mount /jffs/opt to /opt
if [ -d /jffs/opt ]; then mount -o bind /jffs/opt /opt; fi
# Link /opt/www to /tmp/www for mypage i18n support
if [ -d /tmp/www ]; then rm -rf /tmp/www; fi
ln -s /opt/www /tmp/www

Please pay attention that the above script is suited for jffs partitions. Change it for other partition type accordingly.

Navigation

Every page can have different display blocks. Depending on the amount and content of this display blocks. The displayed blocks can exceed the display region of your screen. For some pages this is true and scrolling will be inevitable.

Another bad thing is that autorefreshing a long page without using AJAX/Javascript will position the page to the top again, loosing the ability to watch a display block repeatedly.

I coded three navigation buttons. This are named top, refresh and goto:

^ (top) = If this button is pressed the page is displayed from the top
o (refresh) = If this button is pressed a manual page refresh is done
> (goto) = If this button is pressed the actual block is showed.

You will see a positive effect, e.g. on the host and log page.

On the host page you can press the goto button from the help menu and you jump directly to the specific display block.

On the log page you can see the user logs, by pressing the goto button. Every subsequent refreshes lock the page to the specific display block.

FAQ

Q: Is MyPage hardware dependent?

A: Mypage is hardware independent. It rely heavily on the javascript dd-wrt libraries, nvram program and on generic linux commands. Every router that is supported by dd-wrt can use Mypage without having problems

Q: What firmware build do I need at least?

A: Mypage support was implemented at the end of November 2009. This require at least firmware build svn13309

Q: How can I open the newly installed pages?

A: To see the newly installed pages you must call the Status Router tab first. If you don't see a tab called My Page, then please download and upgrade your router firmware to the latest level. Afterwards click on My Page and all defined subpages are showed.

Q: Why are all pages blank?

A: Ensure that all the mypage[1-9].sh, mypage.live.asp files have the execution flags set. chmod +x mypage*.sh mypage*.asp

Links


Screenshots

Here I stored all the screenshots. Feel free to post your comments & suggestions.

mypage0.sh - (Status information page)
mypage0.sh - (Status information page)
mypage1.sh - (Host device information page)
mypage1.sh - (Host device information page)
mypage2.sh - (Wireless information page)
mypage2.sh - (Wireless information page)
mypage3.sh - (Storage information page)
mypage3.sh - (Storage information page)
mypage4.sh - (Network information page)
mypage4.sh - (Network information page)
mypage5.sh - (IP Network Filter page)
mypage5.sh - (IP Network Filter page)
mypage6.sh - (Kernel messages page)
mypage6.sh - (Kernel messages page)
mypage7.sh - (NVRAM variables page)
mypage7.sh - (NVRAM variables page)
mypage8.sh - (OPT packages page)
mypage8.sh - (OPT packages page)
mypage9.sh - (Top running processes page)
mypage9.sh - (Top running processes page)
mypage10.sh - (Open & established ports page)
mypage10.sh - (Open & established ports page)
mypage11.sh - (Syslogd kernel & user page)
mypage11.sh - (Syslogd kernel & user page)
mypage12.sh - (Network traffic page)
mypage12.sh - (Network traffic page)

Images

Here I stored all the images. Feel free to post your comments & suggestions.

mypage_ip_english_big.png - (IP filter image)
mypage_ip_english_big.png - (IP filter image)
mypage_vlan_english_big.png - (VLAN portmapping image)
mypage_vlan_english_big.png - (VLAN portmapping image)

Changelog

v0.13-20100114-00323
[CHG] Install functions isolated in own lib file - gi-minni
[ADD] shell environment to host page added - gi-minni
[CHG] Installation script changed - gi-minni
[CHG] speed arp request without name resolution - gi-minni
[CHG] Host keys rearranged in own display block - gi-minni
[CHG] Optware page throw an error if nvram variable is unset - gi-minni
[CHG] Syslog page throw an error if nvram variable is unset - gi-minni
[ADD] Optware, monitor & traffic page depends from inst. script - gi-minni
[ADD] Installation script added - gi-minni
[ADD] Interrupts info to host page added - gi-minni
[CHG] Disk name changed to Partitions in storage page - gi-minni
[ADD] all mountpoints info to storage page added - gi-minni
[CHG] js, log, css and images refactored to it's own dir - gi-minni
[CHG] Images can be shown in a bigger window - gi-minni
[ADD] VLAN port mapping image added - gi-minni
[CHG] IP table image rendered more clearer - gi-minni
[BUG] refreshButton displays only one button if text is set - gi-minni
[NEW] New if, bridge, vlan graphic blocks to traffic page added - gi-minni
[CHG] NVRAM size and free space reformatted and NLS aware - gi-minni
[CHG] Every navigation button has a title - gi-minni
v0.12-20100107-00251
[ADD] Show the last 20 user and kernel log entries - gi-minni
[ADD] New log page created - gi-minni
[ADD] Go to and refresh navigation added to legend - gi-minni
[ADD] Cron table in host page added - gi-minni
[CHG] Memory info in host page changed - gi-minni
[ADD] Routerboard information to host page added - gi-minni
[ADD] NVRAM size and free space to NVRAM page added - gi-minni
[ADD] Bridge interface to network page added - gi-minni
[CHG] Help navigation to each display block changed - gi-minni
[ADD] Legend navigation to top of each page added - gi-minni
[ADD] lan2wan and log filter chains added - gi-minni
[ADD] Chain images added - gi-minni
[ADD] IP filter and NAT table added - gi-minni
[ADD] New IP filter page created - gi-minni
[CHG] Only top 20 processes listed - gi-minni
[ADD] Established network port support added - gi-minni
[CHG] Pagetitle is dynamic and language dependent - gi-minni
[ADD] MyPage forum link added - gi-minni
v0.11-20100105-00213
[ADD] Top processes live page added - gi-minni
[ADD] Netstat live page added - gi-minni
[CHG] ASP files renamed to sh - gi-minni
[ADD] Dualband support added - gi-minni
[ADD] Live update support with mypage.live.asp added - gi-minni
[CHG] css statements refactored into mypage.css - gi-minni
[BUG] arp -a changed to arp, cmd take to long to complete - gi-minni
[BUG] opt ifconfig does not work, internal do - gi-minni
[CHG] WLAN pagename changed to Wireless again - gi-minni
[ADD] MyPage wiki link added - gi-minni
[ADD] MyPage download link added - gi-minni
v0.10-20091227-00185
[CHG] Every help header has a link to it's fieldset - gi-minni
[CHG] Help can include hyperlink - gi-minni
[CHG] Host and device are limited to 17 chars each - gi-minni
[CHG] Due to space constraints mypage is rearranged 1 level up - gi-minni
[ADD] Forum search added to the essential links - gi-minni
[CHG] Flash- and diskblock position rearranged in storage page - gi-minni
[ADD] Backup NVRAM download button added in storage page - gi-minni
[ADD] Backup CFE download button added in storage page - gi-minni
v0.9-20091224-00167
[ADD] Added One german and one english javascript file - gi-minni
[ADD] Added common javascript file - gi-minni
[ADD] Added German and English translations - gi-minni
[ADD] Every page is NLS aware - gi-minni
[CHG] Choosed Monospace font for a sharper view - gi-minni
[CHG] Rearrangements stuff in main page - gi-minni 
[CHG] Download file link adjusted to callback url - gi-minni
[ADD] Theme depends from nvram variable router_style - gi-minni
[ADD] Language depends from nvram variable language - gi-minni
[ADD] Add device to the info header and also into the main page - gi-minni
v0.8-20091223-00047
|ADD] Added date to the info header - gi-minni
[ADD] Added ARP Table to network page - gi-minni
[ADD] Added router database link - gi-minni
[ADD] Hostname added to the info header - gi-minni
[ADD] Started to add language support to the refresh button - gi-minni
[ADD] Autorefresh WAN IP enabled in the header - gi-minni
[ADD] Autorefresh uptime enabled in the header - gi-minni
[ADD] dd-wrt about page added in the header - gi-minni
[CHG] corrected various typos & bugs - gi-minni
v0.7-20091222-00037
[ADD] Added relevant dd-wrt and svn links - gi-minni
[CHG] Help information can display multiple links - gi-minni
[ADD] Version information is showed on each page - gi-minni
[ADD] Added inline stylesheet version - gi-minni
[ADD] New OPT page shows the installed and available opt packages - gi-minni
v0.6-20091221-00033
[ADD] Help information provided with notes and links - gi-minni
[ADD] inline stylesheet added with note and also style - gi-minni
v0.5-20091221-00021
[CHG] Pages are rendered in standard compliance mode (no quirks mode) - gi-minni
[CHG] Page suffix changed to asp - gi-minni
[ADD] Driver capabilities is wrapped as token for correct alignment - gi-minni
[CHG] Wireless info depends on interface read from nvram variable - gi-minni
[ADD] Help information is showed on each page - gi-minni
[ADD] Flash information on storage page - gi-minni
[CHG] Every wrapped lines is marked with the raquo symbol - gi-minni
v0.4-20091220-00015
[DEL] Uptime information removed from every page - gi-minni
[ADD] Header info reflect actual design - gi-minni
[ADD] HTML pagetitle reflect actual design - gi-minni
[ADD] Routing table added to network page - gi-minni
[ADD] Domain name server added to network page - gi-minni
[ADD] Kernel page added and wrapped at pos 75 for correct alignment - gi-minni
[ADD] NVRAM page added and wrapped at pos 75 for correct alignment - gi-minni
v0.3-20091220-00010
[ADD] netstat is cutted at pos 75 for correct alignment - gi-minni
[ADD] process list is wrapped at pos 75 for correct alignment - gi-minni
[NEW] initial version - gi-minni