vielleicht für euch auch interessant, ich habe ein kleines script zusammengeschnipselt der trafficshaping lokal auf kiste macht um dafür zu sorgen dass pakete nicht nach FIFO abgearbeitet werden sondern dass gewisse priotirisierung stattfindet. das script ist zusammengeschnipselt aus diverse dokus und relativ schlicht, fall einer bessere ideen hat kann er es gerne modifizieren und hier wieder posten damit alle was davon haben.
ich freue mich natürlich auch wenn ihr einen fehler entdeckt und mir sagt. beim neuen hlds server ist die zeile für counterstrike überflüssig da man hlds sinnigerweise mit -tos aufrufen kann.
DEV ist das interface, STREAM eure lokale Anbindung, sollten beides so korrekt sein.
#!/bin/bash
DEV=eth0
STREAM=100mbit
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi
tc qdisc del dev $DEV root >/dev/null 2>&1
if [ "$1" = "stop" ]
then
exit
fi
#tc qdisc add dev $DEV root handle 1: prio
# ok, lets start this thing off by instaling the root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth $STREAM
# goofing around with our upstream got to set some main things straight
tc class add dev $DEV parent 1: classid 1:1 cbq rate $STREAM allot 1500 prio 5 bounded isolated
# okidookie let's whack some priority into these two queues
# high priority queue
tc class add dev $DEV parent 1:1 classid 1:10 cbq rate $STREAM allot 1600 prio 1 avpkt 1000
# low priority queue
tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $STREAM allot 1600 prio 2 avpkt 1000
# now lets give 'm a little Stochastic Fairness
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
# what would traffisshaping be without respect for the tos flag ;)
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip tos 0x10 0xff flowid 1:10
# this one here is for counterstrike, the main reason i whipped this together
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip sport 27015 0xffff flowid 1:10
# ACK Packets also get a nice priority, no need to slow them down.
tc filter add dev $DEV parent 1: protocol ip prio 13 u32
match ip protocol 6 0xff
match u8 0x05 0x0f at 0
match u16 0x0000 0xffc0 at 2
match u8 0x10 0xff at 33
flowid 1:10
# put the rest in the 2.d queue
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 match ip dst 0.0.0.0/0 flowid 1:20
# this one here is for counterstrike, the main reason i whipped this together
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip sport 27015 0xffff flowid 1:10
Sehe ich das richtig, das hier alle Pakete mit Port 27015 bevorzugt werden ?
Kann man (du;-) das umschreiben das die Ports 80 und 21 benachteiligt werden ?
#!/bin/bash
DEV=eth0
STREAM=100mbit
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi
tc qdisc del dev $DEV root >/dev/null 2>&1
if [ "$1" = "stop" ]
then
exit
fi
#tc qdisc add dev $DEV root handle 1: prio
# ok, lets start this thing off by instaling the root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth $STREAM
# goofing around with our upstream got to set some main things straight
tc class add dev $DEV parent 1: classid 1:1 cbq rate $STREAM allot 1500 prio 5 bounded isolated
# okidookie let's whack some priority into these two queues
# high priority queue
tc class add dev $DEV parent 1:1 classid 1:10 cbq rate $STREAM allot 1600 prio 1 avpkt 1000
# low priority queue
tc class add dev $DEV parent 1:1 classid 1:20 cbq rate $STREAM allot 1600 prio 2 avpkt 1000
# now lets give 'm a little Stochastic Fairness
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
# this one here is for http
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip sport 80 0xffff flowid 1:20
# this one here is for ftp data channel
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip sport 20 0xffff flowid 1:20
# this one here is for ftp command channel
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 match ip sport 21 0xffff flowid 1:20
# put the rest in the 1st queue
tc filter add dev $DEV parent 1: protocol ip prio 14 u32 match ip dst 0.0.0.0/0 flowid 1:10
ich glaube aber kaum dass du damit glücklich werden willst weil FTP ein bescheuertes protokoll ist (firewalltechnisch, besonders PASSIVE mode), da bist du wahrscheins besser dran die pakete von ftp mittels iptables zu markieren und die TOS zu setzen und anhand dessen das trafficshaping zu machen weil iptables connection tracking für ftp sessions (mehr oder minder je nach modus) beherrscht. siehe http://www.sns.ias.edu/~jns/security/ip ... k.html#FTP
DopeFish wrote:versuchs mal mit folgenden, habs aber net getestet:
ich glaube aber kaum dass du damit glücklich werden willst weil FTP ein bescheuertes protokoll ist (firewalltechnisch, besonders PASSIVE mode), da bist du wahrscheins besser dran die pakete von ftp mittels iptables zu markieren und die TOS zu setzen und anhand dessen das trafficshaping zu machen weil iptables connection tracking für ftp sessions (mehr oder minder je nach modus) beherrscht. siehe http://www.sns.ias.edu/~jns/security/ip ... k.html#FTP
Ich Danke dir. :P
Werde es gleich mal testen.
FTP ist eigendlich nebensächlich. Hauptsache ist, das die Downloads per HTTP ein wenig gebremst werden.
ändere mal die erste zeile in #!/bin/bash -x damit man sieht was schiefläuft.
es sieht aber eher dannach aus als ob die module für traffic shaping fehlen, solltest du mal im kernel auswählen (networking options -> QOS ) und dananch ein make modules && make modules_install machen (oder fest einkompilieren und rebooten)
DopeFish wrote:ändere mal die erste zeile in #!/bin/bash -x damit man sieht was schiefläuft.
es sieht aber eher dannach aus als ob die module für traffic shaping fehlen, solltest du mal im kernel auswählen (networking options -> QOS ) und dananch ein make modules && make modules_install machen (oder fest einkompilieren und rebooten)
CaptainCrunch wrote:Wie wär's denn, wenn du die nötigen Module einfach mal händisch per modprobe lädst ? ;)
Ich bin zu blöd dafür.
Ich habe folgendes gemacht :
1. cd /usr/src/linux
2. make menuconfig
3. QOS Ausgewählt und alle Module als M markiert.
4. make depend
5. make modules && make modules_install
6. modprobe sch_qdisc
aber bei kommt als Ausgabe = modprobe: Can't locate module sch_qdisc
Mach mal ein find /lib/modules/KERNELVERSION/ -name NAMEDERMODULE. Wahrscheinlich heißen die nur anders. Sorry, mit QOS habe ich mich noch nie befasst.
Ich finde das echt lustig, denn was hier ganz schnell weiterhilft, ist das von mir mal in irgendeinem Beitrag angesprochene PHP-Script, welches einfach Dateien irgendwo auf dem Server liest und und zum Beispiel in 50kb-Blöcken pro Sekunde verfüttert an den Browser. Ich denke, genau diese Lösung wird hier gesucht.
Dennoch finde ich die ganze Diskussion recht interessant :)
Das Script hab ich auf php.net gefunden, aber frag nicht wo, habs jetzt auch gerade nicht zur Hand...