Skip to contentSkip to conversation

Best internet traffic shaping for small lan

LARTC Laimis 1 participant 1 message Feb 21, 2006

lore
Share & tools
lore

Laimis

author
#0 lore raw

I'm admin of 50 clients. Sometimes I upgrading my internet traffic shaping script. I think rules of inetrnet traffic shaping is very important thing! I would like to ask some help from people, who understand something about
SQUID ZPH and TC, to aim beter internet traffic shaping scripts.

Squid has ZPH suport, becouse its responds to such commands as:
zph_tos_local 8
zph_tos_peer 0
zph_tos_parent off

Next 2 comands SQUID is not responding ( I think it's becouse of KERNEL..). As I readed about it on ZPH site, I think those 2 comands are not valued for my idea. :) zph_preserve_miss_tos on
zph_preserve_miss_tos_mask 255

With help of TC I tried to configurate flow of SQUID packets, but I failed. I want with TC configurate eth0(lan) SQUID
packets exept SQUID CACHE packet. I asking Your help!!! How must look like the TC script, wich could control all clients
speed to internet?

ZPH shapes I want to use with my IPShapig script. 1IP could get limit KB/S + SQUID CACHE. My IPShaping script controls
every IP adress kbit/sec exept traffic to server:

#!/bin/bash
TC=/sbin/tc
HOSTS_LIST="192.168.1.3 192.168.1.4 192.168.1.5 192.168.1.6 192.168.1. 7 192.168.1.8 192.168.1.9 192.168.1.10 192.168.1.11... DEV=eth0 # ethLAN
IMQ=imq0 # --todev 0
NM
DN_BANDWIDTHv0Kbit #
DN5Kbit
DN_RATEpKbit

UP_BANDWIDTH`0Kbit #
UPpKbit
UP_RATEPKbit

$TC qdisc add dev $DEV root handle 1: htb #default 50 $TC class add dev $DEV parent 1: classid 1:1 htb rate
${DN_BANDWIDTH} quantum 1500
iptables -t mangle -N DN_SHAPING

ip link set $IMQ up
$TC qdisc add dev $IMQ root handle 1: htb $TC class add dev $IMQ parent 1: classid 1:1 htb rate
${UP_BANDWIDTH} quantum 1500
iptables -t mangle -N UP_SHAPING

for i in $HOSTS_LIST
do
IP=$(echo $i | awk -F '.' '{print $4}')

# Download MARK
tc class add dev $DEV parent 1:1 classid 1:$NM$IP htb
rate ${DN_RATE} ceil ${DN} prio 0 quantum 1500
tc qdisc add dev $DEV parent 1:$NM$IP handle $NM$IP:
sfq perturb 6
tc filter add dev $DEV parent 1:0 prio 0 protocol ip
handle $NM$IP fw flowid 1:$NM$IP

tc class add dev $IMQ parent 1:1 classid 1:$NM$IP htb
rate ${UP_RATE} ceil ${UP} prio 0 quantum 1500
tc qdisc add dev $IMQ parent 1:$NM$IP handle $NM$IP:
sfq perturb 6
tc filter add dev $IMQ parent 1:0 prio 0 protocol ip
handle $NM$IP fw flowid 1:$NM$IP

                iptables -t mangle -A DN_SHAPING -s ! 192.168.1.2 -d 
$i -j MARK --set-mark $NM$IP
                iptables -t mangle -A UP_SHAPING -s $i -d ! 192.168.1.

2 -j MARK --set-mark $NM$IP
done

iptables -t mangle -I POSTROUTING -o $DEV -j DN_SHAPING iptables -t mangle -I PREROUTING -i $DEV -j UP_SHAPING iptables -t mangle -A UP_SHAPING -j IMQ --todev 0
<--------------------==================-------------------->
DELFI mail paðto sistema http://www.mail.lt
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc