fairnat with squid + Squid with ZPH

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm trying to share internet on a LAN
I've a linux router with SQUID (with ZPH support) + FAIRNAT

The idea is:

- fairness sharing internet
- priorize interactive traffic
- if a web object is on squid-cache (HIT), user
  can download it, with a rate = LAN rate

I've:

- Last Fairnat Script: www.metamorpher.de/fairnat/
- SQUID 2.5STABLE5 with ZPH patch http://www.it-academy.bg/zph/
- pached kernel with:
	- netfilter connmark patch
	- netfilter ttl patch
	- htb "HYSTERISYS =0"
	- "sfq DEPTH = 16"
	- "PSCHED CPU"
	- and last HTB patch.


and...

modified fairnat script with:

--------------------------------------

[...snip...]

function iptables
{


    $BIN_IPT -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port
3128

    $BIN_IPT -t mangle -A PREROUTING -p tcp -d 192.69.221.130 -j
TOS --set-tos Minimize-Delay
    $BIN_IPT -t mangle -A PREROUTING -p tcp -s 192.69.221.130 -j
TOS --set-tos Minimize-Delay

[...snip...]

}


[...snip...]


function parent_class_default
{
    PC_DEV=$1
    PC_RATE=$2
    PC_USER_RATE=$3
    PC_USER_CEIL=$4
    PC_LOCAL_RATE=$5
    PC_LOCAL_CEIL=$6

    # Root QDisc:
    $BIN_TC qdisc add dev $PC_DEV root handle 1: htb default 3

    # Main (fat) device class:
    $BIN_TC class add dev $PC_DEV parent 1: classid 1:2 \
                  htb rate $(($PC_RATE))bps ceil $(($PC_RATE))bps \
                  quantum $DEV_NET_MTU $HTB_OPT

    # Local traffic class with lower prio:
    $BIN_TC class add dev $PC_DEV parent 1:2 classid 1:3 \
                  htb rate $(($PC_LOCAL_RATE))bps ceil
$(($PC_LOCAL_CEIL))bps \
                  quantum $DEV_NET_MTU $HTB_OPT prio 5

    # Put PRIO and SFQ on top of local traffic class:
    $BIN_TC qdisc add dev $PC_DEV parent 1:3 handle 2: prio
    $BIN_TC qdisc add dev $PC_DEV parent 2:1 handle 3: sfq perturb 9
    $BIN_TC qdisc add dev $PC_DEV parent 2:2 handle 4: sfq perturb 10
    $BIN_TC qdisc add dev $PC_DEV parent 2:3 handle 5: sfq perturb 11

    # Parent class for user classes:
    $BIN_TC class add dev $PC_DEV parent 1:2 classid 1:1 \
                  htb rate $(($PC_USER_RATE))bps ceil $(($PC_USER_CEIL))bps
\
                  quantum $DEV_NET_MTU $HTB_OPT

#### ZPH

    # Main (fat) device class:
    $BIN_TC class add dev $PC_DEV parent 1: classid 1:4 \
                  htb rate $(($PC_RATE))bps ceil $(($PC_RATE))bps \
                  quantum $DEV_NET_MTU $HTB_OPT

    # Local traffic class with lower prio:

    $BIN_TC filter add dev $PC_DEV parent 1:0 protocol ip prio 10 u32 \
     match ip protocol 0x6 0xff \
     match ip tos 0x10 0xff \
     flowid 1:4

}

[...snip...]

_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux