tc-htb question

Taking care of your Linux box.

tc-htb question

Postby osama » Thu Sep 25, 2008 10:48 am

Hi,

I have been using htb for a long time for traffic shaping. I have noticed sometimes that some clients dont get there dedicated lower limit speed and some geting ful dedicated upper limit speed. This only happens in load/peak times situations. There might be a problem in my config.

I use htb in following way.

$TC class add dev $INTERNAL_INTERFACE parent 1:1 classid 1:${Iarray[0]} htb rate ${Iarray[2]} ceil ${Iarray[3]} prio 3 quantum 1514

Due to this problem i cannot utilize my full speed in regular hours as if i would give every client full speed ceil this may create problem in peak hours. and so many clients could complaint about that. Any help?
osama
Havaldaar
 
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am

Postby x2oxen » Mon Sep 29, 2008 2:57 pm

Can you share your script that you using for shaping bandwidth.
Muhammad Usman
+92-321-6640501
Chemonics International
http://usmanpk.com
x2oxen
Major General
 
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Website: http://usmanpk.com
WLM: x2oxen@hotmail.com
Yahoo Messenger: x2oxen
Location: Faisalabad

Postby osama » Tue Sep 30, 2008 9:21 am

copyig relevant part only


TC=/sbin/tc
IPTABLES=/sbin/iptables
EXTERNAL_INTERFACE="eth1"
INTERNAL_INTERFACE="eth0"

############### INTERNAL_INTERFACE ###
$TC qdisc add dev $INTERNAL_INTERFACE root handle 1:0 htb default A001
$TC class add dev $INTERNAL_INTERFACE parent 1:0 classid 1:1 htb rate 100Mbit
#Setting Default1 qdisc
$TC class add dev $INTERNAL_INTERFACE parent 1:1 classid 1:A001 htb rate 100Kbit ceil 200Kbit prio 5
$TC qdisc add dev $INTERNAL_INTERFACE parent 1:A001 handle A001:0 sfq perturb 10

#Setting SSH qdisc

$TC class add dev $INTERNAL_INTERFACE parent 1:1 classid 1:A022 htb rate 300Kbit ceil 500Kbit prio 5
$TC qdisc add dev $INTERNAL_INTERFACE parent 1:A022 handle A022:0 sfq perturb 10
$IPTABLES -t mangle -A POSTROUTING -p tcp --sport 22 -o $INTERNAL_INTERFACE -j CLASSIFY --set-class 1:A022
$IPTABLES -t mangle -A POSTROUTING -p tcp --sport 22 -o $INTERNAL_INTERFACE -j RETURN

#Setting icmp qdisc

$TC class add dev $INTERNAL_INTERFACE parent 1:1 classid 1:A025 htb rate 500Kbit ceil 800Kbit prio 5
$TC qdisc add dev $INTERNAL_INTERFACE parent 1:A025 handle A025:0 sfq perturb 10
$IPTABLES -t mangle -A POSTROUTING -p icmp -o $INTERNAL_INTERFACE -j CLASSIFY --set-class 1:A025
$IPTABLES -t mangle -A POSTROUTING -p icmp -o $INTERNAL_INTERFACE -j RETURN

############### EXTERNAL_INTERFACE ###

$TC qdisc add dev $EXTERNAL_INTERFACE root handle 1:0 htb default A001
$TC class add dev $EXTERNAL_INTERFACE parent 1:0 classid 1:1 htb rate 100Mbit
#Setting Default1 qdisc

$TC class add dev $EXTERNAL_INTERFACE parent 1:1 classid 1:A001 htb rate 10Mbit ceil 100Mbit prio 5
$TC qdisc add dev $EXTERNAL_INTERFACE parent 1:A001 handle A001:0 sfq perturb 10

if [ -f $FILE ]; then
while read ROW; do

Iarray=( $ROW )

###########///////Download
$TC class add dev $INTERNAL_INTERFACE parent 1:1 classid 1:${Iarray[0]} htb rate ${Iarray[2]} ceil ${Iarray[3]} prio 3 quantum 1514
$TC qdisc add dev $INTERNAL_INTERFACE parent 1:${Iarray[0]} handle ${Iarray[0]}: sfq perturb 10

$IPTABLES -t mangle -A POSTROUTING --dest ${Iarray[1]} -o $INTERNAL_INTERFACE -j CLASSIFY --set-class 1:${Iarray[0]}
# $IPTABLES -t mangle -A POSTROUTING --dest ${Iarray[1]} -o $INTERNAL_INTERFACE -j RETURN


###########//////////Upload
$TC class add dev $EXTERNAL_INTERFACE parent 1:1 classid 1:${Iarray[0]} htb rate ${Iarray[4]} ceil ${Iarray[5]} prio 4 quantum 1514
$TC qdisc add dev $EXTERNAL_INTERFACE parent 1:${Iarray[0]} handle ${Iarray[0]}: sfq perturb 10

$IPTABLES -t mangle -A POSTROUTING --src ${Iarray[1]} -o $EXTERNAL_INTERFACE -j CLASSIFY --set-class 1:${Iarray[0]}
# $IPTABLES -t mangle -A POSTROUTING --src ${Iarray[1]} -o $EXTERNAL_INTERFACE -j RETURN

########Firewall section
$IPTABLES -t mangle -A PREROUTING -i $INTERNAL_INTERFACE -s ${Iarray[1]} -m mac --mac-source ${Iarray[6]} -j MARK --set-mark 1

done < $FILE

else
echo " $FILE file not found......"
fi
}
osama
Havaldaar
 
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am

Postby x2oxen » Tue Oct 07, 2008 9:46 am

Is this script complete one??
Muhammad Usman

+92-321-6640501

Chemonics International

http://usmanpk.com
x2oxen
Major General
 
Posts: 1114
Joined: Wed Aug 22, 2007 3:17 pm
Website: http://usmanpk.com
WLM: x2oxen@hotmail.com
Yahoo Messenger: x2oxen
Location: Faisalabad

Postby osama » Tue Oct 07, 2008 3:05 pm

for htb its complete
osama
Havaldaar
 
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am

Postby osama » Thu Oct 23, 2008 4:40 pm

any help here?
osama
Havaldaar
 
Posts: 117
Joined: Fri Aug 22, 2008 9:08 am


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron