Restricting The Uploads

Protecting your Linux box

Restricting The Uploads

Postby server » Sun Dec 24, 2006 10:01 pm

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
server
Naik
 
Posts: 83
Joined: Tue Jan 03, 2006 7:41 pm
Website: http://www.DecentNetwork.com
WLM: zeeshan@decentnetwork.com
Yahoo Messenger: shani_rago@yahoo.com
Location: Lahore

Re:

Postby LinuxFreaK » Tue Dec 26, 2006 9:24 am

Dear server,
Salam,

Take a look into below link.

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

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi


Return to “%s” Security

Who is online

Users browsing this forum: No registered users and 1 guest

cron