From mboxrd@z Thu Jan 1 00:00:00 1970 From: choros Date: Sat, 01 Oct 2005 00:58:53 +0000 Subject: [LARTC] imq + htb Message-Id: <433DDF4D.4050306@inway.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org Hi, i am running imq + htb on my router , the situation is like this eth0 = uplink to my provider eth1 = 1st customer eth2 = 2nd customer eth3 = 3th customer eth0 has limit 512 and i want to share this between eth1 eth2 and eth3 , but not working , this is the script i used, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin iptables -t mangle -F 2>/dev/null iptables -t mangle -X 2>/dev/null iptables -t mangle -N markov iptables -t mangle -I PREROUTING -j markov iptables -t mangle -N markov2 iptables -t mangle -I POSTROUTING -j markov2 tc qdisc del dev imq0 root >/dev/null 2>&1 tc qdisc del dev imq1 root >/dev/null 2>&1 #bring up the imq0 ip link set dev imq0 up #marking of incoming from eth1,eth2,eth3 iptables -t mangle -A markov -i eth1 -j MARK --set-mark 1 iptables -t mangle -A markov -i eth2 -j MARK --set-mark 2 iptables -t mangle -A markov -i eth3 -j MARK --set-mark 3 #forward it to imq0 iptables -t mangle -A PREROUTING -i eth1 -j IMQ --todev 0 iptables -t mangle -A PREROUTING -i eth2 -j IMQ --todev 0 iptables -t mangle -A PREROUTING -i eth3 -j IMQ --todev 0 tc qdisc add dev imq0 root handle 10: htb default 20 tc class add dev imq0 parent 10: classid 10:2 \ htb rate 512Kbit ceil 512Kbit ##################################################### #class for eth1 tc class add dev imq0 parent 10:2 classid 10:21 htb rate 128Kbit ceil 512Kbit # mark tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 1 fw classid 10:21 tc qdisc add dev imq0 parent 10:21 sfq perturb 15 ####################################################### # class for eth2 tc class add dev imq0 parent 10:2 classid 10:22 htb rate 128Kbit ceil 512Kbit #mark tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 2 fw classid 10:22 tc qdisc add dev imq0 parent 10:22 sfq perturb 15 ######################################### # class for eth3 tc class add dev imq0 parent 10:2 classid 10:23 htb rate 128Kbit ceil 512Kbit #mark tc filter add dev imq0 parent 10:2 protocol ip prio 1 handle 3 fw classid 10:23 tc qdisc add dev imq0 parent 10:23 sfq perturb 15 ############################################## ############################################## # outgoing traffic to eth1,eth2,eth3 #bring up imq1 ip link set dev imq1 up #make marks iptables -t mangle -A markov2 -o eth1 -j MARK --set-mark 21 iptables -t mangle -A markov2 -o eth2 -j MARK --set-mark 22 iptables -t mangle -A markov2 -o eth3 -j MARK --set-mark 23 #forward it to imq1 iptables -t mangle -A POSTROUTING -o eth1 -j IMQ --todev 1 iptables -t mangle -A POSTROUTING -o eth2 -j IMQ --todev 1 iptables -t mangle -A POSTROUTING -o eth3 -j IMQ --todev 1 tc qdisc add dev imq1 root handle 10: htb default 20 tc class add dev imq1 parent 10: classid 10:2 htb rate 512Kbit ceil 512Kbit ################################## # class for eth1 tc class add dev imq1 parent 10:2 classid 10:21 htb rate 128Kbit ceil 512Kbit # mark tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 21 fw classid 10:21 tc qdisc add dev imq1 parent 10:21 sfq perturb 15 #################################### # class for eth2 tc class add dev imq1 parent 10:2 classid 10:22 htb rate 128Kbit ceil 512Kbit #mark tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 22 fw classid 10:22 tc qdisc add dev imq1 parent 10:22 sfq perturb 15 ##################################### #class for eth3 tc class add dev imq1 parent 10:2 classid 10:23 htb rate 128Kbit ceil 512Kbit #mark tc filter add dev imq1 parent 10:2 protocol ip prio 1 handle 23 fw classid 10:23 tc qdisc add dev imq1 parent 10:23 sfq perturb 15 ###################################### ###################################### But the traffic is unshaped, i think maybe somethink wrong with the filters becouse if i do tc -s class show dev imq0 or imq1 while uploading or downloading traffic doesnt get to right class. If i take look in iptables -t mangle -L -n -v the packets are marked well OUTPUT OF tc -s class show dev imq0 class htb 10:22 parent 10:2 leaf 8026: prio 0 rate 128000bit ceil 512000bit burst 1615b cburst 1.625Kb Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 103424 ctokens: 26624 class htb 10:23 parent 10:2 leaf 8027: prio 0 rate 128000bit ceil 512000bit burst 1615b cburst 1.625Kb Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 103424 ctokens: 26624 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ PARTIAL OUTPUT of iptables -t mangle -L -n -v Chain markov (1 references) pkts bytes target prot opt in out source destination 96 8578 MARK all -- eth1 * 0.0.0.0/0 0.0.0.0/0 MARK set 0x1 25004 36M MARK all -- eth2 * 0.0.0.0/0 0.0.0.0/0 MARK set 0x2 0 0 MARK all -- eth3 * 0.0.0.0/0 0.0.0.0/0 MARK set 0x3 Chain markov2 (1 references) pkts bytes target prot opt in out source destination 7 1750 MARK all -- * eth1 0.0.0.0/0 0.0.0.0/0 MARK set 0x15 24874 36M MARK all -- * eth2 0.0.0.0/0 0.0.0.0/0 MARK set 0x16 6 2222 MARK all -- * eth3 0.0.0.0/0 0.0.0.0/0 MARK set 0x17 class htb 10:2 root rate 512000bit ceil 512000bit burst 1.625Kb cburst 1.625Kb Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 26624 ctokens: 26624 class htb 10:21 parent 10:2 leaf 8025: prio 0 rate 128000bit ceil 512000bit burst 1615b cburst 1.625Kb Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 lended: 0 borrowed: 0 giants: 0 tokens: 103424 ctokens: 26624 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ THANKS A LOT FOR HELP Jorge Sanchez _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc