# macros int_if = "re0" ext_if = "re1" internal_net="10.0.0.0/8" external_addr="69.30.132.109" tcp_services = "{ 22, 80, 113 }" icmp_types = "echoreq" #priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }" priv_nets = "{ 127.0.0.0/8, 10.0.0.0/8 }" # options set block-policy return set loginterface $ext_if set skip on lo0 # scrub scrub in all # nat/rdr #nat on $ext inet from 172.16.10.0/24 to any -> ($ext_if) #nat on $ext_if from $int_if:network to any -> ($ext_if) nat on $ext_if from $internal_net to any -> ($ext_if) rdr on $ext_if proto tcp from any to $external_addr/32 port 1234 -> 10.0.0.0 port 5678 rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021 # filter rules block all pass quick on lo0 all block drop in quick on $ext_if from $priv_nets to any block drop out quick on $ext_if from any to $priv_nets # allow access to tcp_services on external interface pass in on $ext_if inet proto tcp from any to ($ext_if) \ port $tcp_services flags S/SA keep state # allow in FTP control port pass in on $ext_if inet proto tcp from port 20 to ($ext_if) user proxy flags S/SA keep state # allow in ping replies pass in inet proto icmp all icmp-type $icmp_types keep state # allow all traffic from internal network to internal interface pass in on $int_if from $int_if:network to any keep state pass out on $int_if from any to $int_if:network keep state # allow all traffic out via external interface pass out on $ext_if proto tcp all modulate state flags S/SA pass out on $ext_if proto { udp, icmp } all keep state