Solved

rate limit / bandwidth throttling / shaping

Posted on 2003-12-08
3
36,169 Views
Last Modified: 2011-04-14
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
Comment
Question by:thefnordling
3 Comments
 
LVL 4

Accepted Solution

by:
Jivko earned 500 total points
Comment Utility
                 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
 

Author Comment

by:thefnordling
Comment Utility
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
 

Expert Comment

by:kalyandeo
Comment Utility


Hi

Try " Wondershaper"

http://lartc.org/wondershaper/

It is very easy to use.

Thanks


0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now