A firewall is a device or software system that filters network traffic based on a set of rules.
Some common targets for firewall packet inspection include:
Firewalls that inspect headers higher up the OSI stack than layer four (the transport layer) are said to perform deep packet inspection. Such firewalls focused mostly on application layer concerns are known as web application firewalls (WAF) or next generation firewalls.
In response to information determined from packet headers or payloads, firewalls may take one or more of the following actions:
Dedicated devices known as firewalls are optimized to perform some or all of these services at high speed and high volume. Firewall functionality is also often found in all-in-one security appliances. However, firewalls can also be implemented on servers or PC desktops, running as a service in conjunction with the network interface. Cisco ACL technology implements some of the typical firewall features on standard routers and switches.
Firewalls separate networks into trusted and untrusted zones. Sometimes, a third type of zone is defined, called a DMZ. Usually, the public-facing side of the firewall is for untrusted traffic. The local-facing side of the firewall is for trusted traffic. A DMZ is used for services like web or email that need to face the public but also need a connection to the local network.
References:
http://windows.microsoft.com/en-US/windows-vista/Firewall-frequently-asked-questions
http://www.zdnet.com/news/guidelines-for-configuring-your-firewall-rule-set/298790