A firewall is installed to prevent some attacks on a computer. iptables on Debian Linux can be used as a firewall by stopping some Internet traffic. Examples of firewalls on Microsoft Windows include Kaspersky Internet Security 2012, ESET Smart Security 5 and Norton Internet Security.
A firewall can handle the incoming or outgoing traffic or both. It can allow or disallow some forms of traffic by following rules.
A firewall can be a hardware firewall or a software firewall. iptables on Debian Linux is a software firewall. Examples for Microsoft Windows here are also software firewalls. To protect individual computers, a software firewall should be feasible. To protect multiple computers, a hardware firewall can be considered.
More information can be found here:
"Firewall Debate: Hardware vs. Software" written by Ronald Pacchiano on 09 Jun 2011