View Single Post
  #1   (View Single Post)  
Old 3rd March 2017
leos leos is offline
Port Guard
 
Join Date: Mar 2017
Posts: 11
Default How to shape traffic using PF?

hello guys
I have a very strange problem trying to set up a traffic shape
I followed all the documentation and I built this PF file:

ext_if="sis0"
int_if="sis1"

table <usr1_direct> { 192.168.1.210, 192.168.1.211 }

int_ip="192.168.1.228"
int_lan="192.168.1.0/24"
ext_ip="X.Y.Z.A"

up_max="1Mb"
up_slow="100Kb"
up_fast="500Kb"

dn_max="1Mb"
dn_slow="100Kb"
dn_fast="500Kb"

set block-policy drop
set state-policy if-bound
set loginterface $ext_if
set skip on lo

queue up_parent on $ext_if bandwidth $up_max
queue up_default parent up_parent bandwidth $up_slow default
queue up_usr_fast parent up_parent bandwidth $up_fast


queue dn_parent on $int_if bandwidth $dn_max
queue dn_default parent dn_parent bandwidth $dn_slow default
queue dn_usr_fast parent dn_parent bandwidth $dn_fast


match out on $ext_if from $int_if:network to any nat-to ($ext_if)
match on $ext_if scrub (no-df random-id max-mss 1440)

block log all

pass in quick on $ext_if inet proto icmp to ($ext_if) icmp-type echoreq


pass out on $ext_if inet queue up_default
pass out on $ext_if inet from <usr1_direct> queue up_usr_fast

pass in on $int_if proto udp from $int_lan to any port 53

pass in on $int_if proto icmp from $int_lan to any
pass in on $int_if proto { tcp, udp } from $int_lan to any queue up_usr_fast

pass out on $int_if inet queue dn_default no state
pass out on $int_if inet to <usr1_direct> queue dn_usr_fast no state



querying the systat queue I can see:

QUEUE BW SCH PRIO PKTS BYTES DROP_P DROP_B QLEN BORROW SUSPEN P/S B/S
up_parent on sis0 1M 0 0 0 0 0
up_default 100K 19506 18184098 0 0 0
up_usr_fast 500K 0 0 0 0 0
dn_parent on sis1 1M 0 0 0 0 0
dn_default 100K 20093 18309620 0 0 0
dn_usr_fast 500K 166 26306 0 0 0


and I assume it's OK but... trying with a speedtest I can see I'm using the full bandwidth (8Mbit) and not the assigned.. I'm sure I'm wrong somewhere but it's days I going mad... anyone can help me please?
Thanks a lot, Leo
Reply With Quote