par Sorg » 06 Mai 2003 21:56
J'ai une solution pour toi: Limiter la bande passante globale attribuée au serveur web grâce à la QOS.
<BR>il te faudra par contre IPCOP 1.3 .
<BR>
<BR>
<BR>Crée un petit script comme çà:
<BR>/bin/qos
<BR>
<BR>
<BR>#!/bin/bash
<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>
<BR>DOWNLINK=500
<BR>UPLINK=100
<BR>DEV=ppp0
<BR>SERVERLIMIT= cequetuveux
<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=
<BR>
<BR># low priority destination ports
<BR>NOPRIOPORTDST="80 21"
<BR>
<BR>
<BR># Now remove the following two lines <IMG SRC="images/smiles/icon_smile.gif">
<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>
<BR>###### uplink
<BR>
<BR># install root HTB, point default traffic to 1:20:
<BR>
<BR>tc qdisc add dev $DEV root handle 1: htb default 20
<BR>
<BR># shape everything at $UPLINK speed - this prevents huge queues in your
<BR># DSL modem which destroy latency:
<BR>
<BR>tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k
<BR>
<BR># high prio class 1:10:
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit
<BR> burst 6k prio 1
<BR>
<BR># bulk & 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 htb rate $[9*$UPLINK/10]kbit
<BR> burst 6k prio 2
<BR>
<BR>tc class add dev $DEV parent 1:1 classid 1:30 htb rate ${SERVERLIMIT}kbit
<BR> burst 6k prio 2
<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>
<BR># TOS Minimum Delay (ssh, NOT scp) in 1:10:
<BR>
<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 10 u32
<BR> match ip protocol 1 0xff flowid 1:10
<BR>
<BR># To speed up downloads while an upload is going on, put ACK packets in
<BR># the interactive class:
<BR>
<BR>tc filter add dev $DEV parent 1: protocol ip prio 10 u32
<BR> match ip protocol 6 0xff
<BR> match u8 0x05 0x0f at 0
<BR> match u16 0x0000 0xffc0 at 2
<BR> match u8 0x10 0xff at 33
<BR> flowid 1:10
<BR>
<BR># rest is 'non-interactive' ie 'bulk' and ends up in 1:20
<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>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>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 18 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>
<BR>Adapte çà à tes besoins , et fais en sortes que le script ce lance à chaque reconnection.
<BR>