Heres my pf.conf, it works for doing QoS to the asterisk box ################################################################# # macro definitions ################################################################# # ifs ext_if="fxp0" our_if="dc0" voisin_if="dc1" int_if="{ dc0, dc1 }" ## networks our_lan="192.168.10.0/24" voisin_lan="192.168.20.0/24" int_lans= "{192.168.10.0/24 192.168.20.0/24}" ## hosts #trixboxen="{192.168.10.177 192.168.10.178}" trixboxen="{192.168.10.178}" ######### Ports firewall_tcp_services="{ 113 }" icmp_types="echoreq" ### VOIP # tcp #tcp_port_range="30000:30010" #GM tcp_listening_port="1720" tcp_sip="5060:5070" # udp # GM rtp_port_range="5000:5016" rtp_port_range="8766:35000" stun="3478" udp_sip="5060:5070" #GM rtp_rtcp="8000:8006" asterisk_rtp="10000:20000" iax2="4569" iax="5036" mgcp="2727" ##### summarized voip_tcp=$tcp_sip # $tcp_port_range $tcp_listening_port voip_udp=$rtp_port_range $udp_sip $stun $asterisk_rtp $iax $iax2 $mgcp # $rtp_rtcp ################################################################## # options: "set" ################################################################## set block-policy drop set optimization conservative set skip on lo set loginterface fxp0 ################################################################# # scrub ################################################################# scrub in ################################################################# # QoS stuff ################################################################# altq on $ext_if priq bandwidth 520Kb queue { q_pri, q_def, q_bulk, q_crap } queue q_pri priority 7 queue q_def priority 5 priq(default) queue q_bulk priority 1 queue q_crap priority 0 ################################################################# # NAT rules: "rdr", "nat", "binat" ################################################################# nat on $ext_if from !($ext_if) -> ($ext_if:0) rdr on $ext_if proto tcp from any to any port {$voip_tcp} -> $trixboxen rdr on $ext_if proto udp from any to any port {$voip_udp} -> $trixboxen ################################################################# # filtering rules: "antispoof", "block", "pass" ################################################################# #block all block in pass out keep state antispoof quick for $int_if antispoof quick for lo block drop in quick on $voisin_if from $voisin_lan to $our_lan block drop in quick on $voisin_if proto tcp from $voisin_lan to \ $voisin_lan port ssh ## asterisk pass in quick proto udp from any to any port {$voip_udp} \ keep state queue (q_pri) ## firewall ports pass in inet proto icmp all icmp-type $icmp_types \ keep state queue (q_def, q_pri) pass quick on $int_if