To set up your Debian GNU/Linux machine as a firewall use:
wajig install ipmasq
Then set up your /etc/network/interfaces file and ipmasq will set up firewall and routing tables automatically.