A firewall is used to defend the perimeter of a network. A firewall is placed between the public network and the intranet. It can be used to prevent unauthorized users or packets from reaching the server. A firewall acts as a filter. It does this by controlling access based on content behavior or the origin of data packets. Firewalls defend against external attacks on protocols or applications.