Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

lug-bg: Problem s SQUID & SHAPE (bg/international)


  • Subject: lug-bg: Problem s SQUID & SHAPE (bg/international)
  • From: svetla@email.domain.hidden (svetla)
  • Date: Wed, 02 Apr 2003 15:03:20 +0300


Zdraveyte, 

imam sledniat problem ->, 

neznam kak da si configna proxy-to taka che s nego da moga da razdeliam 
shape-inga na bg/international. Za sega si vurvi razdelenieto no to e samo 
za ip-tata koito ne izpolzvat proxy. Znam che ima niakakuv nachin, prochetoh 
nasam natam, no ne mi stana suvsem jasno:
Samiat mi shape-e taka razdelen, no bez proxyto:
#!/bin/sh 

TC="/sbin/tc" 

#This function takes three params: ip, peering trafic, internat. traffic
limit_user() {
   #trafic we send to the users
   /usr/local/bin/usleep 100000
   ${TC} class add dev eth0 parent 1: classid 1:$1 htb \
               rate ${2}kbps ceil ${2}kbps
   /usr/local/bin/usleep 100000
   ${TC} class add dev eth0 parent 1: classid 1:$((256 + $1)) htb \
       rate ${3}kbps ceil ${3}kbps 

<p>   ${TC} filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match \
       ip dst 212.36.16.$1 match ip tos 0x40 0xff flowid 1:$((256 + $1))
   ${TC} filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match \
       ip dst 212.36.16.$1 match ip tos 0x80 0xff flowid 1:$((256 + $1))
   ${TC} filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match \
       ip dst 212.36.16.$1 flowid 1:$1 

   #traffic we send to internet
#    /usr/local/bin/usleep 100000
#    ${TC} class add dev eth1 parent 1: classid 1:$1 htb \
#        rate ${4}kbps ceil ${4}kbps
#    ${TC} filter add dev eth1 protocol ip parent 1:0 prio 1 u32 \
#        match ip src 212.36.16.$1 flowid 1:$1
} 

tart() {
   echo "Starting shaper"
   /usr/local/bin/usleep 100000
   ${TC} qdisc add dev eth0 root handle 1: htb r2q 1 default 255
   ${TC} class add dev eth0 parent 1: classid 1:255 htb rate 100Mbit ceil 
100Mbit 

   /usr/local/bin/usleep 100000
   ${TC} qdisc add dev eth1 root handle 1: htb default 255
   ${TC} class add dev eth1 parent 1: classid 1:255 htb rate 4Mbit ceil 
4Mbit 

   for ((i=2; i<64; i++))
   do
       case $i in
           27)
               limit_user $i 32 32
               ;;
           3)
               limit_user $i 4 4
               ;;
           5)
               limit_user $i 64 64
               ;;
           4|6)
               limit_user $i 4 4
               ;;
           2|7)
               limit_user $i 256 256
               ;;
           8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|28|29|30)
               limit_user $i 50 50
               ;;
           
31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|55|56|57|58|59|6 
0|61|62|63)
               limit_user $i 3 3
               ;;
           51|52)
               limit_user $i 16 24
               ;;
           53)
               limit_user $i 3 16
               ;;
          54)
               limit_user $i 32 16
               ;;
           *)
              echo "Warning no limit set for .$i !!!"
#                limit_user $i 10 10
               ;;
       esac
   done
   /usr/local/bin/usleep 100000
   ${TC} class add dev eth1 parent 1: classid 1:5 htb \
       rate 64kbps ceil 64kbps
   ${TC} filter add dev eth1 protocol ip parent 1:0 prio 1 u32 \
       match ip src 212.36.16.5 match ip dst 212.36.6.55 flowid 1:5 

} 

top () {
   echo "Stoping shaper ..."
   ${TC} qdisc del dev eth0 root handle 1: htb default 255
   ${TC} qdisc del dev eth1 root handle 1: htb default 255
} 

case "$1" in
 start)
       start
       ;;
 stop)
       stop
       ;;
 restart)
       stop
       sleep 1
       start
       ;;
 *)
       echo $"Usage: $0 {start|stop|restart}"
esac 

<p>Ako niakoi se e sbluskval s podoben na moia problem, neka spodeli reshenie.
Ako trqbva da vi dam poveche info kajete ..
Shte sum mnogo blagodarna! 

<p>POzdravi :
Svetlana Pesheva
System Administrator
"VMT Design"
contact: 098/254246
#48332919
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.