Updating the time on an NSLU2 using standard firmware

Discussion in 'Cisco/Linksys Network Storage Devices' started by steve007, Nov 21, 2006.

  1. steve007

    steve007 LI Guru Member

    I don't know if this works with any firmware other than v23r63. As you know, the time rapidly gets out of time. Since Linksys haven't bothered to provide an NTP solution I was looking for a simple solution. So far this is the simplest I've got, my hope is to enable this to be further automated so it can be run from a script like curl (maybe it can now, I'm just not sure how yet).

    (note: attachment removed - refer to later post from me for a more current version)

    The attached htm file needs two edits before you can use it. search for - that is the address of my NSLU2 - it appears twice. Replace it with the IP address or the DNS name of your NSLU2. When you open this file in your browser it uses javascript to get the current time from your PC and then submits that to the NSLU2 using the NSLU2's normal time updating routines.

    Now that I've got you started, if anyone thinks of a way to automate this to occur from a batch file or .vbs file that could be run silently from the startup group of my PC every time my PC starts up so that it synchronises the time of the NSLU2 to the time of my PC please let me know.
  2. jksmurf

    jksmurf Network Guru Member

    That looks very interesting thanks Steve, I must try it :)

    As noted in this thread I was looking for somethign simnple JUST like that without going the whole uNSLUNG route just for that feature.

    Cheers, be great if you could get it automated too!


    You'd think Linky-hit-n-miss would put that in as standard wouldn't you.... I wish someone would make 3rd party f/w for this thing with jsut a few simple enhancements...
  3. A.Ham

    A.Ham Guest

    Taking your Idea another step ...

    Hi steve007,
    I still working on the problem of accessing my NSLU2 to let me change passwords or format my hd which is formated as NTFS and changing it to the Format use for network drives.

    My idea is to use the clock from my 'WRT54GX2' router to update the NSLU2 which at first was not working correctly it was always showing a January 01 date after i installed it last May 06. But this seen to have stabilized after i hit reset a couple of times and did a "Hard boot" on the router.

    So instead of using the PC clock why not use your router if you have one there and it's clock to update any network devices hook to it. It would seen to be a 'natural' séance all network hard wear are hooked to it via the router anyway. Making the router a kind of "Network Time server" for your network. I like to see Linksys add this opts to an firm wear upgrade in the future that after they get some of the other "BUGS" worked out.

    By the way how were you able to access the NSLU2 to make changes. The only way I been able to affect it is with the CD that came with it during the first setup. Trying to go there IExplorer won't let me change passwords or format drives. I keep getting an "EXT3 error" when i try to format drives and when i try to go change passwords it won't let me. I try-ed entering the default "admin" and it just bring me back to the main setup screen, usual after three shots.

    :thumbup: Tony
  4. jksmurf

    jksmurf Network Guru Member

    Ooops.... Good Q, I just tried this and now I cannot access my NSLU2 admin with usual Pwds?

    Seems to be some other hard-coded stuff too like ""Sydney office server"???

  5. steve007

    steve007 LI Guru Member

    Update to original post

    jksmurf and a.ham thanks for your comments. Sorry for the extra junk in the settings! I hope it didn't take much to fix those. If you can't find your nslu2 name my guess is that it might have been changed to "NEW". Once you are back into your nslu2 you'll need to check that all the settings on the SYSTEM configuration page are as you want them to be.

    First let me apologise, I think I submitted the code too soon - I'd forgotten to set the month, day and year. Now I've updated that and also removed the timezone settings as I realised that not everyone is in my timezone! Actually, based on your feedback I've managed to eliminate the setting of anything apart from the time and date, now it will not change any of your other settings. I've attached the new code to this post.

    To answer your questions and comments:
    - how did I update the nslu2's settings?
    All I am doing is calling the NSLU2's normal web configuration page for v23r63 firmware with all the data pre-loaded so that it just sets it accordingly. This is why you got some of your settings overwritten. Sorry about that. Now I've cut out all the other settings out of the pre-load data. So this does mean that if you want to use this you must (a) have a working web configuration page for your nslu and (b) know the admin account and password for it and (c) you must be on v23r63. My thinking is that if we can
    get this page automatically loaded by a curl script we can write the account and password into the code and overcome the need for us to be prompted as it does now...

    - why update from the PC time rather than the router time?
    There are a few reasons for this. Firstly, not everyone has the same router, personally I use a Netgear, but where this is located I'm using a Billion. Secondly, this script (webpage) MUST be executed (opened) on a PC therefore it is simpler not to assume the existence of any other devices but simply to assume that the time and date on the PC have been synchronised with an NTP server somewhere (Windows XP does this and if you don't have XP you can use lots of free NTP software to do it).

    So please use the new code and destroy any copy you have of the old code.

    Attached Files:

  6. jksmurf

    jksmurf Network Guru Member


    LOL. I'm going to have to do a hard reset and lose all my settings (which I stupidly didn't save as a config, so mea culpa for testing the first draft!). I can't get back in ... never mind, no biggie. (but if you do it again, it's lead boots for you boyo ... :tongue: )

    IF we wanted to port this to R72, can I help by sending you the page with the time on it somehow ...

    I do understand your PC setup approach, but like A.Ham I'd also be a candidate for Router updates (WRT54GSv1.1).

  7. steve007

    steve007 LI Guru Member

    Ok, here's the latest update. This is the command to do it in curl...

    I've replaced the administrator name and password with admin and password respectively so you can see where they go. The IP address has been shown as x.x.x.x but you should change this to the IP or DNS of your device.

    curl --data-ascii "sys_day=04&sys_year=2008&sys_hour=7&sys_min=02&message=&h_sys_month=Aug&h_sys_ampm=pm&this_file=system.htm&todo=save" -u admin:password http://x.x.x.x/Management/setup.cgi

    Stay tuned. Next we can write a simple .vbs script to run in the startup group on a PC. But this might take me a week as I'm out of time for now.
  8. steve007

    steve007 LI Guru Member

    jksmurf - reply to your last post. If you were to do it on your router what would you execute the code on? Something has to be used to run the code so why not get the time from the device running the code?
  9. steve007

    steve007 LI Guru Member

    Please note: I examined the html headers being passed and saw that the timezone information was still there. I've updated the attachment in the previous post to remove that now. If you downloaded it before this message please download it again.
  10. jksmurf

    jksmurf Network Guru Member

    errr.... I dunno, I'm really the wrong person to ask, I have NO idea about vbs and curl, I only know a little Fortran and Basic from UNI (that dates me doesn't it) plus some Visual Basic which I use in Excel...

    You're actually Bill Gates right? :rolleyes:

  11. steve007

    steve007 LI Guru Member

    jksmurf, if I were Bill Gates my code might have a lot more bugs...

    no worries, don't worry about curl - I just thought anyone reading this might be interested in what I found. I plan to put this into a simple .vbs script. If you have windows scripting host on your PC (everyone generally does since Microsoft think it is important to have...) then once you have the .vbs all you need to do is put the .vbs script in your start up group. Then every time you log onto your PC it will silently set the time and date on your NSLU2. I think this should be simple enough to use.
  12. ernstoud

    ernstoud LI Guru Member

    EXE file to set time using CURL and PC time

    Hi there,

    Thanks for this thread. I have created a small exe file (written in Qbasic, I know; don't bother to tell me it is old - it simply works fine for purposes like this) that takes the system time of your PC and creates a batch file that uses CURL to set the time/date on your NSLU2, as per steve007's suggestion.


    Expand all files within NSLU2.zip in a directory of your choice.

    Change NSLU2.cfg to include your admin name and password and your NSLU2 IP address as follows:


    for instance:


    don't forget the colon, quotes, full stops and comma.

    Put a shortcut to SETNSLU2.BAT in your startup items.

    Now when your PC starts it will call SETNSLU2.BAT which will call NSLU2.EXE which creates NSLU2.BAT. Subsequently SETNSLU2.BAT calls NSLU2.BAT which sets the date/time using CURL.EXE. After that SETNSLU2.BAT deletes NSLU2.BAT again.

    Source code (Qbasic) is included. CURL (WIN32 version) can be downloaded at:


    of all the files when this CURL distribution has been installed, only CURL.EXE is required and needs to be put in the same directory as the files within NSLU2.zip.

    Take care,


    Attached Files:

  13. jksmurf

    jksmurf Network Guru Member

    Hi again fellers,

    I've mustered up the courage to try ernstoud's solution on VISTA with F/W 23_R76, it runs but doesn't change the time? How can I troubleshoot this? This is the NSLU2.bat that is created.


    (Don't have the courage to try Steve's again ... LOL. I did start changing the f/w revision in the html, and IP address, but not sure whether I'll stuff it up)

    I note that my url is
    I wonder if this was replaced with next, whether that would work? How do I do this?

    It works! I had to do bit of Qbasic editing, (hey that's good for me!) and it works. The updated files. R63 is ernst's above, R76 is my edits to the BAS file. You still need to add username/pwd/IP and d/l curl, Cheers


    Attached Files:

  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