OSI model versus TCP/IP model
Before discussing how a firewall works, we must first understand how the different layers of a network interact. Network communication is based on a seven-layer model, and each layer has its own set of responsibilities in order to make the communication happen. Firewalls can operate on different layers in order to use different criteria to block or permit the traffic.
In general, a firewall is going to have to operate at the network layer (L3) and transport layer (L4). The upper layers are more like scanning for viruses in data payloads and doing deep packet inspection. The Layer-1 physical layer is basically just a network connectivity requirement.
TCP/IP, also known as the internet model developed by the Department of Defense (DoD), is a simplified and practical version of the Open System Interconnection (OSI) model (1984), which is based on a theoretical concept.
The OSI model is based on server layers and its specific function. The following diagram shows...