Re: [LARTC] HTB, strange capacity distribution
Hello, thanks Andreas, I reconfigured HTB to get your suggested hierarhy: AK 1: HTB Qdisc AK | AK \--- 1:2 HTB root class (10Kbit:10kbit) AK | AK \--- 1:2000 HTB leaf class (5Kbit:10Kbit) #local AK | AK \--- 1:3000 HTB parent class (2048Kbit:2048Kbit) AK | AK \--- 1:3010 HTB leaf class (64000bit:256000bit) #ctrl AK \--- 1:3020 HTB leaf class (128000bit:768000bit) #other AK \--- 1:3030 HTB leaf class (512000bit:2048Kbit) #www AK \--- 1:5040 HTB leaf class (386000bit:386000bit) #p2p tc -d class show dev eth0 class htb 1:2 root rate 10Kbit ceil 10Kbit burst 51587b/8 mpu 0b overhead 0b cburst 51587b/8 mpu 0b overhead 0b level 7 # local: class htb 1:2000 parent 1:2 leaf 2000: prio 0 quantum 20 rate 5Kbit ceil 10Kbit burst 26593b/8 mpu 0b overhead 0b cburst 51587b/8 mpu 0b overhead 0b level 0 # root for internet trafic class htb 1:3000 parent 1:2 rate 2048Kbit ceil 2048Kbit burst 2623b/8 mpu 0b overhead 0b cburst 2623b/8 mpu 0b overhead 0b level 6 # ctrl class class htb 1:3010 parent 1:3000 leaf 3010: prio 1 quantum 1000 rate 64000bit ceil 256000bit burst 1631b/8 mpu 0b overhead 0b cburst 1727b/8 mpu 0b overhead 0b level 0 # other class class htb 1:3020 parent 1:3000 leaf 3020: prio 2 quantum 1600 rate 128000bit ceil 768000bit burst 1663b/8 mpu 0b overhead 0b cburst 1983b/8 mpu 0b overhead 0b level 0 # www class class htb 1:3030 parent 1:3000 leaf 3030: prio 3 quantum 12800 rate 1024Kbit ceil 2048Kbit burst 2111b/8 mpu 0b overhead 0b cburst 2623b/8 mpu 0b overhead 0b level 0 # p2p class class htb 1:5040 parent 1:3000 leaf 5040: prio 4 quantum 1600 rate 128000bit ceil 256000bit burst 1663b/8 mpu 0b overhead 0b cburst 1727b/8 mpu 0b overhead 0b level 0 Sorry to say, results are not as expected. I made new measurements, please see following picture (based on HTB config above): http://elusion.sk/visual_inet_6.png Point A - until now, p2 clas had CEIL 386 kbit. Now, I reset p2p class CEIL to 2048 kbit. As you can see, p2p rised as expected Point B - www class RATE-CEIL is 512-2048 kbit, p2p class RATE-CEIL is 128-2048 kbit. PROBLEM: why did not www get more capacity? Point C - www class RATE-CEIL is 1536-2048 kbit, p2p class RATE-CEIL is 128-2048 kbit. PROBLEM: RATE of www is 1536, but class did not get this capacity; p2p should fall to it's RATE 256 kbit Point D - www class RATE-CEIL is 1024-2048 kbit, p2p class RATE-CEIL is 128-2048 kbit - no change Point E - www class RATE-CEIL is 1024-2048 kbit, p2p class RATE-CEIL is 128-256 kbit - as expected: p2p is bounded to 256 kbit limit, so the rest of the capacity was used by www class I have expected that in points B, C and D, p2p class falls down to it's specified rate and www gets most of the capacity. But this is not happening - p2p will not fall down Any other things to test, please? Best regards, B. Gereg mailto:[EMAIL PROTECTED] -Originalna sprava- Od: Andreas Klauer [mailto:[EMAIL PROTECTED] Poslane: Tuesday, February 21, 2006, 8:52:49 AM Komu: [EMAIL PROTECTED] Predmet: [LARTC] HTB, strange capacity distribution AK On Tue, Feb 21, 2006 at 12:49:59AM +0100, Boris Gereg wrote: (first of all, please, how to reply to some article in LARTC via mail to post it into right thread?) AK Using 'reply all', or 'reply list' if your mail software offers it. AK If all else fails, just hit 'reply' and add the mailing list to CC. So, I am definitely shaping outgoing traffic (upstream) AK Yes, outgoing traffic from router to your network, which actually AK contains the downstream traffic from the internet. Right? tc -d class show dev eth0 class htb 1:2 root rate 10Kbit ceil 10Kbit burst 51587b/8 mpu 0b overhead 0b cburst 51587b/8 mpu 0b overhead 0b level 7 class htb 1:2000 parent 1:2 leaf 2000: prio 0 quantum 20 rate 5Kbit ceil 10Kbit burst 26593b/8 mpu 0b overhead 0b cburst 51587b/8 mpu 0b overhead 0b level 0 class htb 1:3010 parent 1:2 leaf 3010: prio 1 quantum 1000 rate 64000bit ceil 256000bit burst 1631b/8 mpu 0b overhead 0b cburst 1727b/8 mpu 0b overhead 0b level 0 class htb 1:3020 parent 1:2 leaf 3020: prio 2 quantum 1600 rate 128000bit ceil 768000bit burst 1663b/8 mpu 0b overhead 0b cburst 1983b/8 mpu 0b overhead 0b level 0 class htb 1:3030 parent 1:2 leaf 3030: prio 3 quantum 6400 rate 512000bit ceil 2048Kbit burst 1855b/8 mpu 0b overhead 0b cburst 2623b/8 mpu 0b overhead 0b level 0 class htb 1:5040 parent 1:2 leaf 5040: prio 4 quantum 4825 rate 386000bit ceil 386000bit burst 1792b/8 mpu 0b overhead 0b cburst 1792b/8 mpu 0b overhead 0b level 0 AK It's as I suspected, your current HTB tree looks like this: AK 1: HTB Qdisc AK | AK \--- 1:2 HTB root class (10Kbit:10kbit) AK | AK \--- 1:2000 HTB leaf class (5Kbit:10Kbit) AK \--- 1:3010 HTB leaf class (64000bit:256000bit) AK \--- 1:3020 HTB leaf class (128000bit:768000bit) AK \---
[LARTC] Best internet traffic shaping for small lan
I'm admin of 50 clients. Sometimes I upgrading my internet traffic shaping script. I think rules of inetrnet traffic shaping is very important thing! I would like to ask some help from people, who understand something about SQUID ZPH and TC, to aim beter internet traffic shaping scripts. Squid has ZPH suport, becouse its responds to such commands as: zph_tos_local 8 zph_tos_peer 0 zph_tos_parent off Next 2 comands SQUID is not responding ( I think it's becouse of KERNEL..). As I readed about it on ZPH site, I think those 2 comands are not valued for my idea. :) zph_preserve_miss_tos on zph_preserve_miss_tos_mask 255 With help of TC I tried to configurate flow of SQUID packets, but I failed. I want with TC configurate eth0(lan) SQUID packets exept SQUID CACHE packet. I asking Your help!!! How must look like the TC script, wich could control all clients speed to internet? ZPH shapes I want to use with my IPShapig script. 1IP could get limit KB/S + SQUID CACHE. My IPShaping script controls every IP adress kbit/sec exept traffic to server: #!/bin/bash TC=/sbin/tc HOSTS_LIST=192.168.1.3 192.168.1.4 192.168.1.5 192.168.1.6 192.168.1. 7 192.168.1.8 192.168.1.9 192.168.1.10 192.168.1.11... DEV=eth0 # ethLAN IMQ=imq0 # --todev 0 NM=17 DN_BANDWIDTH=760Kbit # DN=105Kbit DN_RATE=70Kbit UP_BANDWIDTH=600Kbit # UP=70Kbit UP_RATE=50Kbit $TC qdisc add dev $DEV root handle 1: htb #default 50 $TC class add dev $DEV parent 1: classid 1:1 htb rate ${DN_BANDWIDTH} quantum 1500 iptables -t mangle -N DN_SHAPING ip link set $IMQ up $TC qdisc add dev $IMQ root handle 1: htb $TC class add dev $IMQ parent 1: classid 1:1 htb rate ${UP_BANDWIDTH} quantum 1500 iptables -t mangle -N UP_SHAPING for i in $HOSTS_LIST do IP=$(echo $i | awk -F '.' '{print $4}') # Download MARK tc class add dev $DEV parent 1:1 classid 1:$NM$IP htb rate ${DN_RATE} ceil ${DN} prio 0 quantum 1500 tc qdisc add dev $DEV parent 1:$NM$IP handle $NM$IP: sfq perturb 6 tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle $NM$IP fw flowid 1:$NM$IP tc class add dev $IMQ parent 1:1 classid 1:$NM$IP htb rate ${UP_RATE} ceil ${UP} prio 0 quantum 1500 tc qdisc add dev $IMQ parent 1:$NM$IP handle $NM$IP: sfq perturb 6 tc filter add dev $IMQ parent 1:0 prio 0 protocol ip handle $NM$IP fw flowid 1:$NM$IP iptables -t mangle -A DN_SHAPING -s ! 192.168.1.2 -d $i -j MARK --set-mark $NM$IP iptables -t mangle -A UP_SHAPING -s $i -d ! 192.168.1. 2 -j MARK --set-mark $NM$IP done iptables -t mangle -I POSTROUTING -o $DEV -j DN_SHAPING iptables -t mangle -I PREROUTING -i $DEV -j UP_SHAPING iptables -t mangle -A UP_SHAPING -j IMQ --todev 0 === DELFI mail pašto sistema http://www.mail.lt ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
[LARTC] Shaping by IP's
If in one time 3 IP adresses using internet. TC script: DEV=eth0 # LAN SERVER_IP=192.168.1.2 # eth0 ip address tc qdisc add dev $DEV root handle 1: htb default 255 tc class add dev $DEV parent 1: classid 1:1 htb rate 384Kbit quantum 1500 tc class add dev $DEV parent 1:1 classid 1:20 htb rate 128Kbit ceil 384Kbit prio 0 quantum 1500 tc class add dev $DEV parent 1:1 classid 1:21 htb rate 128Kbit ceil 384Kbit prio 0 quantum 1500 tc class add dev $DEV parent 1:1 classid 1:22 htb rate 128Kbit ceil 384Kbit prio 0 quantum 1500 tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 6 tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 6 tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 6 tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 20 fw flowid 1:20 tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 21 fw flowid 1:21 tc filter add dev $DEV parent 1:0 prio 0 protocol ip handle 22 fw flowid 1:22 iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168. 1.20 -j MARK --set-mark 20 iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168. 1.21 -j MARK --set-mark 21 iptables -t mangle -I POSTROUTING -o $DEV -s ! $SERVER_IP -d 192.168. 1.22 -j MARK --set-mark 22 If we swiched on 2 PC's (192.168.1.20 192.168.1.21) many p2p programs, FTP with many conections, and on 3d PC (192.168.1.22) FTP downloading with one conection. then 3d PC getin less than 128kbit. If i want that all 3 PC's get NOT LESS than 128kbit, what should I do with my script? If I could solve this BIG problem, than I could use it with my IPShaping script and user at night, when flow is free, he could get all internet speed. === DELFI mail pašto sistema http://www.mail.lt ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
[LARTC] invert u32 match selector
Is it possible to negate the match to the ip? I want to match all traffic to dport 80 NOT going to dst 1.2.3.4: $TC filter add dev ${DEV_IFB} parent 1:0 prio 2 protocol ip u32 \ match ip protocol 0x6 0xff \ match ip dport 80 0x \ match ip dst 1.2.3.4/32 \ classid 1:14 I can't find it in the docs. I tried ! \! and not in several places, but always resulting in a illegal match. R. -- ___ It is better to remain silent and be thought a fool, than to speak aloud and remove all doubt. +--+ | Richard Lucassen, Utrecht| | Public key and email address:| | http://www.lucassen.org/mail-pubkey.html | +--+ ___ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc