This video shows how to use GNU/Linux to create a very robust, secure and customizable network firewall from scratch.
Please note some GNU/Linux distros use the conntrack module as opposed to the state module for connection state tracking. In the case of using conntrack
replace every instance:
"iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT"
With its conntrack counterpart:
"iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT"