Sign in to follow this  

Unity Monitor LAN/router traffic/bandwidth/usage

This topic is 2589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This may sound weird, but I'm stuck with a crappy ISP (not to mention any names, like HughesNet Satellite) because I live about 3mi outside the boundary where cable/DSL is available. In addition to being slow, unreliable, having horrible customer service, little to no tech support (they diagnose connection problems by blinking lights on the outside of the customer's modem and took over 5 months to fix my satellite when it was hit by lightning) they have this thing called the "Fair Access Policy". The FAP limits how much you can up/down-load in a 24hr period. I have the best advertised plan; so-called "Business Plan" which gives me about 625mb...not an ideal situation when you're trying to work at a company that has around 10GB of stuff on SVN and run your own business and need frequent, large downloads. Only between the hours of 1-6am is the policy relaxed.

The problem is, somehow the download threshold keeps getting violated. What happens is AWFUL. Your connection is slashed to less-than-dialup speed...then they happily extend your "crippled period" if you use the internet much; usually another 24hrs if they're feeling friendly (sometimes much longer, with no explanation; then the "tech support" guy who knows only a few English phrases says "Eet iz seest-uhm, sir! Ie no cahn feex!").

But I MUST solve what is going on here. I know for a fact it is NOT me. I download virtually nothing until that brief window of time where the policy is relaxed. I strongly suspect it is a friend who is staying here for a few days. He did it once, and I explained the problem to him and told him he puts me out of an entire day of work if that happens. Many computer users don't understand they ARE downloading things when they use the internet, even if you don't click a button that says "Download"...and they ALL love watching Youtube videos back to back and downloading music. This was explained, and I told him it was safe to do only between 1-6am; then no videos, music or heavy usage because of my job. Now it's happened again, and you wouldn't believe how long it took me to get here to make this post.

So what I want to do is a bit over my head. I know only a tiny bit about network programming. But I want to write a tool/service which can do a few critical things and maybe a few bonus features:

* = Must-have
- = optional

*Must be able to monitor total download/upload bandwidth consumption in a day

*Must be able to monitor total usage for one PC on my network, or identify what usage is coming/going from where

*Must be able to run for very long periods of time, and reset itself and counters (Windows service seems appropriate; I think I'll also count with an unsigned long and keep the count by kilos to avoid overflow)

-Ability to "catch" anyone except me who consumes more than 150MB, and optionally, warn them or halt their connection to my LAN (I have 4 active PCs on my network)

-Ideally, with the above notion, I'd like to be able to "ration" or put hard limits on other PCs on my network. Even if I have to install this service/background application on my other PCs)

I guess that about covers it. This may sound quite extreme, because it is. Two family members normally use my network, then visitors who come over. Every time this happens now, no one will admit to it. I'm sick of it. And I have no choice but to stop it, and stop it immediately. It costs me dearly. I WISH that my ISP would accept a check to re-enable my service. It would be better (and save me money) to pay $100-300 bucks to lift the "cripple" sometimes. But alas, they don't. Believe me, I've pleaded with them when something very important is going on that requires internet connection. If I miss another Chewbacca Fan Club Online meeting, I will hit the ceiling! Kidding about that part. :)

I just wanted to run this by the fine folks of this community and see what suggestions, pointers, links and help I can get. I'm totally inexperienced with network programming except for writing chat applications, trying to write a failed port-forwarding library with UPnPNATLib.dll (the library itself always threw random exceptions on different routers which I could not understand) and simple TCP/UDP experiments. Other than that, I'm network-dumb.

I'm willing to work in C, C++ or C#; which ever gives me the best shot at accomplishing this efficiently. I would prefer C#, since it will be much faster and much less time worrying about debugging/platform issues. I know .NET has some powerful Networking classes, but I'm ignorant of what they can do and how to use them. Maybe someone can even show me a simple snippet of how to determine total bandwidth usage to get me rolling on this program.

Thanks! Sorry for the lengthy post, but I wanted to make everything clear to get better advice. :)

Share this post


Link to post
Share on other sites
A program to monitor the traffic is probably not what you really want, nor would it be trivial to write.

Your best bet would be to check out your router's options -- most of them have options to block certain websites, and usually you can block them during certain times of the day, optionally. Some routers may even let you set quotas on certain users by MAC address. I know this kind of sucks for your family and guests, but it doesn't appear their behavior, combined with your ISPs policies, is giving you much choice.

