raab
March 30th, 2005, 06:59
I was wondering if someone had a clear cut, working, altq example.. I've looked at all the howtos I can find and most are confusing and/or aren't much use as to what I actually want to achieve with traffic shaping.

Basically what I want to do is be able to, when I feel like it, uncomment the altq code reload the pf.conf file and have the shaping take effect once i kill their connection..

I want to be able to limit a certain ip and/or port to a specific speed like 50Kbits/s or there abouts..

I tried:
altq on $ext_if cbq bandwidth 2Mb queue { std, bt }
queue std bandwidth 2Mb cbq(default)
queue bt bandwidth 6Kb


and

pass in on $ext_if proto tcp from any to any port 21 queue bt

But that didn't appear to work at all, I tried without the port 21 there and nothing either..

Can anyone help? I have a flatmate that constantly leeches things from bittorrent and I would like some bandwidth left over without placing a block rule on him..

Strog
March 30th, 2005, 11:49
The bandwidth is already used to get to the inbound side of the interface so queueing on inbound is useless. You need to be passing on the external side of the interface. To acomplish the same thing as your example you will need to pass out on $int_if. Later you can add pass out on $ext_if when you want to add outbound queueing. Also make sure that you have setup initial blocks to make sure that it's going out in the queue that you want.

raab
March 31st, 2005, 02:06
You'll have to show me, I've only been using pf/altq for a couple of days so this is all over my head at the mo

Strog
March 31st, 2005, 18:47
Something along this line from traffic from external sources into your network.


altq on $int_if cbq bandwidth 2Mb queue { std, bt }
queue std bandwidth 2Mb cbq(default)
queue bt bandwidth 6Kb

block all

other pass/blocks

# Queuing inbound traffic to port 21
pass out on $int_if inet proto tcp from any to any port 21 flags S/SA keep state queue bt



I would think you would want to do outbound bt traffic as much or more since it seems like bt sends out as much or more traffic out as it takes in. If that's the case then you need to set a queue to prioritize traffic as it leaves your network through the external interface.


altq on $ext_if cbq bandwidth (Insert upload speed here) queue { std_out, bt_out }
queue std_out bandwidth (Insert upload speed here) cbq(default)
queue bt_out bandwidth 6Kb

pass out on $ext_if inet proto tcp from any to any port 21 flags S/SA keep state queue bt_out


I'm guessing that you are using port 21 for testing since bittorrent uses tcp port 6881-6889 inbound and tcp port 6969 outbound (http://btfaq.com/serve/cache/25.html) by default.

raab
April 2nd, 2005, 03:33
I was testing it on ftp, but then I realised that it doesn't use port 21 to transfer files >_<

My flatmate uses azureus which uses a single port which is 65530 so i'll test it tonight, thanks for that

Hmm, i tried the bt port that i have specified in azureus aswell as various other ports like 80 but i still was getting full speed