Routing, Port Mapping, Internet Sharing etc etc

I'm running OS X. (OS X Server actually) and right now I use a program called BrickHouse to handle my router configuration. But this program kind of sucks. I'd much rather learn how to configure these programs manually. By these programs, I mean the programs OS X comes with to handle these jobs (natd, ipfw right?). I know BrickHouse is basically just a GUI front end for those. I'd like to be able to manually configure them. So I can SSH into the machine and add a port mapping if I need to, easily and quickly. I can't seem to find any good info on how to do this on the web, I don't know if I'm searching for the wrong thing or what. But if someone wants to walk me through setting something like this up, it would be really appreciated. Thanks.