fwgen is a Linux iptables firewall rule generator. It takes a high-level description of the firewall rules and geneates the necessary iptables commands to implement those rules.
fwgen is licenced under the GNU General Public Licence (GPL).
The latest version is available in source form here:
fwgen-1.0.1.tar.gz (GPG signature)
Debian packages are available in my PPA:
https://launchpad.net/~jrc61/+archive/ppa
Source and binary RPMs are available here:
Binary: fwgen-1.0.1-1.noarch.rpm
Source: fwgen-1.0.1-1.src.rpm
Older releases are available in the archive (source only).
Do one of the following:
Read the man page and the README file for details of how to write an input file for fwgen.
Generate your rules by running fwgen.
Run the generated shell script before bringing up your network interfaces, for example, by using the pre-up directive in /etc/network/interfaces on a Debian/Ubuntu system.
See the README file and man page included in the fwgen package.