All pastes #409345 Raw Edit

Unnamed

public text v1 · immutable
#409345 ·published 2007-03-25 16:40 UTC
rendered paste body
root@zion# cat /etc/pf.conf
#       $FreeBSD: src/etc/pf.conf,v 1.2.2.1 2006/04/04 20:31:20 mlaier Exp $
#       $OpenBSD: pf.conf,v 1.21 2003/09/02 20:38:44 david Exp $
#
# See pf.conf(5) and /usr/share/examples/pf for syntax and examples.
# Required order: options, normalization, queueing, translation, filtering.
# Macros and tables may be defined and used anywhere.
# Note that translation rules are first match while filter rules are last match.


# Macros: define common values, so they can be referenced and changed easily.
ext_if="fxp0"   # replace with actual external interface name i.e., dc0
int_if="ath0"   # replace with actual internal interface name i.e., dc1
internal_net="192.168.0.0/24"
external_addr="`ifconfig fxp0 | grep inet | cut -d ' ' -f2`"

# Tables: similar to macros, but more flexible for many addresses.
#table <foo> { 10.0.0.0/8, !10.1.0.0/16, 192.168.0.0/24, 192.168.1.18 }

# Options: tune the behavior of pf, default values are given.
set timeout { interval 10, frag 30 }
set timeout { tcp.first 120, tcp.opening 30, tcp.established 86400 }
set timeout { tcp.closing 900, tcp.finwait 45, tcp.closed 90 }
set timeout { udp.first 60, udp.single 30, udp.multiple 60 }
set timeout { icmp.first 20, icmp.error 10 }
set timeout { other.first 60, other.single 30, other.multiple 60 }
set timeout { adaptive.start 0, adaptive.end 0 }
set limit { states 10000, frags 5000 }
set loginterface none
set optimization normal
set block-policy drop
set require-order yes
set fingerprints "/etc/pf.os"

# Normalization: reassemble fragments and resolve or reduce traffic ambiguities.

scrub in all

# Translation: specify how addresses are to be mapped or redirected.
# nat: packets going out through $ext_if with source address $internal_net will
# get translated as coming from the address of $ext_if, a state is created for
# such packets, and incoming packets will be redirected to the internal address.

nat on $ext_if from $internal_net to ! $internal_net -> ($ext_if)

pass in log quick on $int_if keep state
pass out log quick on $int_if keep state
pass in log quick on $ext_if keep state
pass out log quick on $ext_if keep state

root@zion# ifconfig
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
        ether 00:13:46:94:04:7a
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: associated
        ssid wirelima channel 1 bssid 00:13:46:94:04:7a
        authmode OPEN privacy OFF txpowmax 36 bmiss 7 protmode CTS burst
        dtimperiod 1 bintval 100
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=8<VLAN_MTU>
        inet 201.53.122.114 netmask 0xfffff800 broadcast 255.255.255.255
        ether 00:16:76:cb:b7:45
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
pflog0: flags=0<> mtu 33160
pfsync0: flags=0<> mtu 2020
        syncpeer: 224.0.0.240 maxupd: 128