Support Forums
[Tutorial] Setting up PF on Freebsd {Beginner} - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Computer Support Topics (https://www.supportforums.net/forumdisplay.php?fid=4)
+---- Forum: Linux, FreeBSD, and Unix (https://www.supportforums.net/forumdisplay.php?fid=17)
+---- Thread: [Tutorial] Setting up PF on Freebsd {Beginner} (/showthread.php?tid=1957)



[Tutorial] Setting up PF on Freebsd {Beginner} - bsdpunk - 10-21-2009

So if you want PF to do only one thing, and that is to block particular ip's here is how you do it. Keep in mind, this configuration is a horrible idea for a traditional firewall. So first begin with creating /etc/pf.conf, I use vi, you can use whatever.

ext_if="re0" # External interface

#Block all Ip's in the banned table
table { 192.168.1.1 }
block quick from to any
block quick from any to

pass out keep state
pass in quick on ext_if

conf if your looking for a traditional firewall, this is for the sole purpose of blocking a single IP or IP ranges.

You will need to replace re0 with your interface name and put your IP's to be blocked in the banned table.

You can put entire classes of IP's if you want like: 204.152.64.0/23
and the table should be comma seperated so something like:

table { 192.168.1.1, 204.152.64.0/23 }

Also to get pf.conf to start(FreeBSD, anyway), you need to put this in the rc.conf:

pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""


RE: [Tutorial] Setting up PF on Freebsd {Beginner} - Omniscient - 10-21-2009

You also need kernel support I believe before you can add that to rc.conf.


RE: [Tutorial] Setting up PF on Freebsd {Beginner} - flAmingw0rm - 10-21-2009

Great tutorial buddy. Would rep you if I could. Keep up the good work.