par Sorg » 28 Avr 2003 12:25
<!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-2>En réponse à:</font><HR></TD></TR><TR><TD><FONT SIZE=-2><BLOCKQUOTE>
<BR>Le 2003-04-28 09:24, dbomber a écrit:
<BR>tu as modifié quoi, sorg, dans le script de wondershaper. Tu peux le mettre dans le post, ça m'interesse bougrement! Merci d'avance.
<BR>
<BR> <IMG SRC="images/smiles/icon_bise.gif">
<BR>
<BR></BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>Bon vala:
<BR>
<BR><!-- BBCode Quote Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font size=-2>En réponse à:</font><HR></TD></TR><TR><TD><FONT SIZE=-2><BLOCKQUOTE>#!/bin/bash
<BR>
<BR># Wonder Shaper
<BR># please read the README before filling out these values
<BR>#
<BR># Set the following values to somewhat less than your actual download
<BR># and uplink speed. In kilobits. Also set the device that is to be shaped.
<BR>DOWNLINK=480
<BR>UPLINK=110
<BR>DEV=ppp0
<BR>
<BR># low priority OUTGOING traffic - you can leave this blank if you want
<BR># low priority source netmasks
<BR>NOPRIOHOSTSRC=
<BR>
<BR># low priority destination netmasks
<BR>NOPRIOHOSTDST=
<BR>
<BR># low priority source ports
<BR>NOPRIOPORTSRC=4662
<BR>
<BR># low priority destination ports
<BR>NOPRIOPORTDST=4662
<BR>
<BR># Now remove the following two lines <IMG SRC="images/smiles/icon_smile.gif">
<BR>
<BR>
<BR>#########################################################
<BR>
<BR>if [ "$1" = "status" ]
<BR>then
<BR> tc -s qdisc ls dev $DEV
<BR> tc -s class ls dev $DEV
<BR> exit
<BR>fi
<BR>
<BR>
<BR># clean existing down- and uplink qdiscs, hide errors
<BR>tc qdisc del dev $DEV root 2> /dev/null > /dev/null
<BR>tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
<BR>
<BR>if [ "$1" = "stop" ]
<BR>then
<BR> exit
<BR>fi
<BR>
<BR>###### uplink
<BR>
<BR># install root CBQ
<BR>
<BR>tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 608kbit
<BR>
<BR># shape everything at $UPLINK speed - this prevents huge queues in your
<BR># DSL modem which destroy latency:
<BR># main class
<BR>
<BR>tc class add dev $DEV parent 1: classid 1:1 cbq rate ${UPLINK}kbit
<BR>allot 1500 prio 5 bounded isolated
<BR>
<BR># high prio class 1:10:
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:10 cbq rate ${UPLINK}kbit
<BR> allot 1500 prio 1 avpkt 1000
<BR>
<BR># bulk and default class 1:20 - gets slightly less traffic,
<BR># and a lower priority:
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $[9*$UPLINK/10]kbit
<BR> allot 1500 prio 2 avpkt 1000
<BR>
<BR># 'traffic we hate'
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:30 cbq rate 80kbit
<BR> allot 1500 prio 2 avpkt 1000 bounded
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:40 cbq rate 80kbit
<BR> allot 1500 prio 3 avpkt 1000 bounded
<BR>
<BR># all get Stochastic Fairness:
<BR>tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
<BR>tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
<BR>tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
<BR>tc qdisc add dev $DEV parent 1:40 handle 40: sfq perturb 10
<BR>
<BR># start filters
<BR># TOS Minimum Delay (ssh, NOT scp) in 1:10:
<BR>tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32
<BR> match ip tos 0x10 0xff flowid 1:10
<BR>
<BR># ICMP (ip protocol 1) in the interactive class 1:10 so we
<BR># can do measurements & impress our friends:
<BR>tc filter add dev $DEV parent 1:0 protocol ip prio 11 u32
<BR> match ip protocol 1 0xff flowid 1:10
<BR>
<BR># prioritize small packets (<64 bytes)
<BR>
<BR>tc filter add dev $DEV parent 1: protocol ip prio 12 u32
<BR> match ip protocol 6 0xff
<BR> match u8 0x05 0x0f at 0
<BR> match u16 0x0000 0xffc0 at 2
<BR> flowid 1:10
<BR>
<BR>
<BR># some traffic however suffers a worse fate
<BR>for a in $NOPRIOPORTDST
<BR>do
<BR> tc filter add dev $DEV parent 1: protocol ip prio 14 u32
<BR> match ip dport $a 0xffff flowid 1:30
<BR>done
<BR>
<BR>#Ajout manuel
<BR> tc filter add dev $DEV parent 1: protocol ip prio 16 u32
<BR> match ip dport 4663 0xffff flowid 1:30
<BR> tc filter add dev $DEV parent 1: protocol ip prio 17 u32
<BR> match ip dport 4664 0xffff flowid 1:30
<BR>
<BR>
<BR>for a in $NOPRIOPORTSRC
<BR>do
<BR> tc filter add dev $DEV parent 1: protocol ip prio 15 u32
<BR> match ip sport $a 0xffff flowid 1:30
<BR>done
<BR>
<BR> tc filter add dev $DEV parent 1: protocol ip prio 18 u32
<BR> match ip sport 4663 0xffff flowid 1:30
<BR>
<BR> tc filter add dev $DEV parent 1: protocol ip prio 19 u32
<BR> match ip sport 4664 0xffff flowid 1:30
<BR>
<BR>
<BR>
<BR>#for a in $NOPRIOHOSTSRC
<BR>#do
<BR># tc filter add dev $DEV parent 1: protocol ip prio 16 u32
<BR># match ip src $a flowid 1:30
<BR>#done
<BR>
<BR>#for a in $NOPRIOHOSTDST
<BR>#do
<BR># tc filter add dev $DEV parent 1: protocol ip prio 17 u32
<BR># match ip dst $a flowid 1:30
<BR>#done
<BR>
<BR># rest is 'non-interactive' ie 'bulk' and ends up in 1:20
<BR>
<BR>tc filter add dev $DEV parent 1: protocol ip prio 20 u32
<BR> match ip dst 0.0.0.0/0 flowid 1:20
<BR>
<BR>
<BR>########## downlink #############
<BR># slow downloads down to somewhat less than the real speed to prevent
<BR># queuing at our ISP. Tune to see how high you can set it.
<BR># ISPs tend to have *huge* queues to make sure big downloads are fast
<BR>#
<BR># attach ingress policer:
<BR>
<BR>tc qdisc add dev $DEV handle ffff: ingress
<BR>
<BR># filter *everything* to it (0.0.0.0/0), drop everything that's
<BR># coming in too fast:
<BR>
<BR>tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src
<BR> 0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
<BR></BLOCKQUOTE></FONT></TD></TR><TR><TD><HR></TD></TR></TABLE><!-- BBCode Quote End -->
<BR>
<BR>
<BR>Attention: Ce script est modifié à la portugaise (façon de parler, j'ai rien contre les portugais)
<BR>Il est concu pour limiter l'UL de mes tros postes emule (ports 4662 à 4464) à 10ko/s ... Ne modifiez pas cette valeur: d'une part parce que si tout le monde fais çà c'est la mort du réseau P2P assuré. d'autre part parce que vous vous pénaliserez vous même. Le système de crédit ne vous faisant plus bénéficier d'un taux de download élevé pour vous récompenser de l'UL...
<BR>
<BR>
<BR>
<BR><BR><BR><font size=-2></font>