1 # $OpenBSD: faq-example1,v 1.3 2005/07/02 16:16:39 joel Exp $
2 # $DragonFly: src/share/examples/pf/faq-example1,v 1.1 2005/12/13 01:58:27 corecode Exp $
5 # Firewall for Home or Small Office
6 # http://www.openbsd.org/faq/pf/example1.html
14 tcp_services = "{ 22, 113 }"
15 icmp_types = "echoreq"
17 priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
22 set block-policy return
23 set loginterface $ext_if
29 nat on $ext_if from $int_if:network to any -> ($ext_if)
30 rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 \
32 rdr on $ext_if proto tcp from any to any port 80 -> $comp3
39 block drop in quick on $ext_if from $priv_nets to any
40 block drop out quick on $ext_if from any to $priv_nets
42 pass in on $ext_if inet proto tcp from any to ($ext_if) \
43 port $tcp_services flags S/SA keep state
45 pass in on $ext_if proto tcp from any to $comp3 port 80 \
46 flags S/SA synproxy state
48 pass in on $ext_if inet proto tcp from port 20 to ($ext_if) \
49 user proxy flags S/SA keep state
51 pass in inet proto icmp all icmp-type $icmp_types keep state
53 pass in on $int_if from $int_if:network to any keep state
54 pass out on $int_if from any to $int_if:network keep state
56 pass out on $ext_if proto tcp all modulate state flags S/SA
57 pass out on $ext_if proto { udp, icmp } all keep state