AS216394 · WireShield

Technical Guide

What is a firewall? Types, how it works and its limits

A firewall passes or blocks traffic between networks according to rules. Learn the main firewall types, how a firewall differs from a WAF and where it falls short against DDoS attacks.

A firewall filters traffic from the internet and lets only allowed traffic reach servers in the internal network

A firewall is a security layer that passes or blocks traffic between networks or hosts with different security levels according to predefined rules. The US standards body NIST describes firewalls as devices or programs that control the flow of network traffic between networks or hosts with differing security postures. This guide explains what a firewall is, how it works, which types exist and why it cannot stop DDoS attacks on its own.

What is a firewall?

A firewall applies the answer to "who may come in and who may go out" as rules. Each rule has a condition (source and destination IP, port, protocol) and an action (allow, block). In a secure configuration the default behaviour is "block"; only required traffic is explicitly allowed.

Firewalls come in two forms: network firewalls (hardware or virtual appliances) that sit at the edge of a network, and host firewalls that run on a single server.

How does a firewall work?

Each incoming and outgoing packet is checked against the rule list from top to bottom; the first matching rule is applied. If no rule matches, the default action is applied. How deeply a firewall inspects traffic determines its type.

Types of firewalls

TypeWhat it looks atStrengthLimit
Packet filteringIP, port and protocol of each packetFast, simpleDoes not know the connection context
Stateful inspectionWhether a packet belongs to an existing connectionKeeps a connection table, drops forged repliesTable capacity is limited
Proxy / application gatewayContent of the application protocolDeep inspectionSlower, protocol-specific
Next-generation (NGFW)Application, user, intrusion signaturesRich visibilityMore expensive, complex to manage
Web application firewall (WAF)HTTP requests: URL, headers, cookies, bodyStops web attacks such as SQL injection and XSSWeb traffic only

We explained how a WAF works in what is a WAF.

What does a firewall protect?

  • Against unauthorised access: connections to closed ports are dropped.
  • Against unnecessary services being exposed: only the ports you need stay open.
  • Network segmentation: for example, it limits access from the user network to the server network.
  • Outbound traffic: it blocks suspicious external connections, such as a compromised device talking out.

Why can a firewall not stop DDoS attacks on its own?

A firewall sits behind your link. If attack traffic has filled the link, the packets are lost before they reach the firewall. Even in smaller attacks the problem is this:

  • The state table fills up. A stateful firewall keeps a record for every connection. Attacks such as a SYN flood fill this table with half-open connections and keep legitimate connections out. IETF's RFC 4987 describes how a SYN flood works.
  • Packet-processing power runs out. A high packet rate exhausts the device's CPU even when bandwidth is low.
  • Legitimate-looking requests get through. In layer 7 attacks each HTTP request looks normal on its own.

That is why a firewall is used together with DDoS protection, not instead of it. To stop volumetric and protocol attacks in front of your link, remote DDoS protection first routes traffic to a filtering network; for attacks that do not fill the link, WireShield Edge filters at your network edge. We compare the attack types in types of DDoS attacks.

Firewall vs WAF vs DDoS protection

FirewallWAFDDoS protection
LayerL3/L4 (up to L7 in an NGFW)L7 (HTTP)L3/L4 and L7
PositionNetwork edge or serverIn front of the web applicationIn front of the link or at the network edge
Typical targetAccess controlWeb application attacksAttacks that make a service unreachable
Against a volumetric attackInsufficientInsufficientIts main job

Best practices for firewall configuration

  1. Block by default. Allow only required traffic.
  2. Apply least privilege. Keep rules narrow and avoid "any" sources and destinations.
  3. Review rules regularly. Remove unused and outdated rules.
  4. Log and monitor. Blocked traffic shows possible scans.
  5. Keep software updated. The firewall itself is also an attack target.
  6. Document changes. Record who changed what and why.

NIST SP 800-41 is a reference that compares firewall types and offers guidance on writing and operating firewall policy.

Frequently asked questions

Is a firewall the same as antivirus?

No. A firewall filters network traffic with rules; antivirus finds malware on a device. They work at different layers and complement each other.

Is a firewall enough for security?

No. On its own it is not enough: it should be used with layers such as software updates, strong authentication, a WAF and DDoS protection.

Does a firewall stop a DDoS attack?

It can stop small and simple attacks. It falls short when the attack fills the link or exhausts the state table; for that, filtering has to happen in front of the link.

What is the difference between a WAF and a firewall?

A firewall looks at IP, port and protocol; a WAF looks at the content of the HTTP request. The first deals with access, the second with attacks on the web application.

Do I need a firewall in the cloud?

Yes. Cloud providers offer their own security groups, but these are access rules as well; web attacks and DDoS need separate protection.

Sources

Next step

Let us assess together where your firewall falls short against DDoS. Describe your network and traffic and we will suggest layered protection that fits. You can talk to the technical team.

All posts

Let’s review the right protection model for your network together.

Contact our team to talk through your technical needs.