If you don't already, consider using something like cron (*nix) or an equivalent to to any of your large transfers during the free-use window when possible (say, syncing to off-site version control, etc), maybe even set up a proxy server to cache sites you visit frequently (a good deal of the page code doesn't change frequently, so even a partial win will work in your favor).

Another option, if throwing money at the problem really is an option, is to consider installing a second satellite setup (or perhaps you have WiMax or similar in your area) and have one be for you, and the other for the rest of the household. If its strictly business, you can probably even write the cost off on your taxes.

Share this post


Link to post
Share on other sites
Well thank you for mentioning this. Tell me about WiMAX? How can I possibly get it? And what sort of bandwidth/speed could I expect out of it? If it's not around ++100Mb/s and giving me MORE (or unlimited bandwidth), then I guess it wouldn't be worth it. But I'm not very wise to all of this new internet/networking stuff, nor do I know much about the new providers, technologies and services available (since they haven't been available to me for 5yrs).

I know writing such an application wouldn't be trivial; but I've done some things which I think would be exponentially more complex and difficult. :) Doesn't scare me too much. At least it's doing SOMETHING when I can't see many other options. I will also see what settings the router has, but AFAIK there's nothing which is going to solve this problem. I've gotten to the point where I just want to control it with an iron fist, and am willing to go to extreme measures to do so and ensure I don't get screwed out of 24+ hour periods of work.

I've looked into other options before, and was unable to do anything satisfactory to stop this. Maybe there is new technology which can settle this, so it's worth another look. But I'm still up for solutions about how to approach this "LAN dictator" application until (or if) something viable is discovered.

Share this post


Link to post
Share on other sites
WiMax is similar to (or the same) as something like Clearwire -- basically it's like a long-range WiFi. I mention it because I grew up in a rural area where my parents still live, and Satellite and WiMax are the only non-dail-up options for rural folks outside of where the cable company can reach. It's worth looking into see if its available in your area and checking whether they've got more agreeable terms. Performance-wise I believe its comparable to a speedy DSL line.

What kind of speed are you getting out of your satellite? Does it still require a phone line for the upstream path? Its been awhile since I've looked at satellite-based internet.

Share this post


Link to post
Share on other sites
The problem here isn't in implementing the software to do the monitoring; the problem is in network architecture.

The only way you can guarantee that you see all traffic going out to your ISP is to sit between the modem and your network itself, ideally outside your router. If this is even physically possible (some modems won't let you do this, or have integrated routers, etc.) it still represents a pretty hefty engineering challenge. I've written realtime network monitors and filters before, and I can assure you that it's a mammoth task. Traffic shaping in particular is incredibly hard to do right.

As mentioned, you're much better off trying to tap the router hardware itself for this. What model of router are you using? Wireless network or wired? I presume you have administrator access to the router itself? Would it be feasible to drop $80-90 and buy a replacement router with the sophistication to do the reporting and traffic shaping that you need?

In an extreme case, I suggest you just do what I eventually did: buy a $300 Linux or BSD machine, follow some basic setup steps to build that into a router, and then set up existing traffic monitoring/shaping software on that. I've run my local LAN and 802.11g networks off a FreeBSD box for a couple of years now, and it couldn't be better.

Share this post


Link to post
Share on other sites
Thanks to you both for the concise and knowledgeable answers.

@ Ravyne :

No, no phoneline needed whatsoever. It's purely satellite. I will DEFINITELY look into this, because anything which severs my dependence on HughesNet will be one of the greatest things to ever happen to me; other than when I eventually move, for the sake of my business, and give this house and land to my mother, haha. I love it here, but living in the country is so problematic; especially for a software developer trying to make a living and pay monstrous bills.

@ ApochPIQ:

Let me clarify some things about what I have here; my fault for not giving some tech-specs from the start. Overall architecture looks like this (excuse my crappy diagram skills ;) haha) ::

Solid lines represent wired connections, while dashed lines represent wireless connections.


Modem - HughesNet "HN-9000" model
Router - LinkSys "WRT-160N" (a bit dated)

Computers themselves -

"Extra PCs" are other computers which belong to and are usually only used by me for software testing, and I only periodically connect them to the network to get online. At my disposal, I have my main desktop for work, and 4 other PCs (one is broken). One of them, an old salvage laptop, runs XP and Ubuntu Linux. The others all run XP. My main desktop runs Vista x64. The living room PC runs Vista x86, and my mother's laptop runs Vista x64. Hopefully this explains everything we're dealing with.

So, I actually do have disposable machines I can run Linux on (would prefer Linux as I have no BSD experience) and use as a network hub, if that would be a good solution.

Now that you understand my setup, any further advice on how to proceed will be greatly appreciated. Yes, buying a new router, IF it can offer the functionality I need to totally kill this problem, is a feasible option. I just need to know which one and what to do with it. I'm pretty ignorant in this department, so I will gladly accept advice/opinions.

Thanks again, folks.

Share this post


Link to post
Share on other sites
I'd say take your Linux box and replace the router with that; setting up a Linux-based routing/shaping system is fairly straightforward, although not without some tricky bits.

You could potentially get a cheap hardware router with the features you need (or void a warranty or two by flashing custom firmware onto one) but that's up to you. IMHO the frustration of bricking routers and finicky router hardware isn't worth it; I'd much rather have a machine I can maintain myself and keep going indefinitely with a software solution. Plus I can do things like use the same box for various Internet-facing servers and such, which comes in handy.

Share this post


Link to post
Share on other sites
Quote:
Original post by ApochPiQ
I'd say take your Linux box and replace the router with that; setting up a Linux-based routing/shaping system is fairly straightforward, although not without some tricky bits.

You could potentially get a cheap hardware router with the features you need (or void a warranty or two by flashing custom firmware onto one) but that's up to you. IMHO the frustration of bricking routers and finicky router hardware isn't worth it; I'd much rather have a machine I can maintain myself and keep going indefinitely with a software solution. Plus I can do things like use the same box for various Internet-facing servers and such, which comes in handy.


That sounds like a very elegant solution; almost fun! If I did this, could I even write custom network software on the Linux machine? And could you point me to any links/articles where I can learn more about this and how to do it?

Also, will this still allow wireless connection? How? I only know what you've told me so far, so I appreciate all of this enlightenment and what is to come. :)

Share this post


Link to post
Share on other sites
Yep, you can still do wireless; I have my BSD machine running as a wireless gateway for my local networks. Be aware though that most commodity wireless hardware does not allow you to run it in access-point mode, only client mode; so do some research to make sure you get compatible hardware.

I learned most of what I needed to know by hunting around on Google for a few hours; unfortunately I didn't save any links or I'd point you towards where I got my info. The best I can suggest is to pick a Linux/BSD distro and stick to it; starting with a known distro gives you a set of packages to work with and an anchor point for doing some research. You may find the terms "router", "gateway", "bridge", "traffic shaping", "wireless access point", and such useful. A good place to start on the software side is pf for BSD and iptables for Linux.

Share this post


Link to post
Share on other sites
Thanks again, Apoch!

Yep, I suppose I need to dig in and do some searching of my own. We can't have everything handed to us, shame, haha. I suppose this is worth an attempt, since I theoretically don't have to buy anything nor spend time writing some complex piece of software pertaining to a subject matter I don't know jack about.

I guess I'll go ahead and mark this thread "[SOLVED]"! Just kidding! ;)

Thanks again!

Share this post


Link to post
Share on other sites
I got similar experience in my wireless environment, and I just used dedicated bandwidth management to solve this.

I used MyQoS to do this:
1. Record bandwidth usage of each and every IP addresses in my network daily, monthly, yearly
2. Limit each and every IP in my network with 256Kb/s, or 512Kb/s
3. Use the real-time monitor to check the current connections, bandwidth usage of each online users
4. Apply automatic p2p throttle like:
If any IP address has averaged more than 256Kb/s for the last 60 minutes, set the profile on that IP to reduce usage for 15 minutes.

MyQoS provides 2Mb/s free license, and it's quite flexible. You could get it at www.myqos.net

Share this post


Link to post
Share on other sites
Thanks, samfok. I will be looking into this option too. Still open to even more suggestions if anyone has them. If not, I will let this thread slip into oblivion and start doing something on my own.

Thanks again to everyone for their input! I'm very gracious for your time and effort.

Share this post


Link to post
Share on other sites
Coding Horror posted a great article about this exact subject.

Dedicating a PC to the task of routing would certainly do the task, but it's also extremely overboard. If you don't mind the power bill/space used/noise emitted/etc., then by all means. :)

Share this post


Link to post
Share on other sites

This topic is 2589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this