Restricting The Uploads

Protecting your Linux box
Post Reply
server
Naik
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Location: Lahore
Contact:

Restricting The Uploads

Post by server »

Assalam-o-Alykum All...!!!

currently im using this script to restrict limits
#!/bin/bash


IFACE="eth1"
CRATE="40Kbit"
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $IFACE
tc -s class ls dev $IFACE
exit
fi


echo "Cleaning qdiscs if exists any"

# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $IFACE root 2> /dev/null > /dev/null

if [ "$1" = "stop" ]
then
exit
fi

echo "Now Setting $CRATE per user at Interface $IFACE"

ipdstprefix="192.168.0."


classid="2"
classidnos="254"
classidnos2=$classidnos
ipdst="2"

tc qdisc add dev $IFACE root handle 10: cbq bandwidth 10Mbit avpkt 1000
tc class add dev $IFACE parent 10:0 classid 10:1 cbq bandwidth 10Mbit rate 10Mbit allot 1514 weight 1Mbit prio 8 maxburst 20 avpkt 1000

while [ $classid -lt $classidnos ]
do
tc class add dev $IFACE parent 10:1 classid 10:$classid cbq bandwidth 10Mbit rate $CRATE allot 1514 weight 1Kbit prio 5 maxburst 20 avpkt 1000 bounded
classid=$[$classid+1]
done


while [ $ipdst -lt $classidnos2 ]
do
tc filter add dev $IFACE parent 10:0 protocol ip prio 100 u32 match ip dst $ipdstprefix$ipdst flowid 10:$ipdst
ipdst=$[$ipdst+1]
done
its working fine on downloading speed, but i cant work on uploading speed, plz can any one tell how can i limit uploads to?
Image
  • Welcome In Red Hat Enterprise 4
Image
LinuxFreaK
Site Admin
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
Location: Karachi
Contact:

Re:

Post by LinuxFreaK »

Dear server,
Salam,

Take a look into below link.

FYI, http://lartc.org/wondershaper/

Best Regards.
Farrukh Ahmed
Post Reply