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

ALTQ Bittorrent Woes

I am having trouble getting Bittorrent to stay within its assigned
queue. I have successfully created a ruleset using ALTQ that places
ack packets, dns traffic, ssh traffic, and www traffic in its proper
queue, to help smooth out my internet connection. What I want most of
all is to be able to let Bittorrent eat all my bandwith but keep my
connection responsive. I have tried many combinations of the following
ruleset based upon readings in the pfctl manpage, the pf faq, and this
mailing list. I have been unable to find a combination that gets the
Bittorrent  traffic to stay in its queue. When monitored with pfctl -s
queue -vv, it seems that at first Bittorrent traffic is being assigned
to the blk queue as I desire, but then after a few mins, the queue
empties entirely, and the std queue starts to fill; it stays that way
forever. Can anyone help me understand either the way that Bittorrent
works (I have used ethereal on the client box, and it does indeed
appear that all traffic is using ports 6881:6889 as my ruleset
assumes) or a way to make this ruleset works? I love pf and only wish
I could make it do as I wanted all the time; it kicks ass.

Thanks in advance, attached is a shortened version of my ruleset.

#My Ruleset

# macros
$ext_if = "fxp0"
$bt_ports = 6881:6889
$bt_host =

# scrub
scrub on $ext_if all reassemble tcp random-id

# queueing
altq on $ext_if priq bandwidth 250Kb queue { blk, std, www, gme, ssh, dns, ack }
queue blk priority 0
queue std priq(default)
queue gme priority 1
queue www priority 2
queue ssh priority 3 priq(red)
queue dns priority 4
queue ack priority 5

# nat/rdr
nat on $ext_if from <lan> to any -> ($ext_if)
rdr on $ext_if proto tcp from any to ($ext_if) port $bt_ports -> \

# filter rules
block in all

pass quick on lo0 all

pass in on $ext_if proto tcp from any to ($ext_if) port { ssh, http, https } \
    modulate state
pass in on $ext_if proto tcp from any to any port $bt_ports keep state

pass in  on $int_if from <lan> to any
pass out on $int_if from any to <lan>

pass out on $ext_if proto { udp icmp } all keep state
pass out on $ext_if proto tcp all modulate state flags S/SA \
pass out on $ext_if proto { tcp udp } from any to any port domain \
    keep state queue dns
pass out on $ext_if proto tcp from any to any port ssh \
    flags S/SA modulate state queue(std,ssh)

pass out on $ext_if proto tcp from any to any port $bt_ports queue(blk)

pass out on $ext_if proto tcp from any to any port www \
    flags S/SA modulate state queue www

Visit your host, monkey.org