Add following option to /etc/rc.conf
Code:
firewall_enable="YES"
firewall_script="YES"
firewall_script="/usr/local/etc/ipfw.rules"
Setup firewall rules in /usr/local/etc/ipfw.rules and restart or reboot the server. If you are using old version or if you need NAT compile freebsd kernel. More info in our FAQ section:
FreeBSD Setting up Firewall using IPFW | Frequently Asked Questions