BSD Stuff


FreeBSD as a Firewall/Gateway

12 September 2006, 17:15

In this howto I will use FreeBSD with PF (The OpenBSD Packet Filter), BIND9 and isc-dhcp3-server to build a Firewall/Gateway for my network. My ISP has given me a basic router to connect to the Internet so I don’t need to install PPPoE. As soon as I get the opportunity where I need PPPoE I will add it to this howto and show the differences.
As with all my howtos I will assume that you already have FreeBSD installed and the kernel and ports tree updated.
I just want to thank the poeple who created there howtos which I used to make my own. Mostly I just used this one Build a Home-Office Router Using FreeBSD and PF from bsdguides.org.
So Lets start.

Rebuild the Kernel

First we will rebuild the kernel to add PF in it. To do this we need to add the following text to the bottom of the /usr/src/sys/i386/conf/MYFIREWALL file.

# cd /usr/src/sys/i386/conf/
# cp GENERIC MYFIREWALL
# vim MYFIREWALL
#Code
0285device pf
0286device pflog
0287device pfsync
0288 
0289# ALTQ
0290options ALTQ
0291options ALTQ_CBQ
0292options ALTQ_RED
0293options ALTQ_RIO
0294options ALTQ_HFSC
0295options ALTQ_CDNR
0296options ALTQ_PRIQ

Also remember to change ident to MYFIREWALL

Then we need to rebuild the kernel to do that we do this.

# make buildkernel
# make installkernel
# shutdown -r now

When this is done we can move on to configure BIND

Page 1 of 4