A firewall is a system that provides network security by filtering incoming and outgoing network traffic based on a set of firewall rules. The purpose of a firewall is to reduce or eliminate the occurrence of unwanted network communications while allowing all legitimate communication to flow freely.