Bookmarks

Firewall

A device or program that passes traffic between networks according to rules and tracks the state of connections instead of judging each packet in isolation.

Also: network firewall, packet filter, firewall appliance, security gateway

checked 9 Nov

All terms

A firewall sits on the boundary between networks, such as the internet and an internal network, or segments of a data centre, and decides for each packet whether to pass or drop it. The decision is made by rules: which addresses and ports are allowed, in which direction a connection may be opened, and what to do with packets that no rule describes.

Stateful inspection

The main difference between a modern firewall and a simple filter is the connection table. When a computer on the internal network opens a connection, the firewall remembers it and lets the reply packets through automatically, without separate rules for each case. A packet from outside that pretends to be a reply to a nonexistent connection does not match the table and is dropped. NIST calls this approach stateful inspection, as opposed to simple packet filtering (stateless): a stateless filter compares each packet with the rules on its own, so allowing outgoing connections while denying incoming ones are two mutually exclusive tasks for it.

CriterionStateless filterStateful firewall
What it seeseach packet on its ownthe packet and the connection it belongs to
Reply packetsmust be allowed by separate rulespassed on the strength of a connection table entry
Speedsimple, predictable processingmemory for the table, an entry lookup for every packet
Where it is foundACLs on switches and routersnetwork edge, routers, server operating systems

Where you find them

  • personal: built into the OS, such as Windows Firewall, or firewalld and nftables on Linux;
  • perimeter: on a router or a standalone device between the network and the internet; on Linux routers the role is played by nftables and iptables, and in RouterOS by the /ip firewall filter rules;
  • next-generation firewall (NGFW): adds application recognition, a built-in intrusion prevention system (IPS) and TLS inspection;
  • WAF: a firewall for web applications that parses HTTP requests and catches SQL injection and other application-layer attacks;
  • cloud: security groups and network ACLs, configured with rules in the cloud console.

Example rules

bashMikroTik: pass reply packets and block SSH from outside into the internal network
/ip firewall filteradd chain=forward action=accept connection-state=established,relatedadd chain=forward action=drop connection-state=invalidadd chain=forward action=drop connection-state=new in-interface=ether1 dst-port=22 protocol=tcp

The default rule is “deny everything that is not explicitly allowed” (NIST calls this deny by default). Rule order matters: the first matching rule decides the packet’s fate.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • WAFweb application firewall

    A WAF works at the application level and parses HTTP requests to a web application, whereas a firewall works with packets and connections.

  • IDSintrusion detection system

    An intrusion detection system (IDS) only notices suspicious traffic and raises an alert; a firewall also blocks it.

  • NATnetwork address translation

    NAT rewrites addresses and ports in packets, whereas a firewall decides whether to pass a packet; they are often the same device, but the tasks are different.

In depth in the references

where the topic is covered in detail

Appears in the references