Re: Re: A question.

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



15 Kbps half duplex

tc qdisc add dev imq0 root handle 1: htb default 2

tc class add dev imq0 parent 1: classid 1:1 htb rate 15kbps
tc qdisc add dev imq0 parent 1:1 handle 10: sfq perturb 10
tc filter add dev imq0 protocol ip parent 10:0 prio 1 u32 match ip src 192.168.1.1/32 flowid 1:1
tc filter add dev imq0 protocol ip parent 10:0 prio 1 u32 match ip dst 192.168.1.1/32 flowid 1:1

tc class add dev imq0 parent 1: classid 1:2 htb rate 15kbps
tc qdisc add dev imq0 parent 1:2 handle 20: sfq perturb 10
tc filter add dev imq0 protocol ip parent 20:0 prio 1 u32 match ip src 192.168.1.2/32 flowid 1:2
tc filter add dev imq0 protocol ip parent 20:0 prio 1 u32 match ip dst 192.168.1.2/32 flowid 1:2

tc class add dev imq0 parent 1: classid 1:3 htb rate 15kbps
tc qdisc add dev imq0 parent 1:3 handle 30: sfq perturb 10
tc filter add dev imq0 protocol ip parent 30:0 prio 1 u32 match ip src 192.168.1.3/32 flowid 1:3
tc filter add dev imq0 protocol ip parent 30:0 prio 1 u32 match ip dst 192.168.1.3/32 flowid 1:3

iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 0
iptables -t mangle -A PREROUTING -i eth1 -j IMQ --todev 0

ip link set imq0 up


From what reading I have done this is what I would probably try first. Seeing as I don't have a box set up with IMQ to test I can't tell you for sure if this will work or not. I think at the very least it will give you a head start as a direction to go run. I'll try this as soon as I get a box up and running that does have IMQ on it. I know that I did modify a script that I am running here in the office to rate limit BitTourrents (for my Linux Distro's ISOs) with very similar rules matching based on source or destination port. However I was using that on the raw ethernet device, not IMQ. However if you are wanting rate limiting for in and out bound traffic combined you need something like IMQ or some other sort of loop back connection that you can rate limit on. I think there might be a way to optimize the src and / or dst matches, though I'm not aware of any off hand. I'll keep looking at this and get back to you.



Grant. . . . _______________________________________________ LARTC mailing list LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux