Firewalls provide perimeter defense by controlling access between networks and monitoring traffic. They implement security policies through packet filtering, application gateways, or circuit gateways. Packet filters examine transport layer information like IP addresses and port numbers to allow or block packets. Application gateways use proxies that understand specific protocols to filter traffic at the application layer. Circuit gateways allow pre-defined connections by relaying TCP packets without examining contents. Dynamic packet filters capture connection semantics by dynamically updating rules based on established connections. Firewalls are not perfect defenses and risks remain from inside threats. Layered protection is needed to assess risks at every level.