A firewall is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on security rules. Firewalls have been a first line of defense in network security for over 25 years. Firewalls act as a barrier between trusted and untrusted networks and try to block the spread of computer attacks, similar to a physical firewall. There are different types of firewalls including packet filtering, circuit-level gateways, stateful inspection, and application-level gateways. Firewalls analyze incoming traffic based on pre-established rules and filter suspicious sources to prevent attacks by guarding ports where information is exchanged.