Страница 1 из 1

PF ALTQ + SQUID

Добавлено: 2011-07-05 16:24:09
slonspirit
Всем доброго времени суток!
Собсна заблудился в трёх соснах.
задача - через сквид прозрачно выпускать пользователей на www.
- ограничить общую пропускную способность ВСЕХ пользователей (т.е. сквида)
тестовый конфиг.

Код: Выделить всё

##--macroses
int_if="le0"
ext_if="tun0"
proxy_if="le0"
proxy_port="3128"
allowed_icmp_types="{ echoreq, unreach }"
##--tables
##--options
set skip on lo0
set block-policy return
set timeout { frag 10, tcp.established 3600 }
scrub in all

##--queues
altq on $ext_if cbq bandwidth 970Kb queue { qwww, qtor, qicq, qack, qdns, qBanking }
    queue qwww bandwidth 4% priority 1 cbq ( borrow )
    queue qtor bandwidth 1% priority 1 cbq ( default, borrow )
    queue qicq bandwidth 1% priority 2 cbq ( borrow )
#    queue qiptel bandwidth 8% priority 3 cbq ( borrow, red )
#    queue qApache bandwidth 30% priority 4 cbq ( borrow, red )
#    queue qpost bandwidth 34% priority 5 cbq ( borrow, red )
    queue qdns bandwidth 2% priority 5 cbq ( borrow )
#    queue qssh bandwidth 8% priority 6 cbq ( borrow, red )
    queue qBanking bandwidth 5% priority 6 cbq ( borrow, red )
    queue qack bandwidth 5% priority 6 cbq ( borrow )
#    queue qntp bandwidth 2% priority 7 cbq ( borrow, red )

altq on $int_if cbq bandwidth 4800Kb queue { iwww, itor, iicq, iBanking }
    queue iwww bandwidth 4% priority 1 cbq ( borrow )
    queue itor bandwidth 1% priority 1 cbq ( default, borrow )
    queue iicq bandwidth 1% priority 2 cbq ( borrow )
#    queue iiptel bandwidth 8% priority 3 cbq ( borrow, red )
#    queue iApache bandwidth 30% priority 4 cbq ( borrow, red )
#    queue ipost bandwidth 34% priority 5 cbq ( borrow, red )
#    queue idns bandwidth 2% priority 5 cbq ( borrow, red )
#    queue issh bandwidth 8% priority 6 cbq ( borrow, red )
    queue iBanking bandwidth 5% priority 6 cbq ( borrow, red )
#    queue intp bandwidth 2% priority 7 cbq ( borrow, red )

##--nat & rdr
rdr on $int_if proto tcp from $int_if:network to any port http  -> $proxy_if port $proxy_port
nat on $ext_if from $int_if:network to any -> $ext_if static-port

##--rules
block all
pass out quick on $ext_if proto tcp from ($ext_if) to any port 80 queue (qwww, qack) no state
pass out quick on $ext_if proto udp from ($ext_if) to any port 53 queue (qdns, qack)
pass out on $ext_if tagged EXT_ICQ queue ( qicq, qack )
pass out on $ext_if tagged EXT_SSH queue ( qssh, qack )

pass in quick on $int_if  proto tcp from $int_if:network to $int_if port $proxy_port no state

# ICQ, google talk из мира
pass in quick on $int_if proto tcp from $int_if:network to any port {aol, 5223} no state tag EXT_ICQ
pass out quick on $int_if proto tcp from any port {aol, 5223} to $int_if:network queue iicq no state

# ssh в мир
pass in quick on $int_if proto tcp from $int_if:network to any port ssh no state tag EXT_SSH
pass out quick on $int_if proto tcp from any port ssh to $int_if:network no state queue issh
# icmp
pass log inet proto icmp all icmp-type $allowed_icmp_types
трафик ICQ, SSH нормально разбирается по очередям и QoS'ицца
что не работает:
-входящий трафик www заворачивается на дефолтную кверю itor (нада что бы на iwww)
-мой моск отказывается понимать как могут работать правила с no state в одну сторону.

Re: PF ALTQ + SQUID

Добавлено: 2011-07-05 16:36:39
slonspirit
извиняюсь за глупый вопрос.
йа алень.

Код: Выделить всё

pass in quick on $int_if  proto tcp from $int_if:network to $int_if port $proxy_port no state queue iwww
тут queue iwww не хватало....