This is basically a checklist of how to setup a new system to be a firewall. The intent is not to cover everything in detail, merely to point you to each of the tasks that must be performed.
Obviously you must already have your hardware set up with two Network Interface Cards (NICs). One connected to the external network that you're protecting yourself from, the other connected to the internal network.
The manual for this process is: FreeBSD.org, Handbook ch. 6.
options IPFIREWALLoptions IPDIVERT (I have this -- not sure where it came from or if it's really needed)/etc/rc.conf. Add the following:gateway_enable="YES" (I have this -- not sure where it came from or if it's really needed)firewall_enable="YES"firewall_type="open"firewall_quiet="NO"/etc/rc.conf:natd_enable="YES"natd_program="/sbin/natd"natd_interface="x.y.z.q", where the address is the external interface./etc/rc.firewall for your
specific needs.
# The following (47, 1723) are for Microsoft PPTP.
${fwcmd} add pass tcp from any 1723 to ${inet}:${imask}
${fwcmd} add pass tcp from ${inet}:${imask} to any 1723
${fwcmd} add pass tcp from ${oip} to any 1723
${fwcmd} add pass gre from any to ${inet}:${imask}
${fwcmd} add pass gre from ${inet}:${imask} to any
${fwcmd} add pass gre from ${oip} to any
Getting a Cisco Systems VPN client working through ipfw
# The following (500, 10000) are for Cisco VPN.
${fwcmd} add pass udp from any 500 to ${inet}:${imask}
${fwcmd} add pass udp from ${inet}:${imask} to any 500
${fwcmd} add pass udp from ${oip} to any 500 keep-state
${fwcmd} add pass udp from any 10000 to ${inet}:${imask}
${fwcmd} add pass udp from ${inet}:${imask} to any 10000
${fwcmd} add pass udp from ${oip} to any 10000 keep-state