jablonka.czprosek.czf

qos

Subversion Repositories:
[/] [trunk/] [qos] - Diff between revs 23 and 25

Show entire file Ignore whitespace

Rev 23 Rev 25
Line 4... Line 4...
# #
# date: 26/07/2007 # date: 09/03/2008
# authors: Rakerihoo, Fyzik, Libor, Dzus, Simandl # authors: Rakerihoo, Fyzik, Libor, Dzus, Simandl
# references: http://www.lartc.org/ # references: http://www.lartc.org/
# http://luxik.cdi.cz/~devik/qos/htb/ # http://luxik.cdi.cz/~devik/qos/htb/
# http://10.24.2.1/forum/showthread.php?s=&threadid=9 # http://10.24.2.1/forum/showthread.php?s=&threadid=9
# http://www.simandl.cz/stranky/linux/qos/soubory/qos_base # http://www.simandl.cz/stranky/linux/qos/soubory/qos_base
# version: 2.1.6 # version: 2.1.6
# ps ver : 0.1.5 # ps ver : 0.1.6
# #
# Changelog # Changelog
# #
  # 09/03/08 [simandl] podpora pro noncontrib
# 01/12/07 [simandl] doplnena podpora pro hru "World Of Warcraft" 8085 3724 # 01/12/07 [simandl] doplnena podpora pro hru "World Of Warcraft" 8085 3724
# 09/08/07 [sinda] doplnena podpora pro hru "Counter-Strike Source" UDP 270xx # 09/08/07 [sinda] doplnena podpora pro hru "Counter-Strike Source" UDP 270xx
# 26/07/07 [sinda] doplnena podpora pro RTP ha-vel.cz a 802.cz dle ip adresy rtp serveru operatora # 26/07/07 [sinda] doplnena podpora pro RTP ha-vel.cz a 802.cz dle ip adresy rtp serveru operatora
# 31/08/06 [simandl] doplnena podpora pro definici rychlosti a delitelu pro kazdy iface zvlast v souboru iface_conf # 31/08/06 [simandl] doplnena podpora pro definici rychlosti a delitelu pro kazdy iface zvlast v souboru iface_conf
# 14/07/06 [sinda] doplneny porty pro hru Quake 3 arena # 14/07/06 [sinda] doplneny porty pro hru Quake 3 arena
Line 53... Line 54...
IFACECONFFILE='/etc/qos/iface_conf' IFACECONFFILE='/etc/qos/iface_conf'
IPADDRFILE="/etc/qos/ip_adresy" IPADDRFILE="/etc/qos/ip_adresy"
   
#default speeds and dividers #default speeds and dividers
DNONCZFSPD='64' DNONCZFSPD='64'
  DNONCONTRIBSPD='64'
DAIRFREESPD='2048' DAIRFREESPD='2048'
DSSHDIV='2' DSSHDIV='2'
DPINGDIV='2' DPINGDIV='2'
DINTERACTDIV='2' DINTERACTDIV='2'
DVOIPDIV='2' DVOIPDIV='2'
Line 99... Line 101...
## qoseni podle IP - priklad ## qoseni podle IP - priklad
if [ -f $IPADDRFILE ] if [ -f $IPADDRFILE ]
then then
NONCZF="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*NONCZF[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" NONCZF="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*NONCZF[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
NONCZF="$NONCZF `sed -e 's/^.*[[:space:]]\+NONCZF[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" NONCZF="$NONCZF `sed -e 's/^.*[[:space:]]\+NONCZF[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
  NONCONTRIB="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*NONCONTRIB[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
  NONCONTRIB="$NONCONTRIB `sed -e 's/^.*[[:space:]]\+NONCONTRIB[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
