FIREWALLS FOR DIFFERENT LAYERS:
Layer 2 firewalls offer preservation of existing server gateways, IP subnets, and address.
Layer 3 firewalls (i.e. packet filtering firewalls) filter traffic based solely on source/destination IP, port, and protocol.
Layer 4 firewalls do the above, plus add the ability to track active network connections, and allow/deny traffic based on the state of those sessions (i.e. stateful packet inspection).
Layer 5 and 6 are responsible for applications communicating with the host. Some of the protocols use RPC in which the procedures are created on clients and performed on servers. Thus, we use a firewall here for added security.
Layer 7 Application-layer firewalls allow you to create filters to intercept, analyze or modify traffic specific to your network.