#interfaces
ext_if="rl0"
int_if="rl1"
#users
comp1="192.168.1.1"
comp2="192.168.1.2"
comp3="192.168.1.3"
comp4="192.168.1.4"
comp5="192.168.1.5"
comp6="192.168.1.6"
comp7="192.168.1.7"
comp8="192.168.1.8"
set optimization aggressive
set timeout { frag 10, tcp.established 3600 }
set timeout { tcp.first 30, tcp.closing 10, tcp.closed 10, tcp.finwait 10 }
set timeout { udp.first 30, udp.single 30, udp.multiple 30 }
set timeout { other.first 30, other.single 30, other.multiple 30 }
set timeout { adaptive.start 5000, adaptive.end 10000 }
set skip on lo0
### QUEUEING ###
altq on $ext_if bandwidth 850Kb hfsc queue { up_def up_comp1 up_comp2 up_comp3 up_comp4 up_comp5 up_comp6 up_comp7 up_comp8 }
queue up_def bandwidth 4% hfsc (default)
queue up_comp1 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp2 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp3 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp4 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp5 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp6 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp7 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue up_comp8 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
altq on $int_if bandwidth 15000Kb hfsc queue { dn_def dn_comp1 dn_comp2 dn_comp3 dn_comp4 dn_comp5 dn_comp6 dn_comp7 dn_comp8 }
queue dn_def bandwidth 4% hfsc (default)
queue dn_comp1 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp2 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp3 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp4 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp5 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp6 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp7 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
queue dn_comp8 bandwidth 12% hfsc (realtime 10% upperlimit 100%)
#NAT
nat on $ext_if from !($ext_if) to any -> ($ext_if)
no rdr
#Firewall
block all
#RULES
pass in quick on $int_if from $comp1 to any tag comp11 keep state queue dn_comp1
pass out quick on $ext_if tagged comp1 keep state queue up_comp1
pass in quick on $int_if from $comp2 to any tag comp21 keep state queue dn_comp2
pass out quick on $ext_if tagged comp21 keep state queue up_comp1
pass in quick on $int_if from $comp3 to any tag comp31 keep state queue dn_comp3
pass out quick on $ext_if tagged comp31 keep state queue up_comp1
pass in quick on $int_if from $comp4 to any tag comp41 keep state queue dn_comp4
pass out quick on $ext_if tagged comp41 keep state queue up_comp1
pass in quick on $int_if from $comp5 to any tag comp51 keep state queue dn_comp5
pass out quick on $ext_if tagged comp51 keep state queue up_comp1
pass in quick on $int_if from $comp6 to any tag comp61 keep state queue dn_comp6
pass out quick on $ext_if tagged comp61 keep state queue up_comp1
pass in quick on $int_if from $comp7 to any tag comp71 keep state queue dn_comp7
pass out quick on $ext_if tagged comp71 keep state queue up_comp1
pass in quick on $int_if from $comp8 to any tag comp81 keep state queue dn_comp8
pass out quick on $ext_if tagged comp81 keep state queue up_comp1
pass out on $int_if inet from ($int_if) to any keep state
pass out on $ext_if from ($ext_if) to any keep state queue dn_comp1