From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edgar Merino Date: Tue, 06 Mar 2007 23:03:36 +0000 Subject: [LARTC] Help needed with HTB Message-Id: <45EDF348.4040507@gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------070802040502070702080008" List-Id: To: lartc@vger.kernel.org This is a multi-part message in MIME format. --------------070802040502070702080008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, a few days ago I sent an email asking for help with my tc htb rules I've got (a script), but I'm not sure if that email got to you... anyway, I'm sending it again along with my htb script and I'll tell you the problem once again: I have a computer with ip 192.168.0.100 which is acting as a p2p server, so I want to shape traffic coming out from that ip, I have a linux box acting as a router with two NICs, server ip is 192.168.0.1. So I hope you can take a look at it and tell me why is it that everytime I have mldonkey or any other p2p software running on that computer I experience a lot of latency in my whole network with http traffic, maybe someone can help me out specify the burst and cburst parameters... and maybe even the quantum parameter, and some little explanation on it since I haven't been able to understand what the benefits of this parameters are. Hope you can give me a hand on this, Edgar Merino --------------070802040502070702080008 Content-Type: text/plain; name="layer7ru.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="layer7ru.txt" #!/bin/sh ### Dispositivo de upload (externo) ### DEV=eth0 ### Bajar la cola the $DEV y el MTU### ip link set dev $DEV qlen 30 ip link set dev $DEV mtu 1000 ### BORRADO DE REGLAS Y CADENAS de la tabla mangle ### iptables -t mangle -F iptables -t mangle -X ## BORRADO DE ROOT QDISC EN $DEV tc qdisc del dev $DEV root ### IPTABLES RULES ### P2P_IP=192.168.0.100 SSH_PORT=9000 iptables -t mangle -A FORWARD -s $P2P_IP -o $DEV -j MARK --set-mark 1 iptables -t mangle -A OUTPUT -o $DEV -p tcp --sport $SSH_PORT -j MARK --set-mark 2 iptables -t mangle -A POSTROUTING -o $DEV -s ! $P2P_IP -m length --length :64 -j MARK --set-mark 3 ### CLASES ### SSH=1:10 P2P=1:20 ACK=1:40 DEF=1:30 ## HERE I USE $PARENT_RATE TO LIMIT BORROWING FROM P2P CLASS FROM PARENT, AND I PUT $MAX_RATE FOR LOW PRIO CLASSES SO THEY ALWAYS GET THE RATE THEY NEED (THIS TRICK SEEMS TO HELP) ## MAX_RATE=25kbps PARENT_RATE=10kbps P2P_UP=10kbps tc qdisc add dev $DEV root handle 1: htb default 30 tc class add dev $DEV parent 1: classid 1:1 htb rate $PARENT_RATE burst 6k cburst 3k tc class add dev $DEV parent 1:1 classid $P2P htb rate $P2P_UP ceil $P2P_UP burst 1k cburst 1k prio 2 tc class add dev $DEV parent 1:1 classid $SSH htb rate 5kbps ceil 10kbps burst 6k cburst 3k prio 0 ## Is this really needed? tc class add dev $DEV parent 1:1 classid $ACK htb rate $MAX_RATE ceil $MAX_RATE burst 6k cburst 3k prio 0 ## DEFAULT CLASS tc class add dev $DEV parent 1:1 classid $DEF htb rate $MAX_RATE ceil $MAX_RATE burst 6k cburst 3k prio 1 ### Se agregan qdisc sfq para garantizar un manejo de ancho de banda justo ### tc qdisc add dev $DEV parent $SSH handle 10: sfq perturb 10 tc qdisc add dev $DEV parent $DEF handle 30: sfq perturb 10 tc qdisc add dev $DEV parent $P2P handle 20: sfq perturb 10 ### Filtros para controlar el trafico marcado (especificamente, P2P y SSH) iptables -t mangle -A FORWARD -o $DEV -s $P2P_IP -m mark --mark 1 -j CLASSIFY --set-class $P2P iptables -t mangle -A OUTPUT -o $DEV -s ! $P2P_IP -m mark --mark 2 -j CLASSIFY --set-class $SSH iptables -t mangle -A POSTROUTING -o $DEV -s ! $P2P_IP -m mark --mark 3 -j CLASSIFY --set-class $ACK --------------070802040502070702080008 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --------------070802040502070702080008--