A firewall is a network security device or software that monitors and controls incoming and outgoing network traffic based on predefined security rules. Acting as a barrier between trusted internal networks (e.g., a corporate LAN) and untrusted external networks (e.g., the internet), firewalls prevent unauthorized access, block malicious traffic, and protect sensitive data. They are a cornerstone of modern cybersecurity strategies.