Network configuration, on a Debian System, is stored in /etc/network.
In this directory you’ll find :
You’ll mostly want to tweak with the interfaces file, and probably put some scripts in the various hook directories. For example the /etc/network/if-pre-up.d is great to put the script which will setup your firewall (with iptables commands and ruleset).
Be sure to read the Debian Reference, which covers this and much more in great details.
Cfengine is a tool which purpose is to describe what is a healthy system and how to bring it back to normal when something fails.
I won’t go into an explanation about how cfengine works, because the project webpage already has a neat tutorial and complete reference. Instead of that, I’ll explain how I used cfengine to build a fool proof Linux firewall.