A firewall is a network security system that monitors and allows or blocks traffic based on specific predetermined rules. It typically establishes a barrier between trusted and untrusted networks.