Outside of computer security, a firewall is simply a wall built to stop (or slow down) the spread of a fire. In terms of computer security, a firewall is a piece of software. This software monitors the network traffic. A firewall has a set of rules which are applied to each packet. The rules decide if a packet can pass, or whether it is discarded. Usually a firewall is placed between a network that is trusted, and one that is less trusted. When a large network needs to be protected, the firewall software often runs on a computer that does nothing else.
Data travels on the internet in small pieces; these are called packets. Each packet has certain metadata attached, like where it is coming from, and where it should be sent to. The easiest thing to do is to look at the metadata. Based on rules, certain packets are then dropped or rejected. All firewalls can do this. It is done at the network layer
Stateful packet inspection
In addition to the simple packet filtering (above) this kind of firewall also keeps track of connections. A packet can be the start of a new connection, or it can be part of an existing connection. If it is neither of the two, it is probably useless and can be dropped.
Application-layer firewalls do not just look at the metadata; they also look at the actual data transported. They know how certain protocols work, for example FTP or HTTP. They can then look if the data that is in the packet is valid (for that protocol). If it is not, it can be dropped.
Support for changing business needs. The best firewall solutions for small business let you safely deploy new applications. They provide advanced application-layer security for a wide range of applications, including email, voice over IP (VoIP), video, and multimedia programs.
Controlled access to your company's resources. The most effective firewall solutions for small business block unauthorized access to applications or information assets.
Increased employee productivity. By blocking unauthorized access from hackers, your firewall helps prevent the loss of employee productivity or valuable company data.
Improved business resiliency. The best firewalls prevent disruption of business-critical applications and services due to security breaches.