Hello! I read a post on LARTC mailing list ( http://mailman.ds9a.nl/pipermail/lartc/2002q3/004827.html ) ...and I found a script called "Games Script"! I need to know....what I have done wrong in my scripts(see below) ! When the bandwith it''s FULL (of downloads), CounterStrike lag it''s very very high(practically unplayable) [Counter Strike transfer its UDP on Destination Port 27015 and Source Port 27005] Sorry for this huge e-mail but I want to know I''ve done wrog! #### eth0 (iNet Interface) #!/bin/sh # last update 26.02.2003 TOTAL=320Kbit echo "delete!" tc qdisc del dev eth0 root echo "qdisc..." tc qdisc add dev eth0 root handle 1: htb default 2 r2q 3 tc class add dev eth0 parent 1: classid 1:1 htb rate $TOTAL ceil $TOTAL tc class add dev eth0 parent 1:1 classid 1:2 htb rate 50Kbit ceil $TOTAL prio 6 # !!default!! tc class add dev eth0 parent 1:1 classid 1:3 htb rate 50Kbit ceil $TOTAL prio 3 # SSH tc class add dev eth0 parent 1:1 classid 1:4 htb rate 50Kbit ceil $TOTAL prio 3 # VNC+Remote Desktop Connection tc class add dev eth0 parent 1:1 classid 1:5 htb rate 50Kbit ceil $TOTAL prio 1 # WWW tc class add dev eth0 parent 1:1 classid 1:6 htb rate 50Kbit ceil $TOTAL prio 3 #telnet tc class add dev eth0 parent 1: classid 1:60 htb rate 240Kbit ceil 240Kbit #ACK+SYN+FIN+RST tc class add dev eth0 parent 1: classid 1:70 htb rate 80Kbit ceil 80Kbit #ICMP tc class add dev eth0 parent 1: classid 1:71 htb rate 80Kbit ceil 80Kbit #DNS tc class add dev eth0 parent 1: classid 1:72 htb rate 240Kbit ceil 240Kbit #Counter Strike #tc qdisc add dev eth0 parent 1:2 handle 2: sfq perturb 1 #tc qdisc add dev eth0 parent 1:5 handle 5: sfq perturb 3 #tc qdisc add dev eth0 parent 1:6 handle 6: sfq perturb 1 echo "filters..." tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport \ 3389 0xffff flowid 1:4 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport \ 445 0xffff flowid 1:4 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport \ 23 0xffff flowid 1:6 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport \ 22 0xffff flowid 1:3 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dport \ 22 0xffff flowid 1:3 tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport \ 80 0xffff flowid 1:5 #DNS tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip dport 53 0xff \ flowid 1:71 #Counter Strike tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip dport 27015 0xffff \ flowid 1:72 #ICMP tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match u8 0x01 0xff at 9 \ flowid 1:70 #ACK tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u8 0x10 0x10 at 33 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:60 #SYN tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u8 0x02 0x02 at 33 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:60 #FIN tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u8 0x01 0x01 at 33 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:60 #RST tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ match ip protocol 6 0xff \ match u8 0x05 0x0f at 0 \ match u8 0x04 0x04 at 33 \ match u16 0x0000 0xffc0 at 2 \ flowid 1:60 #### eth1 (LAN Interface) #!/bin/sh TRATE=960Kbit echo "delete!" tc qdisc del dev eth1 root 2>/dev/null >/dev/null echo "add qdisc..." tc qdisc add dev eth1 root handle 1: htb default 99 r2q 1 #atentie!!! suma(rate copii) = rate parinte !!!! echo "add classes..." tc class add dev eth1 parent 1: classid 1:1 htb rate $TRATE ceil $TRATE tc class add dev eth1 parent 1: classid 1:139 htb rate 4000Kbit ceil 4000Kbit #ICMP class tc class add dev eth1 parent 1: classid 1:111 htb rate 80Kbit ceil 80Kbit #DNS class tc class add dev eth1 parent 1: classid 1:112 htb rate 40Kbit ceil 80Kbit #www class tc class add dev eth1 parent 1:1 classid 1:3 htb rate 50Kbit ceil $TRATE prio 1 #rdc class tc class add dev eth1 parent 1:1 classid 1:6 htb rate 50Kbit ceil $TRATE prio 1 #netbios tc class add dev eth1 parent 1:1 classid 1:7 htb rate 50Kbit ceil $TRATE prio 1 #ssh class tc class add dev eth1 parent 1:1 classid 1:4 htb rate 16Kbit ceil $TRATE prio 1 #dhcpd tc class add dev eth1 parent 1:1 classid 1:5 htb rate 16Kbit ceil $TRATE prio 2 #Counter Strike tc class add dev eth1 parent 1:1 classid 1:8 htb rate 84Kbit ceil $TRATE prio 1 #others parent DOWN=540 tc class add dev eth1 parent 1:1 classid 1:2 htb rate $[DOWN]Kbit ceil $TRATE prio 2 #badboys classes N=24 #23 + 1(default) = 24 RATE=$[(8*$DOWN)/(10*$N)] echo "$[RATE]Kbit / class" tc class add dev eth1 parent 1:2 classid 1:226 htb rate $[RATE+5]Kbit ceil $TRATE prio 0 #226 tc class add dev eth1 parent 1:2 classid 1:227 htb rate $[RATE]Kbit ceil $TRATE prio 2 #227 tc class add dev eth1 parent 1:2 classid 1:228 htb rate $[RATE]Kbit ceil $TRATE prio 2 #228 tc class add dev eth1 parent 1:2 classid 1:229 htb rate $[RATE]Kbit ceil $TRATE prio 2 #229 tc class add dev eth1 parent 1:2 classid 1:230 htb rate $[RATE]Kbit ceil $TRATE prio 2 #230 tc class add dev eth1 parent 1:2 classid 1:231 htb rate $[RATE]Kbit ceil $TRATE prio 2 #231 tc class add dev eth1 parent 1:2 classid 1:232 htb rate $[RATE]Kbit ceil $TRATE prio 2 #232 tc class add dev eth1 parent 1:2 classid 1:233 htb rate $[RATE]Kbit ceil $TRATE prio 2 #233 tc class add dev eth1 parent 1:2 classid 1:234 htb rate $[RATE]Kbit ceil $TRATE prio 2 #234 #tc class add dev eth1 parent 1:2 classid 1:235 htb rate $[RATE]Kbit ceil $TRATE prio 2 #235 tc class add dev eth1 parent 1:2 classid 1:236 htb rate $[RATE]Kbit ceil $TRATE prio 2 #236 tc class add dev eth1 parent 1:2 classid 1:237 htb rate $[RATE]Kbit ceil $TRATE prio 2 #237 tc class add dev eth1 parent 1:2 classid 1:238 htb rate $[RATE]Kbit ceil $TRATE prio 2 #238 tc class add dev eth1 parent 1:2 classid 1:239 htb rate $[RATE]Kbit ceil $TRATE prio 2 #239 tc class add dev eth1 parent 1:2 classid 1:240 htb rate $[RATE]Kbit ceil $TRATE prio 2 #240 tc class add dev eth1 parent 1:2 classid 1:241 htb rate $[RATE]Kbit ceil $TRATE prio 2 #241 tc class add dev eth1 parent 1:2 classid 1:242 htb rate $[RATE]Kbit ceil $TRATE prio 2 #242 tc class add dev eth1 parent 1:2 classid 1:243 htb rate $[RATE]Kbit ceil $TRATE prio 2 #243 tc class add dev eth1 parent 1:2 classid 1:244 htb rate $[RATE]Kbit ceil $TRATE prio 2 #244 tc class add dev eth1 parent 1:2 classid 1:245 htb rate $[RATE]Kbit ceil $TRATE prio 2 #245 #tc class add dev eth1 parent 1:2 classid 1:246 htb rate $[RATE]Kbit ceil $TRATE prio 2 #246 #tc class add dev eth1 parent 1:2 classid 1:247 htb rate $[RATE]Kbit ceil $TRATE prio 2 #247 #tc class add dev eth1 parent 1:2 classid 1:248 htb rate $[RATE]Kbit ceil $TRATE prio 2 #248 tc class add dev eth1 parent 1:2 classid 1:249 htb rate $[RATE]Kbit ceil $TRATE prio 2 #249 tc class add dev eth1 parent 1:2 classid 1:250 htb rate $[RATE]Kbit ceil $TRATE prio 2 #250 #tc class add dev eth1 parent 1:2 classid 1:251 htb rate $[RATE]Kbit ceil $TRATE prio 2 #251 tc class add dev eth1 parent 1:2 classid 1:252 htb rate $[RATE]Kbit ceil $TRATE prio 2 #252 #tc class add dev eth1 parent 1:2 classid 1:253 htb rate $[RATE]Kbit ceil $TRATE prio 2 #253 tc class add dev eth1 parent 1:2 classid 1:254 htb rate $[RATE]Kbit ceil $TRATE prio 2 #254 #default class tc class add dev eth1 parent 1:2 classid 1:99 htb rate $[RATE]Kbit ceil $TRATE prio 2 #0 echo "add filters..." #icmp tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 \ match u8 0x01 0xff at 9 \ flowid 1:111 #icmp tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 \ match ip sport 53 0xff \ flowid 1:112 #samba tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport \ 139 0xffff match ip src 81.196.113.225 flowid 1:139 tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport \ 138 0xffff match ip src 81.196.113.225 flowid 1:139 tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport \ 137 0xffff match ip src 81.196.113.225 flowid 1:139 #www tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport \ 80 0xffff match ip dst 81.196.113.224/27 flowid 1:3 #rdc tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 match ip dport \ 3389 0xffff match ip dst 81.196.113.224/27 flowid 1:6 #netbios tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dport \ 445 0xffff match ip dst 81.196.113.224/27 flowid 1:7 #ssh tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 match ip sport \ 22 0xffff flowid 1:4 tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 match ip dport \ 22 0xffff flowid 1:4 #dhcp tc filter add dev eth1 parent 1:0 protocol ip prio 2 u32 match ip sport \ 67 0xffff match ip dst 81.196.113.224/27 flowid 1:5 #Counter Strike tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip sport \ 27005 0xffff match ip dst 81.196.113.224/27 flowid 1:8 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.226 flowid 1:226 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.227 flowid 1:227 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.228 flowid 1:228 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.229 flowid 1:229 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.230 flowid 1:230 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.231 flowid 1:231 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.232 flowid 1:232 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.233 flowid 1:233 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.234 flowid 1:234 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.235 flowid 1:235 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.236 flowid 1:236 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.237 flowid 1:237 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.238 flowid 1:238 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.239 flowid 1:239 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.240 flowid 1:240 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.241 flowid 1:241 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.242 flowid 1:242 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.243 flowid 1:243 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.244 flowid 1:244 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.245 flowid 1:245 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.246 flowid 1:246 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.247 flowid 1:247 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.248 flowid 1:248 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.249 flowid 1:249 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.250 flowid 1:250 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.251 flowid 1:251 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.252 flowid 1:252 #tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ # 81.196.113.253 flowid 1:253 tc filter add dev eth1 parent 1:0 protocol ip prio 3 u32 match ip dst \ 81.196.113.254 flowid 1:254 echo "add leaf qdisc..." tc qdisc add dev eth1 parent 1:3 handle 3: sfq perturb 2 tc qdisc add dev eth1 parent 1:4 handle 4: sfq perturb 2 tc qdisc add dev eth1 parent 1:139 handle 139: sfq perturb 1 tc qdisc add dev eth1 parent 1:99 handle 99: sfq perturb 2
On Friday 04 April 2003 02:45, lartc@go.ro wrote:> Hello! > I read a post on LARTC mailing list ( > http://mailman.ds9a.nl/pipermail/lartc/2002q3/004827.html ) ...and I found > a script called "Games Script"! I need to know....what I have done wrong in > my scripts(see below) ! When the bandwith it''s FULL (of downloads), > CounterStrike lag it''s very very high(practically unplayable) > > [Counter Strike transfer its UDP on Destination Port 27015 and Source Port > 27005] Sorry for this huge e-mail but I want to know I''ve done wrog!I have some remarks on the script. First of all, you have to create 1 class (1:1) attached to the root qdisc with rate = ceil = $TOTAL like you did, BUT that''s the only class you may attach to that root qdisc. In your script, you also have class 1:60, 1:70, 1:71 and 1:71 attached to it. An other remark is the different prio''s you use for the classes. A class with a low prio has a low latency ONLY if you don''t overlimit that class. So if you send more data in that class then the configure rate, you will get a very high latency. And don''t you get any errors from the kernel about "quantum is too big"? You have to raise r2q to avoid these messages. You never said what your maximum bandwidth is. If this is 320 kbit for eth0, then you should make sure that you never send more data then your link can handle. So you better limit the traffic to 310 kbit or so. And also keep in mind that parent ceil is not respected. So if all you classes are sending as much as they can, they will send 50+50+50+50+50+240+80+80+240 and this is more then 320kbit. So you will overlimit your router. So the router will queue the packets in a big queue. And all traffic shaping you did is gone. The rest of the script itself is ok (I think). Stef -- stef.coene@docum.org "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/