Firewall in 3D

A standing board shows a firewall diagram where firewall rules sit between the internet and a company network, choosing whether to block or allow traffic.Drag to turn

A firewall is a hardware or software control that allows or blocks network traffic according to a set of rules. It sits at a boundary between networks of different trust, such as a company network and the internet.

What a firewall decides

A firewall inspects network traffic and applies a rule to each packet or connection. The usual outcomes are allow, drop, or reject. Drop discards the packet silently, while reject discards it and sends an error back to the sender.

Firewalls run as dedicated appliances, as software on a server, or as a service in a cloud network. A host firewall protects one machine. A network firewall protects every device behind it.

Rules, order and the default policy

A rule matches fields in the packet header, usually source address, destination address, protocol and port number. Rules are usually checked from top to bottom, and the first match decides the outcome. Rule order therefore matters.

The default policy applies when no rule matches. Deny by default is the common secure choice: only traffic that is explicitly permitted gets through.

Stateless, stateful and application-layer inspection

A stateless packet filter judges each packet alone. A stateful firewall keeps a table of active connections and recognises reply traffic as part of a connection that an inside host started. This lets it block unsolicited inbound packets without a separate rule for every reply.

Application-layer firewalls, including proxy firewalls and next-generation firewalls, inspect the content of traffic as well as headers. They can, for example, tell web traffic from other traffic on the same port. This costs more processing and can be limited when traffic is encrypted.

Worked example: a small office rule set

Take an office with a web server at 10.0.0.5. The rules are: 1) allow TCP port 443 to 10.0.0.5, 2) allow TCP port 22 from the admin address 10.0.0.9 only, 3) deny everything else. A visitor connecting to 10.0.0.5 on port 443 matches rule 1 and is allowed.

A packet to port 22 from 203.0.113.7 fails rule 2 because the source differs, so it falls to rule 3 and is dropped. Three rules cover three cases, and the final rule makes the policy deny by default.

Common misconceptions and where firewalls appear

A firewall does not make a network secure by itself. It cannot stop an attack carried over a port it allows, malware that a user downloads over permitted web traffic, or a threat already inside. It works best as one layer alongside patching, authentication and monitoring.

Firewalls appear in home routers, operating systems, corporate network edges, data centres and cloud virtual networks. Segmenting an internal network with firewalls limits how far an intruder can move.

Key terms

Packet filter
A firewall function that allows or blocks packets by header fields such as address, protocol and port.
Stateful inspection
Tracking active connections so that reply traffic can be matched to a connection already allowed.
Default policy
The action taken when no rule matches a packet, usually deny.
Rule order
The sequence in which rules are checked, where the first match usually decides the outcome.
Next-generation firewall
A firewall that adds application awareness and content inspection to stateful filtering.
Host firewall
Firewall software that protects a single computer.

Common questions

What is the difference between drop and reject?

Drop discards a packet with no reply, so the sender sees only silence. Reject discards it and returns an error message. Drop gives an outsider less information, while reject lets legitimate clients fail faster.

Can a firewall inspect encrypted traffic?

Not by default. A firewall can see headers such as addresses and ports, but not the encrypted content. Some deployments decrypt traffic at the firewall using certificates the organisation controls, which adds cost and privacy considerations.

Why does rule order matter?

Because the first matching rule usually decides the outcome. A broad allow rule placed above a specific deny rule can permit traffic that the deny rule was meant to block.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.