Rakshak -2023 The primary function of a firewall is to protect a computer or network from unauthorized access and malicious attacks.