Skip to contentSkip to conversation

shaping marked packets

LARTC Axel Loewe 4 participants 4 messages Oct 25, 2002 – Jul 28, 2004

lore
Share & tools
lore

Axel Loewe

author
#0 lore raw

hi,

i want to decrease the upload-bandwith used by a user with the uid xyz (only one programm running under this user), so i mark the packets with iptables by adding the following rule:
iptables -A OUTPUT -t mangle -m owner --uid-owner xxx -j MARK --set-mark 1 now my problem is what to do after this ;) catch all the packets in an extra table but what then? to me it doesn't matter wheter to use cbq or htb, but htb seems easier to me ;) how do i add a qdisc that only applies to the packets in this special table?

greets axel

p.s. sorry for my poor english

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 10 lines · Axel Loewe

hi,

i want to decrease the upload-bandwith used by a user with the uid xyz (only one programm running under this user), so i mark the packets with iptables by adding the following rule:
iptables -A OUTPUT -t mangle -m owner --uid-owner xxx -j MARK --set-mark 1 now my problem is what to do after this ;) catch all the packets in an extra table but what then? to me it doesn't matter wheter to use cbq or htb, but htb seems easier to me ;) how do i add a qdisc that only applies to the packets in this special table?

Add a qdisc, add 2 classes (one for the user and one for the rest), give the first class less bandwdith, use the fw filter to catch the marked packets and put them in the first class, use a second filter (or in case of htb, make the second class the default class) to put all other packets in the second class. If you do that, you can control the traffic of the user like you want. You can even let it use all available bandwidth, but if someone else wants to do it, he has to wait.

More info about shaping can be found on www.lartc.org and www.docum.org. You need the fw fitler and cbq or htb to create the qdisc and classes.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#3 lore raw
In reply to Axel Loewe

tc qdisc del dev ethx root
tc qdisc add dev ethx root handle 1: htb
tc class add dev ethx parent 1: classid 1:1 htb rate 30kbps
tc filter add dev ethx parent 1: prio 0 protocol ip handle 1 fw flowid 1:1

Quoted 6 lines · On Tue, 27 Jul 2004 20:07:37 -0400, nix4me <[email protected]> wrote:

Hi,

I am trying to figure out how to shape the following marked packets and limit them to a speed on 30KBytes. I have read the documentation but I am unsue of what to do.

Quoted 9 lines

iptables -t mangle -A FTP-OUT -p tcp --dport 50000:51000 -j MARK --set-mark 1

Mark

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/