WRTBwLog Install Guide w/DD-WRT

Discussion in 'DD-WRT Firmware' started by dr_zoidberg, Nov 7, 2005.

  1. dr_zoidberg

    dr_zoidberg Network Guru Member

    This guide will cover automatically installing a user customized WRTBWLog (a handy bandwidth monitor) from onboard flash memory upon reboot, and configuring it to back up the log files to an FTP . Backing up the logs is important because if the router gets rebooted, you will lose all the stats. I realize you can save the logs to an external PC using a samba mount, so consider this an alternative if you don't want to install the full version of DD-WRT. (These instructions are based on my experience installing bwlog)

    -DD-WRT v22 final-r2
    -WRTBWLog 1.1
    -FileZilla server
    -Windows 98/ME/2000/XP (For step 6, which is optional)

    Step 0: Enable the jffs2 partition
    Enable the partition in the DD-WRT menus. If that doesn't work, connect to the router with telnet and run the following commands:
    nvram set sys_enable_jffs2=1
    nvram commit
    Step 1: Set up the FTP site
    I used Filezilla as the FTP server. I tried some 'light' FTP clients but only filezilla worked. Once you have installed filezilla, open up the Filezilla Server Interface and create a new user for bwlog to use. Go to Edit->Users.General and make a new user. Now go to Edit->Users.Shared Folders and add the directory that you want to use as FTP root. Don't forget to assign permissions to the user you created for bwlog.

    It would be beneficial to enable Static DHCP for the computer hosting the FTP to make sure the ip stays the same. This is because the ip for the server will be set in the bwlog config.

    Step 2: Install WRTBWLog for the First Time
    Connect to the router with telnet and run the following commands"
    cd /tmp
    wget http://wrt54g.hetos.de/wrtbwlog.tgz
    tar -xzf wrtbwlog.tgz
    rm wrtbwlog.tgz
    cd bwlog
    This will download the latest bwlog from the web and install it to the ramdisk. If you reboot the router now, bwlog will be gone. That is why it must be copied to a non volatile area. I chose to use the flash memory.

    Step 3: Configuring WRTBWLog
    After bwlog is installed and running successfully, you should be able to connect to it using <router ip>:8000. Since bwlog is deleted on every reboot, we must configure it and save the settings so we can load our modified version and not the default install.

    Once you connect to bwlog, click on the configure button at the top. You'll probably want to secure the stats so pick a username and a password NOTE: the password must not be plain text! It must be a DES hash of your chosen password (go here to get a DES hash for your password. After generating, copy everything after the colon to the password box in bwlog)

    Since the logs will be backed up to an ftp, I enabled the WLAN logs as well. Scroll to the bottom to get to the Backup section. Here you can set the backup location and interval. Fill all the information for the FTP server you created in step 1. You will know in the next step if the information you entered is correct and the FTP server is working

    Step 4: Saving Your Customized bwlog and copying to the jffs Partition
    After you have configured bwlog exactly the way you want it, go to the configuration page in bwlog, scroll to the backup section and select Upload Custom WRTBWLog Version. This will save all your bwlog settings, package them, and upload them to your FTP server. This is what we will use to install bwlog upon rebooting the router. If everything worked correctly, you should see 'wrtbwlog_cust.tgz' in your ftp directory

    Now, we can copy our custom version of WRTBWLog to the flash memory on the router. Connect to the router using telnet and type the following commands (replace the ip, username and password with your own)
    cd /jffs
    wget ftp://<user_name>:<password>@<ftp_ip_address>/wrtbwlog_cust.tgz
    Your customized WRTBWLog will now remain, even after rebooting.
    Now we must tell the router to install and start it upon startup

    Step 5: Automatically installing on startup
    Open the 'Editor' page in WRTBWLog. In the' Name of File/NVRAM parameter' box type 'rc_startup'. In the big box above that enter:
    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
    sleep 6
    cd /tmp
    cp /jffs/wrtbwlog_cust.tgz /tmp/wrtbwlog_cust.tgz
    /bin/tar -xzf wrtbwlog_cust.tgz
    rm wrtbwlog_cust.tgz
    cd bwlog
    ( ./start.sh & ) &
    Now click on the 'Save NVRAM Parameter' button (note: this will overwrite your previous startup script). If you want to edit it again, click on 'Load NVRAM Parameter'

    This will install our customized bwlog from flash memory to ramdisk. You can also install it to the flash drive but this is not recommended as the continuous writing of logs by WRTBWLog may wear out the memory prematurely.

    Step 6 (Optional): Archiving Logs
    When WRTBWLog backs up its log, it overwrites the old one. If for whatever reason, your logs get screwed up, bwlog will overwrite your good log with one with incorrect data (that happened to me). One solution is to archive the logs, that way, if the bandwidth data gets reset, ill be able to go to a previous version with minimal loss (Using the 'Restore Last Backup' button) What I did was make a small vb script to copy the freshest backup to an archive directory. Create a new file and rename it BWLogArchive.vbs. Open it in notepad and type the following (as usual, replace with your own directories):
    set fso=CreateObject("Scripting.FileSystemObject")
    CurrDate= replace(replace(FormatDateTime(now,2) & " " & FormatDateTime(now,4),"/","-"),":",".")
    fso.CopyFile "c:\ftp\ftproot\bwdata.tgz","c:\ftp\ftproot\bwdataArchive\bwdata_" & CurrDate & ".tgz",false
    This script will copy the latest backup to an archive folder and append the date and time the archive occurred. Run the script to make sure it works. Now create a new scheduled task with the Windows Task Scheduler and set the run interval to approximately the same interval that you set in bwlog. When you need to restore a backup, copy your archive to wherever bwlog copies its backup and rename it to 'bwdata.tgz'. In WRTBWLog, go to the configuration page and select 'Restore Latest Backup' and voila, you have restored your archived copy.

    You'll probably want to delete really old archive copies once in a while to prevent too many files from accumulating.


    Well, thats about it. If you have any comments/suggestions/corrections, feel free to post and I'll update the guide accordingly
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice