LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How can I monitor and limit bandwidth? Read description on first post for detailed Q. (https://www.linuxquestions.org/questions/linux-server-73/how-can-i-monitor-and-limit-bandwidth-read-description-on-first-post-for-detailed-q-746710/)

loco41211 08-11-2009 06:57 AM

How can I monitor and limit bandwidth? Read description on first post for detailed Q.
 
I have looked all over the place and from the advice of others I have come to the conclusion it would be best to use iptables for this.

The problem:
I have a dedicated server running debian. On this server I want to run torrent clients. Which one to use I don't mind at all, as long as it meets the requirements. What I want is:
  • To monitor diskspace used per user (many possible solutions for this)
  • To monitor the bandwidth used per user (what I am stuck on!)
  • Once this bandwidth threshold (example 250GB total traffic) is hit, another script is triggered.

On the current set up, for each user who has access to the client a unix account is created. This account starts it's own torrent client relative to the user and the userdir. Using quota the disk space usage can be tracked and limited.

How would I go about tracking the monthly traffic (outgoing and incoming) per user (or per process by pid number?). There must be some way to do this... I can't work it out, and it might be since my iptables knowledge isn't the greatest!

Possible solutions so far:Will be updated as we go along
  • The idea posted by a user here: LINK But I need help on setting something like that up. Password for link is
    Quote:

    ewok.adventure



If you have any ideas please let me know, I will be tracking this topic as I need to solve this asap... Thanks in advance!

vishesh 08-11-2009 07:33 AM

Marking packet using iptables and using tc for traffic control can help you in this way. For beginner reference in this direction visit www.linuxinterviews.blogspot.com.

Thanks

zhjim 08-11-2009 07:39 AM

If the post from vishesh does not take you far do a google search for
"linux traffic control" this should get you far.


Anyways the link you provided needs a password. bummer.

loco41211 08-11-2009 07:44 AM

Quote:

Originally Posted by zhjim (Post 3639179)
Anyways the link you provided needs a password. bummer.

Damn I forgot they password protected the site... had a little argument with them about that because they moved my question after I got answers without giving me a password for it. Anyway, the password to get to it is:
Quote:

ewok.adventure

chitambira 08-11-2009 07:45 AM

if user := ipaddr; then
http://bandwidthd.sourceforge.net/
else
put server behind proxy and use proxy stats
or go the QoS way

loco41211 08-11-2009 07:46 AM

Quote:

Originally Posted by vishesh (Post 3639167)
Marking packet using iptables and using tc for traffic control can help you in this way. For beginner reference in this direction visit www.linuxinterviews.blogspot.com.

Thanks

tc only allows shaping such as how many max kb/s to allow. I want to limit the total traffic up to a set threshold which gets cleared at the end of every calendar month. Thanks for the suggestion

EDIT:
chitambira: I noticed bandwidthd before, but that only allows monitoring of the overall network interface (or just traffic to/from a single IP. All clients are on the same IP though...) and not an individual process or all processes owned by a user.


All times are GMT -5. The time now is 08:09 PM.