A firewall is a security system either software, hardware, or both that monitors and controls incoming and outgoing network traffic based on a set of predefined rules.
Think of it as a gatekeeper between two networks (e.g., your server and the internet, or your internal network and an external one). It decides what traffic is allowed through and what gets blocked
Network-based firewall : protects an entire network at once, sitting at the entry/exit point (like a router or gateway). One firewall, many machines protected.
what it does ?
it continiously monitor the incomming traffic, port number,ip address, protocoal and allow or block based on predefined rules.
Host-based firewall : protects just one single machine/device, installed directly on that machine's OS.
what it does ?
it also continiously filter the incomming traffic allowing and blocking the ports and inspect the application overally what we have to understand is it is used to protect the delicated machines
for better understanding lets go through the given figure