vortex-5 / ddwrt-bwmon

An Individual Bandwidth Monitor For DD-WRT
171 stars 37 forks source link

Is it possible to install this on a DD-WRT without lighthttpd and a USB drive? #32

Closed target123 closed 8 years ago

target123 commented 8 years ago

Hi,

Would you mind if you could provide detailed tutorials on how to make this wonderful piece of software run smoothly and amazingly? Unfortunately, like many other routers my DDWRT administration page does not show any option of webserver at all. So I believe I may not have lighthttpd in my TP-LINK Archer C7 (v2) with over 16MB of flash and 128 MB of ram which I believe is beefy enough to handle this without a sweat.

Also, would it be possible to accomplish the installation of the monitoring tool without the need of a USB for jffs? It is because my router has fortunately already have over 2.5 MB of JFFS. Would it be enough for all of these without having a flash drive or should I still need to plug in a USB drive to work? (Because I plan to use the USB for printer sharing over network.)

Thank you very much for this amazing piece of software and more power to you!

image image

One last question. Is it possible to view the bandwidth monitoring remotely? like from WAN?

Best, Your New Fan! :)

vortex-5 commented 8 years ago

So it is possible to install to JFFS without USB if you enable JFFS storage on the router. the reason there is no guide to this is there are a finite number of writes on the router's flash although it should be adequately sufficient it is much cheaper to burn out a USB key than the router's internal flash.

That said I can work with you to develop a guide for non USB key storage usage I will be putting a disclaimer of the fact above if I do so.

As for your 2nd question yes it is possible to install without lighttpd the only difference is the sames will be every 10 seconds rather than every 1 second.

The final question is it possible to monitor remotely via WAN the answer here is tricky yes you can expose the bandwidth over WAN however there is no authentication thus that presents a problem for security. If you need to check it remotely my recommendation is to setup ssh on the router and allow tunneling over it just make sure that mechanism is secure by having a good password.

target123 commented 8 years ago

Thank you! Is your application write intensive? However, With that in mind, I'll probably just use a USB stick instead. I have a few old ones lying around. I suppose 1-2GB would already suffice right? How can I format the USB to ext4 then?

I am really interested to install lighthttpd. However as most of the people here, many of our routers do not contain the lighthttpd. Would you mind to provide insights on how to put lighthttpd on our routers?

Thank you!

vortex-5 commented 8 years ago

it's not highly write intensive it's more about being overly cautious.

The application writes once roughly every 15min. The reason it's 15min not every 10 seconds is I anticipated some may try and install it without USB so I put in some basic level write limitation.

The main concern is in the DDWRT documentation it says the onboard memory may not have wear leveling meaning if you write to the same spot over and over again then you really only have 1000 writes. USB keys all universally have wear leveling so even a small 256MB usb key means that you will be writing 256MB x 1000 before you get close to the 1000 flash rom limit.

But if you have a USB port free there isn't much point to not stick an external storage in and run it that way. If your on windows you can simply format it with NTFS and mount it that way others have confirmed this method works with no ill effects. On linux I'd recommend the gparted way: http://askubuntu.com/questions/22381/how-to-format-a-usb-flash-drive The only thing to avoid is a fat based file system since it lacks permissions so you can't mark things as executable.

As for formatting you can format with NTFS if you have access to a windows box people have commented that it works fine with an NTFS file system. FAT lacks permissions os it can't set things to executable. If you are on linux then the format command is mkfs.ext4 /dev/your_usb

if you still wish to turn that on the if you go under DDWRT under Administration > Management > JFFS2 Support. There's an enable option.

Once enabled your folder /jffs should be the onboard flash. I have not tested to ensure that when you updated your router the storage persists it might be erased with updates.

as for running lighttpd I have not personally got optware to work which would be the strategy in getting lighttpd to work without native support. It doesn't have to be a lighttpd server however it can be anything that understands php so nginx comes to mind. However lighttpd seems to be the built in solution for routers with onboard flash greater than 32MB. But installing it via optware would not be something I can help you with since I never got it working.

The script is hard coded to search for bwreader.php at routerip:81/bwreader.php without any requests so as long as a web server is operating there with access to the router's shell it will work.

target123 commented 8 years ago

Wow thats great insight! Thank you! I am really glad you brought that up and expounded on it.

So I assume DDWRT has ntfs file system support natively? Because I intend to just plug a USB of about 2gb to the back of the router.

Once I use the USB as the main jffs storage the onboard flash will not be used anymore right?

Great! I'm trying to instal lighttpd but unfortunately, optware is really hard to install especially for atheros chipsets.

Btw, any proposed feature or additions to your software?

vortex-5 commented 8 years ago

Yes if you mount the USB as JFFS it will no longer use the internal JFFS2 storage if you have enabled it in the past.

I am aware optware is difficult to install as I've failed to have a stable install myself it keeps breaking so I gave up on it eventually (sorry I couldn't be more helpful here).

If you look on the issue tracker there are proposed features however it doesn't necessarily mean all of those are planned. For example the historical bandwidth charts is on permanent hold as it's complexity may be too great and be a negative contribution to the stability of the tool. The OpenWRT support is most likely on the table the other user in that thread provided enough information for that to potentially get off the ground there is however some fallout in the OpenWRT group as a larger group of core contributors have apparently broke off due to creative differences.

There are no major feature additions planned as of yet historical bandwidth is probably a popular one but it's problematic since most people requesting that don't have routers with lighttpd support meaning you can't execute anything once a client connects it has to be all ready for the client before hand so again it's on permanent hold until I or someone else comes up with a viable strategy that will work for non lighttpd routers and it seems like there are a lot more of them.

Some minor things I had in the back of the head are things like allowing you to sum groups of devices so you can see totals across the group but I'm not sure if that feature is popular enough to build. But generally speaking I'm open to suggestions so anything that appears in issues will generally persist, if it is beyond the scope of the project it will be closed as an issue but stay open for comment and discussion in case someone decides to fork this project and build a more advanced version (forking is encouraged in open source :-) )

target123 commented 8 years ago

Great! Now I know I'll do that especially with NTFS support.

Yes it is very confusing to install and Honestly, DD-WRT's own documentation is fragmented with old prehistoric versions and its also all over the place. I'm not sure if its because the routers are so diverse and the project has been going on for years, but for sure, with advanced stuff its usually a better option to find tutorials elsewhere.

Historical Bandwidth Charts, or at least pie/graph charts of the overall usage per day/week/month/ selected dates would be great! Like what pc uses the most and what website etc. However I do understand this would be a very complicated task.

Would you consider adding interactive charts or graphs? Or add a password so that it could be securely viewed on WAN?

vortex-5 commented 8 years ago

Adding a password is trivial and that can be done pretty easily but you used the word securely. The password would only be fake security and not real security since all the information is still accessible.

target123 commented 8 years ago

At least would you just consider adding an option to add it like a config page? I believe even if it only provides a false sense of security, at least it is better than nothing. :) I believe it would be pretty to add a password page with deisgns :D

vortex-5 commented 8 years ago

Yeah it seems reasonable I'll put it in for next revision. No definite date on when the password will most likely be in a config somewhere potentially how it will work is there will be a new ./setpassword script that will generate a password.js file.

The reason for doing it this way is you want the actual stored password to be a hash so if a person gets a hold of your router (stolen) they don't get access to your actual plain text password.

Might take some research on my part I'm not to familiar in the best practices for safe password hashing.

It'll probably work like how you would expect for a password login prompt including a checkbox option for "remember me on this device for a month" so you don't have to constantly re-login which can get frustrating. (most likely off by default until the user checks it).

I'll put up an issue to track this feature.

target123 commented 8 years ago

Yes awesome!

It would be great to add a password because at least now we could deter most snooping eyes from seeing those data. Besides I believe not everyone knows that its just a fake security. Besides, for the effort it can be said that it would provide an adequate amount of "protection".

creited commented 8 years ago

What if your router doesn't have a USB port? I understood your point in regards to the finite number of writes on the flash. On my network I have another DD-WRT router running as a bridge/Access Point in another room, connected via UTP cable. It happens that this seccond router has USB port and I used to have it working with bwmon greatly. But unfortunnatelly its WAN port got damaged and I had to switch these routers places. So, would it be possible to use a remote storage running on windows/ another NAS enabled DDWRT?

Thanks a million!

vortex-5 commented 8 years ago

As long as the end result is you have storage mounted to /jffs/ I don't really think the script cares. The script is robust enough to even run from another location but just hasn't gone through the level of testing vs /jffs

creited commented 8 years ago

I did it! I used the CIFS mount under Administration tab. From there I was able to install it not on my jffs, but /mnt/smbshare/bwmon/ and it is working like a charm! I had to use a delay on my startup script, since CIFS takes sometime to get mounted. 60 seconds is okay for now. Thank you!

Edit: Do you believe its a problem if I change the script time from 10 to 1 sec? Some devices are not showing for 10 seconds, but for 1 second they show up.

vortex-5 commented 8 years ago

10 seconds and 1 second are chosen for device load. If you pick 1 second you'll need to adjust the rate calculations in the js script otherwise the download rate will be inaccurate.

creited commented 8 years ago

Humm.. I see... actually I wasn`t abble to find (read understand) these rate calculations which I must change on bwmon.js. Im not a speccialist on scripting. Yes, I could see that my uplink sometimes was reaching 8 Mbps when I have 1 Mbps link. The timming was shifted as well.

target123 commented 8 years ago

This is actually awesome guys! Keep up the good work. Also, other people might find the CIFS mount usefull as well.