]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/examples/pf/faq-example1
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / examples / pf / faq-example1
1 # $FreeBSD$
2 # $OpenBSD: faq-example1,v 1.5 2006/10/07 04:48:01 mcbride Exp $
3
4 #
5 # Firewall for Home or Small Office
6 # http://www.openbsd.org/faq/pf/example1.html
7 #
8
9
10 # macros
11 ext_if="fxp0"
12 int_if="xl0"
13
14 tcp_services="{ 22, 113 }"
15 icmp_types="echoreq"
16
17 comp3="192.168.0.3"
18
19 # options
20 set block-policy return
21 set loginterface $ext_if
22
23 set skip on lo
24
25 # scrub
26 scrub in
27
28 # nat/rdr
29 nat on $ext_if from !($ext_if) -> ($ext_if:0)
30 nat-anchor "ftp-proxy/*"
31 rdr-anchor "ftp-proxy/*"
32
33 rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
34 rdr on $ext_if proto tcp from any to any port 80 -> $comp3
35
36 # filter rules
37 block in
38
39 pass out
40
41 anchor "ftp-proxy/*"
42 antispoof quick for { lo $int_if }
43
44 pass in on $ext_if inet proto tcp from any to ($ext_if) port $tcp_services
45
46 pass in on $ext_if inet proto tcp from any to $comp3 port 80 \
47     synproxy state
48
49 pass in inet proto icmp all icmp-type $icmp_types
50
51 pass quick on $int_if no state