Explanation: The main purpose of a firewall is to protect a network from external attacks. It monitors and controls traffic into and out of a secure network. h can be implemented in a router, or a gateway or a special host. A firewall is normally located at the gateway to a network, but it may also be implemented at host access points. Firewalls use packet filtering or application-level gateways as the two primary techniques of controlling undesired traffic.