The firewall is a network security device

The firewall is a network security device. It has two types
on is a software and the other one is hardware. Which is
following every data is incoming and outgoing traffic and
based on defined set of security rules. It can accept or
reject specific data if it’s blocked from the system. A
firewall is a device (usually a router or a computer)
installed between the internal network of an
organization and the rest of the Internet. So,
to control access to a system, we need firewalls

Types of Firewall

Firewalls are generally of two types: Host
based and Network-based.
Host- based Firewalls : Host-based firewall are installed on each network node which controls each incoming and outgoing packet. It is a software application or suit of applications, comes as a part of operating system. Host-based firewalls are needed because network firewalls cannot provide protection inside a trusted network. Host firewall protects each host from attacks and unauthorized access.
Network-based Firewalls : Network firewall function on network level. In other words, these firewalls filters all incoming and outgoing traffic across the network. It protects the internal network by filtering the traffic using rules defined on firewall. A Network firewall might have two or more network interface cards (NICs). Network-based firewall is usually a dedicated system with proprietary software installed.
Both types of firewall have their own advantages.

Ways to work firewall

Packet Filtering
Information is sent over the internet in small packages known as “packets.” With packet filtering, the firewall has established rules on what types of packets can get through, based on the initiating computer’s request. Disallowed packets are discarded.

Proxy Services
With proxy services, the firewall fetches data rather than the requesting system, serving as a kind of intermediary to determine each packet’s reliability.

Stateful Inspection
Stateful inspection is a new type of filtering that compares certain parts of individual data packets to a database of trusted information. As long as the comparison yields a reasonable match, the packet is let through.

Types for accept and reject;

Accept:

It will leave the data to enters the system of the network direct and take or give the information from the sender the receiver.

Reject:

block the data and don’t let the data enters the network, also it will reply a text to the sender with an “error”.

Drop: block the data and don’t let the data enters the network, without any reply for the sender

Type of software firewall

Network layer firewalls
One thing that’s an important difference about many network layer firewalls is that they route traffic directly though them, so to use one you either need to have a validly assigned IP address block or a private internet address block. The network layer firewalls tends to be very fast and almost transparent to its users.

Application layer firewalls

Having an application in the way in some cases may impact performance and may make the firewall less transparent. Early application layer firewalls are not particularly transparent to end-users and may require some training. However more modern application layer firewalls are often totally transparent. Application layer firewalls tend to provide more detailed audit reports and tend to enforce more conservative security models than network layer firewalls.