• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 36311
  • Last Modified:

rate limit / bandwidth throttling / shaping

I want a simple way to throttle outbound and inbound bandwidth usages on eth0.  I've used the shaper module, but sadly it only shapes outbound traffic.  I've tried using tc, but it's really damed complicated, and i could only find examples for ingress filtering.  Can somone give me an example of rate limiting both inbound & outbound traffic on an ethernet device to 128kbit?
0
thefnordling
Asked:
thefnordling
1 Solution
 
JivkoCommented:
                 Inbond:

                  tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 bandwidth 10mbit

        tc class add dev eth0 parent 1: classid 1:1 cbq rate 128kbit \
        allot 1500 prio 5 bounded isolated

        tc filter add dev eth0 parent 1: protocol ip prio 16 u32 \
        match ip dst 192.168.0.0/24 flowid 1:1
 

                  Outbond:

                  tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 bandwidth 10mbit

        tc class add dev eth0 parent 1: classid 1:1 cbq rate 128kbit \
        allot 1500 prio 5 bounded isolated

        tc filter add dev eth0 parent 1: protocol ip prio 16 u32 \
        match ip dst 192.168.0.0/24 flowid 1:1


The easyest way:
cbq.init script or htb.init

Configuring CBQ can be a bit daunting, especially if all you want to do is shape some computers behind a router. CBQ.init can help you configure Linux with a simplified syntax.

For example, if you want all computers in your 192.168.1.0/24 subnet (on 10mbit eth1) to be limited to 28kbit/s download speed, put this in the CBQ.init configuration file:


DEVICE=eth1,10Mbit,1Mbit
RATE=28Kbit
WEIGHT=2Kbit
PRIO=5
RULE=192.168.1.0/24


htb.init

http://sourceforge.net/projects/htbinit/

Regards








 




0
 
thefnordlingAuthor Commented:
i ended up using rshaper.  http://ar.linux.it/cgi-bin/cvsweb/rshaper/

I had to make some small changes to the import statements in the source, since its an old package using some deprecated libraries.  

i just compiled, did insmod, and it was done.   It worked very well.

Thanks for the answer though, rshaper has it's limitations and i may come back to the tc qdisc stuff if rshaper doesn't pan out.  

0
 
kalyandeoCommented:


Hi

Try " Wondershaper"

http://lartc.org/wondershaper/

It is very easy to use.

Thanks


0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now