A firewall restricts unauthorised access to your system by intruders, blocking certain types of network traffic. Firewalls can be implemented in software or in hardware. The hardware version is generally more secure than a software firewall installed alongside the operating system.
A firewall provides a layer of protection that permits or denies network communication based on a predefined set of rules. The rules are typically based on the TCP port through which the data is sent, the IP address from which the data originated, and the IP address to which the data is destined.
This all works fine until an improperly configured set of firewall rules can cause more problems than it prevents. Microsoft Windows includes a software firewall feature, but software-based firewalls simply don’t work as well as hardware firewalls like those found in routers.