Hello, I''m trying to limit all outgoing traffic by means of TC. With six students we are connected through the server (Debian 2.2 kernel 2.2.18) with a cablemodem. When one person uploads (usually with full bandwidth available 15KB/s) none of the others can make use of the internet because no requests for information can be send. So, i want to limit the maximum individual upload to 5KB/s so this doesnt disturb others useing the internet. Situation: Server: 192.168.1.1 Clients: 192.168.1.2 - 192.168.1.7 eth0: LAN eth1: Cablemodem Below is what I came up with myself but it doesnt seem to work. Also when do i activate this rules? pre- of post configuring interfaces? Thnx, Wouter Smit ------------------------------------------------ #!/bin/sh TC="/sbin/tc" IF="eth1" echo Configure queueing discipline $TC qdisc add dev $IF root handle 10: cbq bandwidth 120Kbit avpkt 1000 echo Configure root class $TC class add dev $IF parent 10:0 classid 10:1 cbq bandwidth 120Kbit rate \ 120Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 echo Configure class divisions $TC class add dev $IF parent 10:1 classid 10:100 cbq bandwidth 120Kbit rate \ 40Kbit allot 1514 weight 4Kbit prio 5 maxburst 20 avpkt 1000 bounded echo Configure queue management $TC qdisc add dev $IF parent 10:100 sfq perturb 15 quantum 1514 echo Configure which packets belong to which class $TC filter add dev $IF parent 10:0 protocol ip prio 25 u32 match ip src \ 192.168.1.0/24 flowid 10:100
At 13:22 4-1-01 +0100, you wrote:>Hello, > >I''m trying to limit all outgoing traffic by means of TC. With six students >we are connected through the server (Debian 2.2 kernel 2.2.18) with a >cablemodem. When one person uploads (usually with full bandwidth available >15KB/s) none of the others can make use of the internet because no requests >for information can be send. > >So, i want to limit the maximum individual upload to 5KB/s so this doesnt >disturb others useing the internet. > >Situation: > >Server: 192.168.1.1 >Clients: 192.168.1.2 - 192.168.1.7 >eth0: LAN >eth1: Cablemodem > >Below is what I came up with myself but it doesnt seem to work. Also when do >i activate this rules? pre- of post configuring interfaces? > >Thnx, >Wouter Smit > >------------------------------------------------ >#!/bin/sh > >TC="/sbin/tc" >IF="eth1" > >echo Configure queueing discipline >$TC qdisc add dev $IF root handle 10: cbq bandwidth 120Kbit avpkt 1000 > >echo Configure root class >$TC class add dev $IF parent 10:0 classid 10:1 cbq bandwidth 120Kbit rate \ > 120Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 > >echo Configure class divisions >$TC class add dev $IF parent 10:1 classid 10:100 cbq bandwidth 120Kbit rate >\ > 40Kbit allot 1514 weight 4Kbit prio 5 maxburst 20 avpkt 1000 bounded > >echo Configure queue management >$TC qdisc add dev $IF parent 10:100 sfq perturb 15 quantum 1514 > >echo Configure which packets belong to which class >$TC filter add dev $IF parent 10:0 protocol ip prio 25 u32 match ip src \ > 192.168.1.0/24 flowid 10:100We have the exact same situation, so here is our configuration script, with a little tweaking you should be able to implement it. Most important is that you MARK the packets that enter the router with ipchains. # setup packetforwarding /sbin/ipchains -P forward DENY # here we mark the packets with -m /sbin/ipchains -A forward -s 192.168.0.1/32 -j MASQ -m 0x1 /sbin/ipchains -A forward -s 192.168.0.4/32 -j MASQ -m 0x4 /sbin/ipchains -A forward -s 192.168.0.3/32 -j MASQ -m 0x3 /sbin/ipchains -A forward -s 192.168.0.6/32 -j MASQ -m 0x6 /sbin/ipchains -A forward -s 192.168.0.7/32 -j MASQ -m 0x7 /sbin/ipchains -A forward -s 192.168.0.10/32 -j MASQ -m 0xa # eliminate spoofing /sbin/ipchains -A forward -i $extip -s 192.168.0.0/24 -d 0.0.0.0/0 -j DENY #root device for upstream, divided in various subclasses to more or less guarantee a fair loadbalancing (see below..) /usr/bin/tc qdisc add dev eth1 root handle 1: cbq bandwidth 128Kbit avpkt 1000 /usr/bin/tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 128Kbit rate 128Kbit \ allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 /usr/bin/tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 128Kbit rate 64Kbit \ allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 /usr/bin/tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 128Kbit rate 64Kbit \ allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 # configure ip 1 here for 40 kbit (to ensure fairnes..) WITH borrowing /usr/bin/tc class add dev eth1 parent 1:2 classid 1:11 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 /usr/bin/tc qdisc add dev eth1 parent 1:11 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 1 fw classid 1:11 #192.168.0.3 /usr/bin/tc class add dev eth1 parent 1:2 classid 1:13 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 /usr/bin/tc qdisc add dev eth1 parent 1:13 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 3 fw classid 1:13 #192.168.0.4 /usr/bin/tc class add dev eth1 parent 1:2 classid 1:14 cbq bandwidth 128Kbit rate 35Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 /usr/bin/tc qdisc add dev eth1 parent 1:14 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 4 fw classid 1:14 #192.168.0.6 /usr/bin/tc class add dev eth1 parent 1:3 classid 1:16 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 /usr/bin/tc qdisc add dev eth1 parent 1:16 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 6 fw classid 1:16 #192.168.0.7 /usr/bin/tc class add dev eth1 parent 1:3 classid 1:17 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 /usr/bin/tc qdisc add dev eth1 parent 1:17 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 7 fw classid 1:17 #192.168.0.10 /usr/bin/tc class add dev eth1 parent 1:3 classid 1:20 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 /usr/bin/tc qdisc add dev eth1 parent 1:20 sfq quantum 1514b perturb 15 /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 10 fw classid 1:20 So we now have 1 root class of 128 kbit, two subclasses of 64 kbit, each of those subclass serving 3 people. The 40kbit per person thing was done with one purpose: when 1 person starts the upload, and another person kicks in, the first person still gets 128Kbit - 40Kbit and the second one gets that 40 Kbit. This is more then one would get when we would simply divide 128Kbit by 6. I don''t yet know how to get the loadbalancing system to divide the space evenly (1 person=128 Kbit, 2 persons = 64Kbit, 3=43Kbit etc..), but haven''t come up with a solution yet. Sander
That is my internet-interface ;) It is quite simple: -the packets enter eth0 -then they are marked by ipchains -then they enter eth1 and thus the 128kbit class I made -and then they are balanced Sander At 21:27 4-1-01 +0100, you wrote:>Is eth1 your lan of inet interface? > >Thnx, >Wouter > >----- Original Message ----- >From: "Sander" <thrill12@gmx.net> >To: "Wouter Smit" <wouter@smit.dhs.org> >Cc: <lartc@mailman.ds9a.nl> >Sent: Thursday, January 04, 2001 7:17 PM >Subject: Re: [LARTC] traffic shaping > > > > At 13:22 4-1-01 +0100, you wrote: > > >Hello, > > > > > >I''m trying to limit all outgoing traffic by means of TC. With six >students > > >we are connected through the server (Debian 2.2 kernel 2.2.18) with a > > >cablemodem. When one person uploads (usually with full bandwidth >available > > >15KB/s) none of the others can make use of the internet because no >requests > > >for information can be send. > > > > > >So, i want to limit the maximum individual upload to 5KB/s so this doesnt > > >disturb others useing the internet. > > > > > >Situation: > > > > > >Server: 192.168.1.1 > > >Clients: 192.168.1.2 - 192.168.1.7 > > >eth0: LAN > > >eth1: Cablemodem > > > > > >Below is what I came up with myself but it doesnt seem to work. Also when >do > > >i activate this rules? pre- of post configuring interfaces? > > > > > >Thnx, > > >Wouter Smit > > > > > >------------------------------------------------ > > >#!/bin/sh > > > > > >TC="/sbin/tc" > > >IF="eth1" > > > > > >echo Configure queueing discipline > > >$TC qdisc add dev $IF root handle 10: cbq bandwidth 120Kbit avpkt 1000 > > > > > >echo Configure root class > > >$TC class add dev $IF parent 10:0 classid 10:1 cbq bandwidth 120Kbit rate >\ > > > 120Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 > > > > > >echo Configure class divisions > > >$TC class add dev $IF parent 10:1 classid 10:100 cbq bandwidth 120Kbit >rate > > >\ > > > 40Kbit allot 1514 weight 4Kbit prio 5 maxburst 20 avpkt 1000 bounded > > > > > >echo Configure queue management > > >$TC qdisc add dev $IF parent 10:100 sfq perturb 15 quantum 1514 > > > > > >echo Configure which packets belong to which class > > >$TC filter add dev $IF parent 10:0 protocol ip prio 25 u32 match ip src \ > > > 192.168.1.0/24 flowid 10:100 > > > > We have the exact same situation, so here is our configuration script, >with > > a little tweaking you should be able to implement it. Most important is > > that you MARK the packets that enter the router with ipchains. > > > > # setup packetforwarding > > /sbin/ipchains -P forward DENY > > # here we mark the packets with -m > > /sbin/ipchains -A forward -s 192.168.0.1/32 -j MASQ -m 0x1 > > /sbin/ipchains -A forward -s 192.168.0.4/32 -j MASQ -m 0x4 > > /sbin/ipchains -A forward -s 192.168.0.3/32 -j MASQ -m 0x3 > > /sbin/ipchains -A forward -s 192.168.0.6/32 -j MASQ -m 0x6 > > /sbin/ipchains -A forward -s 192.168.0.7/32 -j MASQ -m 0x7 > > /sbin/ipchains -A forward -s 192.168.0.10/32 -j MASQ -m 0xa > > # eliminate spoofing > > /sbin/ipchains -A forward -i $extip -s 192.168.0.0/24 -d 0.0.0.0/0 -j DENY > > > > #root device for upstream, divided in various subclasses to more or less > > guarantee a fair loadbalancing (see below..) > > /usr/bin/tc qdisc add dev eth1 root handle 1: cbq bandwidth 128Kbit avpkt >1000 > > /usr/bin/tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth >128Kbit > > rate 128Kbit \ > > allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 > > /usr/bin/tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth >128Kbit > > rate 64Kbit \ > > allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 > > /usr/bin/tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth >128Kbit > > rate 64Kbit \ > > allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 > > > > # configure ip 1 here for 40 kbit (to ensure fairnes..) WITH borrowing > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:11 cbq bandwidth > > 128Kbit rate 40Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > /usr/bin/tc qdisc add dev eth1 parent 1:11 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 1 >fw > > classid 1:11 > > #192.168.0.3 > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:13 cbq bandwidth > > 128Kbit rate 40Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > /usr/bin/tc qdisc add dev eth1 parent 1:13 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 3 >fw > > classid 1:13 > > #192.168.0.4 > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:14 cbq bandwidth > > 128Kbit rate 35Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > /usr/bin/tc qdisc add dev eth1 parent 1:14 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 4 >fw > > classid 1:14 > > #192.168.0.6 > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:16 cbq bandwidth > > 128Kbit rate 40Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > /usr/bin/tc qdisc add dev eth1 parent 1:16 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 6 >fw > > classid 1:16 > > #192.168.0.7 > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:17 cbq bandwidth > > 128Kbit rate 40Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > /usr/bin/tc qdisc add dev eth1 parent 1:17 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 7 >fw > > classid 1:17 > > #192.168.0.10 > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:20 cbq bandwidth > > 128Kbit rate 40Kbit \ > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > /usr/bin/tc qdisc add dev eth1 parent 1:20 sfq quantum 1514b perturb 15 > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle 10 > > fw classid 1:20 > > > > So we now have 1 root class of 128 kbit, two subclasses of 64 kbit, each >of > > those subclass serving 3 people. > > The 40kbit per person thing was done with one purpose: when 1 person >starts > > the upload, and another person kicks in, the first person still gets > > 128Kbit - 40Kbit and the second one gets that 40 Kbit. This is more then > > one would get when we would simply divide 128Kbit by 6. I don''t yet know > > how to get the loadbalancing system to divide the space evenly (1 > > person=128 Kbit, 2 persons = 64Kbit, 3=43Kbit etc..), but haven''t come up > > with a solution yet. > > > > Sander
Hi Sander, Seems to work now, below is my slightly altered configuration, thnx for helping! Greets, Wouter CLIENTS="2 3 4 5 6 7" ## Traffic shaping ########################################################## # Configure queueing discipline $TCBIN qdisc add dev $EXTERNALIF root handle 1: cbq bandwidth 128Kbit avpkt 1000 # Configure root class $TCBIN class add dev $EXTERNALIF parent 1:0 classid 1:1 cbq bandwidth 128Kbit rate 128Kbit \ allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 # Configure class divisions $TCBIN class add dev $EXTERNALIF parent 1:1 classid 1:2 cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 4Kbit prio 8 maxburst 20 avpkt 1000 bounded # configure ips for 40Kbit for I in $CLIENTS; do $TCBIN class add dev $EXTERNALIF parent 1:2 classid 1:1$I cbq bandwidth 128Kbit rate 40Kbit \ allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 bounded $TCBIN qdisc add dev $EXTERNALIF parent 1:1$I sfq quantum 1514b perturb 15 $TCBIN filter add dev $EXTERNALIF parent 1:0 protocol ip prio 100 handle $I fw classid 1:1$I done ----- Original Message ----- From: "Sander" <thrill12@gmx.net> To: "Wouter Smit" <wouter@smit.dhs.org> Cc: <lartc@mailman.ds9a.nl> Sent: Friday, January 05, 2001 4:52 AM Subject: Re: [LARTC] traffic shaping> That is my internet-interface ;) It is quite simple: > > -the packets enter eth0 > -then they are marked by ipchains > -then they enter eth1 and thus the 128kbit class I made > -and then they are balanced > > Sander > > At 21:27 4-1-01 +0100, you wrote: > >Is eth1 your lan of inet interface? > > > >Thnx, > >Wouter > > > >----- Original Message ----- > >From: "Sander" <thrill12@gmx.net> > >To: "Wouter Smit" <wouter@smit.dhs.org> > >Cc: <lartc@mailman.ds9a.nl> > >Sent: Thursday, January 04, 2001 7:17 PM > >Subject: Re: [LARTC] traffic shaping > > > > > > > At 13:22 4-1-01 +0100, you wrote: > > > >Hello, > > > > > > > >I''m trying to limit all outgoing traffic by means of TC. With six > >students > > > >we are connected through the server (Debian 2.2 kernel 2.2.18) with a > > > >cablemodem. When one person uploads (usually with full bandwidth > >available > > > >15KB/s) none of the others can make use of the internet because no > >requests > > > >for information can be send. > > > > > > > >So, i want to limit the maximum individual upload to 5KB/s so thisdoesnt> > > >disturb others useing the internet. > > > > > > > >Situation: > > > > > > > >Server: 192.168.1.1 > > > >Clients: 192.168.1.2 - 192.168.1.7 > > > >eth0: LAN > > > >eth1: Cablemodem > > > > > > > >Below is what I came up with myself but it doesnt seem to work. Alsowhen> >do > > > >i activate this rules? pre- of post configuring interfaces? > > > > > > > >Thnx, > > > >Wouter Smit > > > > > > > >------------------------------------------------ > > > >#!/bin/sh > > > > > > > >TC="/sbin/tc" > > > >IF="eth1" > > > > > > > >echo Configure queueing discipline > > > >$TC qdisc add dev $IF root handle 10: cbq bandwidth 120Kbit avpkt1000> > > > > > > >echo Configure root class > > > >$TC class add dev $IF parent 10:0 classid 10:1 cbq bandwidth 120Kbitrate> >\ > > > > 120Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 > > > > > > > >echo Configure class divisions > > > >$TC class add dev $IF parent 10:1 classid 10:100 cbq bandwidth120Kbit> >rate > > > >\ > > > > 40Kbit allot 1514 weight 4Kbit prio 5 maxburst 20 avpkt 1000bounded> > > > > > > >echo Configure queue management > > > >$TC qdisc add dev $IF parent 10:100 sfq perturb 15 quantum 1514 > > > > > > > >echo Configure which packets belong to which class > > > >$TC filter add dev $IF parent 10:0 protocol ip prio 25 u32 match ipsrc \> > > > 192.168.1.0/24 flowid 10:100 > > > > > > We have the exact same situation, so here is our configuration script, > >with > > > a little tweaking you should be able to implement it. Most importantis> > > that you MARK the packets that enter the router with ipchains. > > > > > > # setup packetforwarding > > > /sbin/ipchains -P forward DENY > > > # here we mark the packets with -m > > > /sbin/ipchains -A forward -s 192.168.0.1/32 -j MASQ -m 0x1 > > > /sbin/ipchains -A forward -s 192.168.0.4/32 -j MASQ -m 0x4 > > > /sbin/ipchains -A forward -s 192.168.0.3/32 -j MASQ -m 0x3 > > > /sbin/ipchains -A forward -s 192.168.0.6/32 -j MASQ -m 0x6 > > > /sbin/ipchains -A forward -s 192.168.0.7/32 -j MASQ -m 0x7 > > > /sbin/ipchains -A forward -s 192.168.0.10/32 -j MASQ -m 0xa > > > # eliminate spoofing > > > /sbin/ipchains -A forward -i $extip -s 192.168.0.0/24 -d 0.0.0.0/0 -jDENY> > > > > > #root device for upstream, divided in various subclasses to more orless> > > guarantee a fair loadbalancing (see below..) > > > /usr/bin/tc qdisc add dev eth1 root handle 1: cbq bandwidth 128Kbitavpkt> >1000 > > > /usr/bin/tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth > >128Kbit > > > rate 128Kbit \ > > > allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 > > > /usr/bin/tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth > >128Kbit > > > rate 64Kbit \ > > > allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 > > > /usr/bin/tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth > >128Kbit > > > rate 64Kbit \ > > > allot 1514 weight 6Kbit prio 8 maxburst 20 avpkt 1000 > > > > > > # configure ip 1 here for 40 kbit (to ensure fairnes..) WITH borrowing > > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:11 cbq bandwidth > > > 128Kbit rate 40Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > > /usr/bin/tc qdisc add dev eth1 parent 1:11 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle1> >fw > > > classid 1:11 > > > #192.168.0.3 > > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:13 cbq bandwidth > > > 128Kbit rate 40Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > > /usr/bin/tc qdisc add dev eth1 parent 1:13 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle3> >fw > > > classid 1:13 > > > #192.168.0.4 > > > /usr/bin/tc class add dev eth1 parent 1:2 classid 1:14 cbq bandwidth > > > 128Kbit rate 35Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 > > > /usr/bin/tc qdisc add dev eth1 parent 1:14 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle4> >fw > > > classid 1:14 > > > #192.168.0.6 > > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:16 cbq bandwidth > > > 128Kbit rate 40Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > > /usr/bin/tc qdisc add dev eth1 parent 1:16 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle6> >fw > > > classid 1:16 > > > #192.168.0.7 > > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:17 cbq bandwidth > > > 128Kbit rate 40Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > > /usr/bin/tc qdisc add dev eth1 parent 1:17 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle7> >fw > > > classid 1:17 > > > #192.168.0.10 > > > /usr/bin/tc class add dev eth1 parent 1:3 classid 1:20 cbq bandwidth > > > 128Kbit rate 40Kbit \ > > > allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:3 > > > /usr/bin/tc qdisc add dev eth1 parent 1:20 sfq quantum 1514b perturb15> > > /usr/bin/tc filter add dev eth1 parent 1:0 protocol ip prio 100 handle10> > > fw classid 1:20 > > > > > > So we now have 1 root class of 128 kbit, two subclasses of 64 kbit,each> >of > > > those subclass serving 3 people. > > > The 40kbit per person thing was done with one purpose: when 1 person > >starts > > > the upload, and another person kicks in, the first person still gets > > > 128Kbit - 40Kbit and the second one gets that 40 Kbit. This is morethen> > > one would get when we would simply divide 128Kbit by 6. I don''t yetknow> > > how to get the loadbalancing system to divide the space evenly (1 > > > person=128 Kbit, 2 persons = 64Kbit, 3=43Kbit etc..), but haven''t comeup> > > with a solution yet. > > > > > > Sander
To make dynamic balance traffic shaping, maybe we can use WRR quequing. You can look at: Linux 2.4 Advanced Routing Howto; section 9.6 Or you can go directly to http://wipl-wrr.dkik.dk/wrr Regards, Junus Junarto D Date: Fri, 05 Jan 2001 04:52:54 +0100> To: "Wouter Smit" <wouter@smit.dhs.org> > From: Sander <thrill12@gmx.net> > Subject: Re: [LARTC] traffic shaping > So we now have 1 root class of 128 kbit, two subclasses of 64 kbit, eachof> those subclass serving 3 people. > The 40kbit per person thing was done with one purpose: when 1 personstarts> the upload, and another person kicks in, the first person still gets > 128Kbit - 40Kbit and the second one gets that 40 Kbit. This is more then > one would get when we would simply divide 128Kbit by 6. I don''t yet know > how to get the loadbalancing system to divide the space evenly (1 > person=128 Kbit, 2 persons = 64Kbit, 3=43Kbit etc..), but haven''t come up > with a solution yet.______________________________________________ FREE Personalized Email at Mail.com Sign up at http://www.mail.com/?sr=signup
To make dynamic balance traffic shaping, maybe we can use WRR quequing. You can look at: Linux 2.4 Advanced Routing Howto; section 9.6 Or you can go directly to http://wipl-wrr.dkik.dk/wrr Regards, Junus Junarto D Date: Fri, 05 Jan 2001 04:52:54 +0100> To: "Wouter Smit" <wouter@smit.dhs.org> > From: Sander <thrill12@gmx.net> > Subject: Re: [LARTC] traffic shaping > So we now have 1 root class of 128 kbit, two subclasses of 64 kbit, eachof> those subclass serving 3 people. > The 40kbit per person thing was done with one purpose: when 1 personstarts> the upload, and another person kicks in, the first person still gets > 128Kbit - 40Kbit and the second one gets that 40 Kbit. This is more then > one would get when we would simply divide 128Kbit by 6. I don''t yet know > how to get the loadbalancing system to divide the space evenly (1 > person=128 Kbit, 2 persons = 64Kbit, 3=43Kbit etc..), but haven''t come up > with a solution yet.
Hi, I''m trying to limit the outgoing traffic. I have a router with two ethernets and a client that is routered. I can limit the incoming traffic using u32, but i tried to limit the outgoing but nothing happened. Then i tried to use ipchains and fw to limit it and again nothing happened. Here are my configurations: ------------ Client --- eth1| Router |eth0 --- Internet ------------ Router: eth0: 192.168.0.207 eth1: 10.0.1.1 Client: 10.0.1.2 SCRIPT WITH u32: tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 256Kbit avpkt 1000 cell 8 tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 256Kbit rate 256Kbit weight 20Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 tc class add dev eth0 parent 1:1 classid 1:10 cbq bandwidth 256Kbit rate 64Kbit weight 6Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded tc qdisc add dev eth0 parent 1:10 tbf rate 64Kbit buffer 10Kb/8 limit 15Kb mtu 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip src 10.0.5.2 flowid 1:10 SCRIPT WITH fw: ipchains -A forward -s 10.0.5.0/24 -j MASQ -m 0x1 tc qdisc add dev eth0 root handle 1: cbq bandwidth 128Kbit avpkt 1000 tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 tc class add dev eth0 parent 1:1 classid 1:2 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 tc class add dev eth0 parent 1:2 classid 1:11 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 tc qdisc add dev eth0 parent 1:11 sfq quantum 1514b perturb 15 tc filter add dev eth0 parent 1:0 protocol ip prio 100 handle 1 fw classid 1:11 So, does anybody know what is happening? Thanks, Bruno
Hi Bruno Maciel Fonseca, I try to solve your problem, if I''m wrong please somebody correct me. The weakness of ordinary method of QoS in Linux is only working to outgoing traffic of that interface. But this limitation overcome by using ingress method.> Router: eth0: 192.168.0.207 > eth1: 10.0.1.1 > Client: 10.0.1.2is the right client 10.0.5.2 ? There is no problem with your script with u32. But maybe it can be more efficient that to remove classid 1:1 and change the parent of 1:10 to 1:0 like below: SCRIPT WITH u32: tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 256Kbit avpkt 1000 cell 8 tc class add dev eth0 parent 1:0 classid 1:10 cbq bandwidth 256Kbit rate 64Kbit weight 6Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded tc qdisc add dev eth0 parent 1:10 tbf rate 64Kbit buffer 10Kb/8 limit 15Kb mtu 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip src 10.0.5.2 flowid 1:10 Hey, I got another idea if you use only one group of client you can use only two lines below. This will make your CPU proccessor working a little. Please let me know if I''m wrong, I never tried it before. But I have ever tried to limit the bandwidth of interface without tc filter command, that will make all outgoing traffic of interface eth0 will be limited to 64 Kbit. SCRIPT WITH u32: tc qdisc add dev eth0 root handle 1:0 tbf rate 64Kbit buffer 10Kb/8 limit 15Kb mtu 1500 tc filter add dev eth0 parent 1:0 protocol ip prio 100 u32 match ip src 10.0.5.2 flowid 1:0 Let''s look your main problem, you must use eth1 not eth0 to your commands. You can''t use ipchains like that because it only marking the incoming packet of interface eth1. And I think it''s better to use tbf than sfq for limiting traffic. The right commands is at below, but you can make more efficient like above. SCRIPT WITH fw: ipchains -A forward -s 10.0.5.0/24 -j MASQ tc qdisc add dev eth1 root handle 1: cbq bandwidth 128Kbit avpkt 1000 tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 12Kbit prio 8 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:2 classid 1:11 cbq bandwidth 128Kbit rate 128Kbit allot 1514 weight 2Kbit prio 5 maxburst 20 avpkt 1000 split 1:2 tc qdisc add dev eth1 parent 1:11 sfq quantum 1514b perturb 15 tc filter add dev eth1 parent 1:11 protocol ip prio 100 u32 match ip dst 10.0.5.2 flowid 1:11 Regards, Junus Junarto D.