Match each kind of firewall to what it reads when deciding whether to pass traffic.
Choose the match for each entry. Every match has to be right.
The edge of a network is where it meets networks run by somebody else, above all the internet. A firewall stands at that edge and decides which traffic may pass in and out. Firewalls differ in how much of each message they read. No background is assumed. A security professional needs this to choose the kind of firewall a risk calls for, and to write rules that fail safe.
An illustrative example
A firm of surveyors protects its office with an old filtering router. To let staff browse the web, the installer wrote one rule: allow any packet from the internet that comes from port 443, the port secure websites reply from.
One night a stranger sets a computer to send from port 443 and connects to the firm's file server. Every packet matches the rule, so the router lets every packet in. No one in the office had asked that computer for anything.
What would the router have needed to know to tell a real reply from this one?
A firewall is a device or program placed between two networks that passes or blocks traffic according to a set of rules. It protects the network on one side, called the inside, from the network on the other.

A hardware firewall is a box placed between two networks, with a separate socket for the outside network and for the inside network it protects.
Photograph: Watchguard Firebox 1000 back by Jakez, CC BY-SA 3.0. Cropped and resized.
Three guards at a gate
The first guard looks only at the address on each envelope. The second also keeps a list of who went out, and admits only letters that answer one of them. The third opens each envelope and reads the letter. Each guard catches more than the one before and takes longer over each letter.
What a can decide depends on what it reads. At it reads the source and destination IP addresses. At it reads the protocol and the port numbers, which say which service is being asked for. At it reads the content: the web page requested, the file sent, the command given.
Reading more allows finer rules. It also costs more work for each , and content cannot be read at all unless the firewall it first.
| Kind | Reads | OSI layer | Limit |
|---|---|---|---|
| Static packet filter | The header of each packet, one at a time | 3 and 4 | Cannot tell a real reply from a forged one |
| Stateful inspection | Headers, checked against a table of the connections in progress | 3 and 4 | Does not read content |
| Dynamic packet filter | Headers, and opens a temporary rule for each reply | 3 and 4 | Does not read content |
| Circuit-level gateway | The setting up of each connection, which it then relays | 5 | Passes the content through unread |
| Application-level proxy | The whole message of one application protocol | 7 | Slower, and needs a proxy for each protocol |
| Next-generation firewall | Headers, connection state and application content together | 3 to 7 | Must decrypt traffic to inspect it |
| Web application firewall | Web requests sent to one website | 7 | Protects web applications and nothing else |
A static packet filter, also called a stateless firewall, judges every packet alone. A stateful inspection firewall records each connection that a device inside begins, in a state table. A packet from outside is admitted only when it matches a connection in that table. At the surveyors' office a stateful firewall would have found no entry for the stranger's computer and dropped its packets.
A dynamic packet filter opens a temporary rule that admits only the reply to each packet sent out, and drops the rule when its time runs out. Some makers use the name for stateful inspection itself.
A circuit-level gateway relays connections between inside and outside without examining what they carry. SOCKS is a common example: the client connects to a SOCKS server, which checks the source and destination and then relays the connection. An application-level proxy stands in for both ends. The client connects to the proxy and the proxy makes a second, separate connection to the server. It reads every command, can ask each user to sign in, and hides inside addresses from the outside.
A next-generation firewall (NGFW) combines stateful inspection with knowledge of applications. It can tell which application is in use whatever port it runs on, decrypt and inspect encrypted traffic, and block known attacks.
A web application firewall (WAF) sits in front of a web server and inspects the requests sent to it. It looks for attacks hidden inside ordinary web traffic, such as SQL injection, where database commands are typed into a form on a web page.
A firewall holds its rules as an ordered list, the ruleset. Each rule names a source, a destination, a service and an action: allow or deny. For each new connection the firewall reads the list from the top and applies the first rule that matches. Later rules are not consulted.
| Order | From | To | Service | Action |
|---|---|---|---|---|
| 1 | Office network | Internet | Secure web ( 443) | Allow |
| 2 | Internet | Public web server | Secure web (TCP 443) | Allow |
| 3 | Visitors' network | Office network | Any | Deny |
| 4 | Any | Any | Any | Deny |
Order decides the outcome. If a broad rule sits above a narrow one, the narrow rule is never reached. Specific rules therefore go above general ones.
The last line of the table is implicit deny, also called deny by default: whatever no rule has expressly permitted is blocked. A firewall built the other way round, allowing everything except what is listed, fails the first time something new appears.
First match wins. Specific above general. Everything not expressly allowed is denied.
Rulesets grow. Each rule should have an owner and a reason, changes should pass through , and rules that nothing uses are removed at regular reviews.
An edge network is the part of a network that connects to networks owned by others. Ingress filtering checks traffic coming in at the edge. Egress filtering checks traffic going out. Egress filtering stops stolen data leaving, stops malicious software reporting to its controller and stops the organisation's own machines being used to attack others.
Spoofing means forging the source address of a packet. Two rules at the edge defeat most of it. Inbound, drop any packet from outside that claims an inside address or a private address. Outbound, drop any packet whose source address is not one of the organisation's own. Internet providers apply the same check to their customers.
A flood of traffic from many machines at once, a distributed denial of service, can fill the link before the firewall is reached. Providers can filter such a flood upstream, a service often called scrubbing.
The internet is thousands of separately run networks. Each is an autonomous system, and they tell one another which addresses they can deliver to using the Border Gateway Protocol (BGP).
BGP believes what neighbouring networks announce. In prefix hijacking a network announces address ranges that belong to someone else and draws their traffic to itself. A route leak passes routes on beyond where they were meant to go. The defence is to filter the routes accepted from each neighbour, and to check announcements against signed records of who holds which addresses.
A charity's edge firewall is a stateful inspection firewall. It allows connections from the internet to the charity's donations website on TCP port 443 and denies everything else inbound. Logs from the website show repeated attempts to insert database commands through the donation form. The IT manager asks the security adviser what to add.
Which control BEST addresses these attempts?
Answer: A. A web application firewall in front of the donations site
Read the edge firewall's rules from the top and find the first one that matches the laptop's request.
Loading the preview.
4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 4
Match each kind of firewall to what it reads when deciding whether to pass traffic.
Choose the match for each entry. Every match has to be right.
Ingress filtering checks traffic entering at the edge. Egress filtering checks traffic leaving, which stops forged source addresses and stolen data. Transit is a provider carrying a customer's traffic to the whole internet. Peering is two networks exchanging their own customers' traffic directly, often at an internet exchange point. Routes from other networks are filtered because BGP believes what it is told.
At layer 3 it reads the source and destination IP addresses. At layer 4 it reads the protocol and the port numbers. At layer 7 it reads the content, such as the page requested or the command given. Reading more allows finer rules but costs more work for each packet, and encrypted content cannot be read unless decrypted first.
A static packet filter judges every packet alone. A stateful inspection firewall admits a packet from outside only when it matches a connection in its state table. A circuit-level gateway, such as SOCKS, relays connections without examining what they carry. An application-level proxy makes a second, separate connection to the server and reads every command.
It reads the list from the top and applies the first rule that matches; later rules are not consulted. Specific rules therefore go above general ones. Implicit deny, also called deny by default, blocks whatever no rule has expressly permitted.