Implement a Linux firewall with iptables and ip6tables.

This helper method is also a bit long, but not quite as bad as the prior one. I wouldn't be sad if you split this one out a bit more.