To define a firewall in simple terms, one can put it to words as a – protective system that functions between your host/network and the sometimes “deadly” Internet. An effective firewall policy, prevents unauthorized use and access to your network/server.
The role of a firewall is to analyse information entering and leaving the network/server, based on an existing firewall configuration. It usually acts as a barrier for many form of attacks.
Ideally, a security strategy puts to use both hardware, and software firewalls. That said, understanding them based on a comparative approach definitely helps framing sound firewall policies.