Edit this if you want more than just basic masquerading. Also possible to add more modules. For configuring syslogd. You also have to turn on logging in the firewall rules. Change whatever you want to, usually the processor to compile for and network interfaces.
Check ipchains webpage for how to set up the ipchains tool.
Most of the tools are from Debian except ipchains, ipmasqadm and dhcpcd. I'd like you to refer to me or these pages if you do. The download directory , with packages. David A. Nelson wrote this quite long and nice description and document. This is a japanese mirror of this site with the pages in Japanese.