Hi rjston,
Sounds like a job for an "iptables" script to me.
The link to "netfilter.org" above should cover all that.
"iptables" exists as a separate package to the
kernel and will be available either pre-compiled or
as source. The kernel only provides a set of "hooks"
that allows for it's use. It is an excellent kernel
level, extensible, firewalling facility.
It is so good, you can even block your self out
of your own machine. Nothing that "single" user mode can't fix though

.
It will try to install a boot script in your
"init.d" directory, ok if your into stuff like that.
I prefer to start it manually, when needed though.
But each to their own i guess

.
A visit to
http://projectfiles.com/firewall/
may be useful. They have an script available for
down load, which can act as a template for
personal modifications.
iptables is a very straight forward blocking system,
quite easy to understand and configure.
After the initial exposure period.
You may find it worth while to look into some packages
like "guardog", for a qt/kde gui front end, to
automate the configuration process. Not sure on it's
site at the moment. It'll be on google somewhere
though
After all that, check out //grc.com to test your
system.
jm