AIRFREE="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*AIRFREE[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" AIRFREE="`sed -e 's/^[[:space:]]*\([[:digit:].,/]\+\)[[:space:]].*AIRFREE[[:space:]]*\+/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
AIRFREE="$AIRFREE `sed -e 's/^.*[[:space:]]\+AIRFREE[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`" AIRFREE="$AIRFREE `sed -e 's/^.*[[:space:]]\+AIRFREE[[:space:]]\+\([[:digit:].,/]\+\)[[:space:]]*/\1/;t repl;d;: repl;y/,/ /' $IPADDRFILE`"
fi fi
   
set_qos_classes () { set_qos_classes () {
Line 118... Line 122...
$TC class add dev ${FACE} parent 1:1 classid 1:50 htb rate 32kbit ceil $((${SPEED}/${VOIPDIV}))kbit burst 5k prio 1 # voip class $TC class add dev ${FACE} parent 1:1 classid 1:50 htb rate 32kbit ceil $((${SPEED}/${VOIPDIV}))kbit burst 5k prio 1 # voip class
$TC class add dev ${FACE} parent 1:1 classid 1:60 htb rate 32kbit ceil $((${SPEED}/${WWWDIV}))kbit burst 8k prio 3 # web & squid class $TC class add dev ${FACE} parent 1:1 classid 1:60 htb rate 32kbit ceil $((${SPEED}/${WWWDIV}))kbit burst 8k prio 3 # web & squid class
$TC class add dev ${FACE} parent 1:1 classid 1:300 htb rate 32kbit ceil $((${SPEED}/${DFLTDIV}))kbit burst 1k prio 5 # default trafic class $TC class add dev ${FACE} parent 1:1 classid 1:300 htb rate 32kbit ceil $((${SPEED}/${DFLTDIV}))kbit burst 1k prio 5 # default trafic class
$TC class add dev ${FACE} parent 1:1 classid 1:666 htb rate 32kbit ceil ${NONCZFSPD}kbit burst 1k prio 5 # unsupported trafic class $TC class add dev ${FACE} parent 1:1 classid 1:666 htb rate 32kbit ceil ${NONCZFSPD}kbit burst 1k prio 5 # unsupported trafic class
$TC class add dev ${FACE} parent 1:1 classid 1:667 htb rate 32kbit ceil ${AIRFREESPD}kbit burst 1k prio 4 # local wireless free band $TC class add dev ${FACE} parent 1:1 classid 1:667 htb rate 32kbit ceil ${AIRFREESPD}kbit burst 1k prio 4 # local wireless free band
  $TC class add dev ${FACE} parent 1:1 classid 1:668 htb rate 32kbit ceil ${NONCONTRIBSPD}kbit burst 1k prio 5 # non contributors trafic class
# $TC class add dev ${FACE} parent 1:1 classid 1:999 htb rate 32kbit ceil $((${SPEED}/2))kbit burst 8k prio 4 # Inet traffic class # $TC class add dev ${FACE} parent 1:1 classid 1:999 htb rate 32kbit ceil $((${SPEED}/2))kbit burst 8k prio 4 # Inet traffic class
   
$TC qdisc add dev ${FACE} parent 1:5 handle 5: $STOCHASIS # SSH sub-classes $TC qdisc add dev ${FACE} parent 1:5 handle 5: $STOCHASIS # SSH sub-classes
$TC qdisc add dev ${FACE} parent 1:10 handle 10: $STOCHASIS # interactive sub-classes $TC qdisc add dev ${FACE} parent 1:10 handle 10: $STOCHASIS # interactive sub-classes
$TC qdisc add dev ${FACE} parent 1:20 handle 20: $STOCHASIS # ping sub-classes $TC qdisc add dev ${FACE} parent 1:20 handle 20: $STOCHASIS # ping sub-classes
$TC qdisc add dev ${FACE} parent 1:30 handle 30: $STOCHASIS # routing sub-classes $TC qdisc add dev ${FACE} parent 1:30 handle 30: $STOCHASIS # routing sub-classes
$TC qdisc add dev ${FACE} parent 1:40 handle 40: $STOCHASIS # email & data transfer sub-classes $TC qdisc add dev ${FACE} parent 1:40 handle 40: $STOCHASIS # email & data transfer sub-classes
$TC qdisc add dev ${FACE} parent 1:50 handle 50: $STOCHASIS # voip sub-classes $TC qdisc add dev ${FACE} parent 1:50 handle 50: $STOCHASIS # voip sub-classes
$TC qdisc add dev ${FACE} parent 1:60 handle 60: $STOCHASIS # web & squid sub-classes $TC qdisc add dev ${FACE} parent 1:60 handle 60: $STOCHASIS # web & squid sub-classes
$TC qdisc add dev ${FACE} parent 1:300 handle 300: $STOCHASIS # default class $TC qdisc add dev ${FACE} parent 1:300 handle 300: $STOCHASIS # default class
$TC qdisc add dev ${FACE} parent 1:666 handle 666: $STOCHASIS # unsupported 32kbit $TC qdisc add dev ${FACE} parent 1:666 handle 666: $STOCHASIS # unsupported
$TC qdisc add dev ${FACE} parent 1:667 handle 667: $STOCHASIS # local wireless 32kbit $TC qdisc add dev ${FACE} parent 1:667 handle 667: $STOCHASIS # local wireless
  $TC qdisc add dev ${FACE} parent 1:668 handle 668: $STOCHASIS # non contributor class
# $TC qdisc add dev ${FACE} parent 1:999 handle 999: $STOCHASIS # Inet traffic # $TC qdisc add dev ${FACE} parent 1:999 handle 999: $STOCHASIS # Inet traffic
   
   
## SSH class ## SSH class
# SSH # SSH
Line 370... Line 376...
# non-CZF-RFC - violators of RFCs # non-CZF-RFC - violators of RFCs
for ipaddr in $NONCZF for ipaddr in $NONCZF
do do
$TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:666 $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:666
$TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:666 $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:666
  done
  # non-contributors
  for ipaddr in $NONCONTRIB
  do
  $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip src $ipaddr flowid 1:668
  $TC filter add dev ${FACE} parent 1:0 protocol ip prio 1 u32 match ip dst $ipaddr flowid 1:668
done done
   
## Internet class ## Internet class
# IPtables rule # IPtables rule
# $IPTABLES -t mangle -A FORWARD -s ! 10.0.0.0/8 -o ${FACE} -j MARK --set-mark 999 # $IPTABLES -t mangle -A FORWARD -s ! 10.0.0.0/8 -o ${FACE} -j MARK --set-mark 999
Line 406... Line 418...
NONCZFSPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*NONCZFSPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` NONCZFSPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*NONCZFSPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"`
if [ -z $NONCZFSPD ] ; then NONCZFSPD=$DNONCZFSPD ; fi if [ -z $NONCZFSPD ] ; then NONCZFSPD=$DNONCZFSPD ; fi
   
AIRFREESPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*AIRFREESPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` AIRFREESPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*AIRFREESPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"`
if [ -z $AIRFREESPD ] ; then AIRFREESPD=$DAIRFREESPD ; fi if [ -z $AIRFREESPD ] ; then AIRFREESPD=$DAIRFREESPD ; fi
   
  NONCONTRIBSPD=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*NONCONTRIBSPD[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"`
  if [ -z $NONCONTRIBSPD ] ; then NONCONTRIBSPD=$DNONCONTRIBSPD ; fi
   
SSHDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*SSHDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` SSHDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*SSHDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"`
if [ -z $SSHDIV ] ; then SSHDIV=$DSSHDIV ; fi if [ -z $SSHDIV ] ; then SSHDIV=$DSSHDIV ; fi
   
PINGDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*PINGDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"` PINGDIV=`echo -e $IFACECONF | grep $FACE | sed -e "s/^.*{.*PINGDIV[[:space:]]\+\([[:digit:]]\+\).*}.*/\1/;t;d"`

Powered by WebSVN 2.2.1