Hi All!
My pf/altq rules do not seem to work and I can't find any errors.
Here is the background.
I have 512/512 kbit adsl connection to Internet and 100Mbit
on internal side of the firewall. I want to prioritize shoutcast/mp3,
windows media services, icq messages and udp traffic higher than ftp
and http bulk downloads and other tcp traffic. Additionally, I want
ssh and tcp ack packets to have highest priority. Kernel is patched
with Trevor Talbot's patch.
Here are my rules.
# /etc/pf.conf
lo_if="lo0"
ext_if="tun0"
int_if="rl1"
int_ip="192.168.240.254"
int_net="192.168.240.0/24"
int_server21_ip="192.168.240.21"
##
table persist file "/etc/reserved_ips"
##
set loginterface rl0
set optimization aggressive
set block-policy drop
##
scrub in all
##
altq on $ext_if cbq bandwidth 488Kb queue { ext_def, ext_med, ext_hi }
queue ext_def bandwidth 100Kb priority 1 cbq(default,borrow)
queue ext_med priority 4
queue ext_hi priority 5
altq on $int_if cbq bandwidth 100Mb queue { int_lan, int_inet }
queue int_lan priority 1 { int_lan_def, int_lan_med, int_lan_hi }
queue int_lan_def priority 1
queue int_lan_med priority 4
queue int_lan_hi priority 7
queue int_inet priority 3 bandwidth 488Kb { int_inet_hi, \
int_inet_med, int_inet_def }
queue int_inet_hi priority 7
queue int_inet_med priority 4
queue int_inet_def bandwidth 100Kb priority 1 \
cbq(default,borrow)
##
# translate outgoing internal ips to external ip
nat on $ext_if from $int_net to any -> ($ext_if) static-port
##
# block reserved address ranges
block quick on $ext_if from to any
block quick on $ext_if from any to
# by default block and log any packet on external interface
block log on $ext_if all
# by default block and log any packet on internal interface
block return log on $int_if all
# block and log outgoing packets that do not have our address as source
block out log quick on $ext_if inet from ! ($ext_if) to any
# block destination unreachable outward
block out quick on $ext_if inet proto icmp all icmp-type 3
# allow dhcp requests from this host to external dhcp server
pass in quick on $ext_if inet proto udp from $ext_dhcpserver_ip \
port 67 to ($ext_if) port 68 keep state
pass out quick on $ext_if proto udp from ($ext_if) port 68 to \
$ext_dhcpserver_ip port 67 keep state
# allow ping requests outward
pass in quick on $int_if proto icmp from $int_net to any icmp-type 8 \
keep state queue int_lan_med
pass out quick on $ext_if inet proto icmp from ($ext_if) to any \
icmp-type 8 keep state queue ext_med
# allow ssh from internal hosts to internal ip
pass in quick on $int_if proto tcp from $int_net port >1023 \
to $int_ip port 22 flags S/SA modulate state \
queue (int_lan_med, int_lan_hi)
# allow ftp trafic outward
pass in quick on $int_if proto tcp from $int_net port >1023 to any \
port 21 flags S/SA modulate state queue (int_inet_med, int_inet_hi)
pass out quick on $ext_if inet proto tcp from ($ext_if) port >1023 \
to any port 21 flags S/SA modulate state queue (ext_med, ext_hi)
# allow dns queries from this host to server21
pass out quick on $int_if inet proto udp from $int_ip port >1023 \
to $int_server21_ip port 53 keep state queue int_lan_med
# allow dns queries from server21 to external dns servers
pass in quick on $int_if proto udp from $int_server21_ip port >1023 \
to any port 53 keep state queue int_inet_med
pass out quick on $ext_if inet proto udp from ($ext_if) port >1023 \
to any port 53 keep state queue ext_med
# allow ntp outward
pass in quick on $int_if proto udp from $int_server21_ip port 123 \
to any port 123 keep state queue int_inet_med
pass out quick on $ext_if inet proto udp from ($ext_if) port 123 \
to any port 123 keep state queue ext_med
# allow web outward
pass in quick on $int_if proto tcp from $int_net port >1023 to any \
port { 80, 443 } flags S/SA modulate state \
queue (int_inet_def, int_inet_hi)
pass out quick on $ext_if inet proto tcp from ($ext_if) port >1023 \
to any port { 80, 443 } flags S/SA modulate state \
queue (ext_def, ext_hi)
# allow news outward
pass in quick on $int_if proto tcp from $int_net port >1023 to \
any port 119 flags S/SA modulate state \
queue (int_inet_def, int_inet_hi)
pass out quick on $ext_if inet proto tcp from ($ext_if) port >1023 \
to any port 119 flags S/SA modulate state queue (ext_def, ext_hi)
# allow pop3 and smtp outward
pass in quick on $int_if proto tcp from $int_net port >1023 to any \
p