A firewall is a hardware based network security system that controls the network traffic. Firewall can be implements both in hardware and software. It used to prevent unauthorized Internet users from accessing private networks connected to the Internet.
Firewall is a software or hardware-based network security system that controls the incoming and outgoing network traffic based on applied rule set. A firewall establishes a barrier between a trusted, secure internal network and another network that is not assumed to be secure and trusted
A firewall is software or hardware that checks information coming from the Internet or a network, and then either blocks it or allows it to pass through to your computer, depending on your firewall settings.
A firewall can help prevent hackers or malicious software (such as worms) from gaining access to your computer through a network or the Internet. A firewall can also help stop your computer from sending malicious software to other computers.
The following illustration shows how a firewall works.
Illustration showing how a firewall creates a barrier between the Internet and your computer
Just as a brick wall can create a physical barrier, a firewall creates a barrier between the Internet and your computer
A firewall isn't the same thing as an antivirus program. To help protect your computer, you need both a firewall and an antivirus and anti-malware program.