Hi I am looking for a script which works like that:
ip upload_limi down_limit
eg. 192.168.1.5 64kb download limit 32kb upload limit
The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.
Hi I am looking for a script which works like that:
ip upload_limi down_limit
eg. 192.168.1.5 64kb download limit 32kb upload limit
Hi I am looking for a script which works like that:
ip upload_limi down_limit
eg. 192.168.1.5 64kb download limit 32kb upload limit
it's good idea, but come on and make it
I'm limiting the upload at each of the client radios, but the downloads I limit in the router with this script:
#!/bin/sh
#
# Custom Bandwidth Management
#
#
#
#
IPFILE=/etc/anr/ipaddresses
WIFI=eth1
RATE=1mbit
BURST=15k
COUNT=2
while getopts ":sxv" opt; do
case $opt in
s )
START=1 ;;
x )
START=0 ;;
v )
DEBUG=echo ;;
\? )
echo 'usage: cbm [-s|x] [-v]'
exit 1
esac
done
start_filters()
{
$DEBUG tc qdisc del dev $WIFI root >&- 2>&-
$DEBUG tc qdisc add dev $WIFI root handle 1: htb default 2
$DEBUG tc class add dev $WIFI parent 1: classid 1:1 htb rate 36mbit burst 15k
$DEBUG tc class add dev $WIFI parent 1:1 classid 1:2 htb rate 8mbit burst 15k
for i in $( cat $IPFILE ); do
IPADDR=$( echo $i | awk -F"|" '{ print $2 }')
RATE=$( echo $i | awk -F"|" '{ print $3 }')
BURST=$( echo $i | awk -F"|" '{ print $4 }')
COUNT=$(($COUNT + 1))
$DEBUG tc class add dev $WIFI parent 1:1 classid 1:$COUNT htb rate $RATE burst $BURST
$DEBUG tc filter add dev $WIFI parent 1:0 protocol ip prio 1 u32 match ip dst $IPADDR/32 flowid 1:$COUNT
done
}
stop_filters()
{
$DEBUG tc qdisc del dev $WIFI root >&- 2>&-
}
if [ $START = "" ]; then
echo "You must specify -s to start or -x to stop"
exit 1
elif [ $START = 1 ]; then
start_filters
exit 0
else
stop_filters
exit 0
fi
The format of the ipaddresses file is:
linkname|ipaddress|rate|burst
I have the debug statements in there because I'm not finished and I keep tinkering with it. Right now, I'm letting the clients borrow bandwidth from each other in excess of what I gurantee on the link, but I'm probably going to shut that down and make it a hard limit. I'm not using iptables for the filtering because I don't want to mess with the marks in place for established links that I'm using for qos on the wan side. This script allows me to set different limits for each customer.
The discussion might have continued from here.