Guide to Unix/Explanations/Firewalls
Introduction to Firewalls 
The Concept of Firewall 
A software Firewall is a filter of network traffic, in the form of Packets. Each packet contains information such as senders' IP, receivers' IP. Firewall rules are criteria, which are set based on the information of the packet.
There are two types of firewall, based different logic conditions. Exclusive firewall allows all traffic except for the traffic matching the ruleset. Inclusive firewall denies all traffic except for the traffic matching the ruleset.
Note: Firewalls are known as "packet filter". Other related concepts are "packet shaper". It controls bandwidth based on rulesets.