### MACROS ### ext_if = "tun0" int_if = "fxp0" open_server_ports= "{21, 22, 80}" high_ports = "{6667, 5223}" med_ports = "{21, 25, 80, 110, 995}" icmp_types = "echoreq" comp_net = "{ 192.168.2.11, 192.168.2.12, 192.168.2.20, 192.168.2.21 }" comp_main = "192.168.2.10" block_policy = "return" ### OPTIONS ### set block-policy $block_policy set loginterface $ext_if set skip on lo ### NORMALIZATION ### scrub in ### ALTQ ### altq on tun0 cbq bandwidth 128Kb queue {std_out, tcp_ack_out, main_out, net_out} queue std_out bandwidth 20% cbq(red default borrow) queue tcp_ack_out bandwidth 40% cbq(borrow red) queue main_out bandwidth 30% cbq(borrow red) {high_main_out, med_main_out, low_main_out} queue high_main_out bandwidth 50% cbq(borrow red) queue med_main_out bandwidth 30% cbq(borrow red) queue low_main_out bandwidth 20% cbq(borrow red) queue net_out bandwidth 10% cbq(borrow red) altq on fxp0 cbq bandwidth 100% queue {std_in, net_in} queue std_in bandwidth 99Mb cbq(default borrow red) queue net_in bandwidth 512Kb {std_net_in, main_net_in, nat_net_in} queue std_net_in bandwidth 30% cbq(red borrow red) queue nat_net_in bandwidth 20% cbq(borrow red) queue main_net_in bandwidth 40% cbq(borrow red) {high_main_in, med_main_in, low_main_in} queue high_main_in bandwidth 50% cbq(borrow red) queue med_main_in bandwidth 30% cbq(borrow) queue low_main_in bandwidth 20% cbq(borrow) ### NAT ### nat on $ext_if from $comp_net to any -> ($ext_if:0) nat on $ext_if from $comp_main to any -> ($ext_if:0) ### REDIRECTS ### # PROXY rdr on $int_if proto tcp from $comp_main to !$int_if port 80 -> 127.0.0.1 port 8080 ### FILTERING ### block on $ext_if all # ROUTER OUT EXT pass out on $ext_if proto tcp from ($ext_if:0) to any flags S/SA keep state queue tcp_ack_out pass out on $ext_if proto {udp, icmp} from ($ext_if:0) to any keep state # MAIN COMP OUT EXT pass out on $ext_if from ($ext_if:0) to any keep state pass out on $ext_if from $comp_main to any keep state pass out on $ext_if proto tcp from $comp_main to any flags S/SA keep state queue tcp_ack_out pass out on $ext_if from $comp_main to any keep state queue low_main_out pass out on $ext_if proto {tcp, udp} from $comp_main to any port $med_ports keep state queue med_main_out pass out on $ext_if proto {tcp, udp} from $comp_main to any port $high_ports keep state queue high_main_out # NAT OUT EXT pass out on $ext_if from $comp_net to any keep state queue net_out # MAIN COMP IN EXT pass out on $int_if from any to $comp_main keep state queue low_main_in pass out on $int_if proto {tcp, udp} from any port $med_ports to $comp_main keep state queue med_main_in pass out on $int_if proto {tcp, udp} from any port $high_ports to $comp_main keep state queue high_main_in # NAT IN EXT pass out on $int_if from any to $comp_net keep state queue nat_net_in