Yes, you will have to compile a custom FreeBSD kernel.
It's not that awful, actually.
First off, make sure you have the kernel sources (i.e. in /usr/src/sys).
You will be better off if you will run sysinstall beforehand: select "Configure" -> "Distributions" -> "Src" -> select "base" and "sys" and install them.
Right, now you're ready to configure your kernel to support IPFW and forwarding.
cd /usr/src/sys/i386/confcp GENERIC NEWKERNELvim NEWKERNEL
Here, add the following:
options IPFIREWALLoptions IPFIREWALL_VERBOSEoptions IPFIREWALL_FORWARDoptions IPFIREWALL_VERBOSE_LIMIT=5options IPFIREWALL_DEFAULT_TO_ACCEPToptions IPDIVERT
Now you should be ready to compile the new kernel:
cd /usr/srcmake buildkernel KERNCONF=NEWKERNELmake installkernel KERNCONF=NEWKERNELreboot
Basically, you will now need to explicitly enable IPFW and to point to the location of the file containing its rules. So you can add to your /etc/rc.conf the following:
# ipfw list
will show you which rules are in effect at the moment.