Limiting bandwidth on internal interface on Linux gateway

Posted by Jack Scott on Server Fault See other posts from Server Fault or by Jack Scott
Published on 2012-12-06T04:14:36Z Indexed on 2012/12/06 5:06 UTC
Read the original article Hit count: 481

I am responsible for a Linux-based (it runs Debian) branch office router that takes a single high-speed Internet connection (eth2) and turns it into about 20 internal networks, each with a seperate subnet (192.168.1.0/24 to 192.168.20.0/24) and a seperate VLAN (eth0.101 to eth0.120). I am trying to restrict bandwidth on one of the internal subnets that is consistently chewing up more bandwidth than it should. What is the best way to do this?

My first try at this was with wondershaper, which I heard about on SuperUser here. Unfortunately, this is useful for exactly the opposite situation that I have... it's useful on the client side, not on the Internet side.

My second attempt was using the script found at http://www.topwebhosts.org/tools/traffic-control.php, which I modified so the active part is:

tc qdisc add dev eth0.113 root handle 13: htb default 100
tc class add dev eth0.113 parent 13: classid 13:1 htb rate 3mbps
tc class add dev eth0.113 parent 13: classid 13:2 htb rate 3mbps
tc filter add dev eth0.113 protocol ip parent 13:0 prio 1 u32 match ip dst 192.168.13.0/24 flowid 13:1
tc filter add dev eth0.113 protocol ip parent 13:0 prio 1 u32 match ip src 192.168.13.0/24 flowid 13:2

What I want this to do is restrict the bandwidth on VLAN 113 (subnet 192.168.13.0/24) to 3mbit up and 3mbit down. Unfortunately, it seems to have no effect at all! I'm very inexperienced with the tc command, so any help getting this working would be appreciated.

© Server Fault or respective owner

Related posts about linux

Related posts about bandwidth