internetuntrustedprotected44322ALL:22:80:443:3306SYN :443SYN-ACKACK :3306pingecho replySYN-ACK :22RST :80SYN-ACK :443RST :3306:22 SSH:443 HTTPS
Envelope seal: who sent it (pink scanner, blue visitor, green server); the tag shows its port or flagsYellow tablet: the rule table, read top to bottom (green allow, coral deny all)Purple tablet: the state table, one bar per open connectionRed ×: dropped, no reply sentWith no firewall checking, a ping sweep finds 203.0.113.10 alive and SYN probes to 22, 80, 443, 3306 all reach it: SYN-ACK answers mark 22 and 443 open, RST answers mark 80 and 3306 closed. Then the same SYNs meet a firewall whose rules are read top to bottom: allow 443 from anyone, allow 22 only from 198.51.100.0/24, and the implicit deny all. Only 443 answers; the rest get silence. The firewall is stateful: the visitor's allowed SYN writes a row, the reply passes by that row, and a forged reply that matches no row is dropped. 203.0.113.10, 192.0.2.7, 192.0.2.66 and 198.51.100.0/24 are RFC 5737 documentation addresses; client port numbers are illustrative.

The attack, as the server sees it

  1. Attacks start with mapping. The server first sees a sweep: a ping (an ICMP echo request) sent to every address in 203.0.113.0/24. Hosts are expected to answer pings (RFC 1122), and nothing filters them here, so its echo reply marks 203.0.113.10 as alive.

The scan meets a firewall

Stateful

Layers

The packets and rules, field by field

;; step 1/13 · sweep · scan
;; scanner → server
ICMP  192.0.2.66 → 203.0.113.1 … 203.0.113.254   type 8 echo request
      one probe per address: who is there?
ICMP  203.0.113.10 → 192.0.2.66   type 0 echo reply   ← live host
why it was answered: RFC 1122 §3.2.2.6 says hosts MUST answer
  echo requests (many still drop them); nothing filtered it
what the defender sees: one source touching many addresses
  in a short time, the fingerprint of a sweep
a sweep may use TCP probes instead; any answer, even a RST,
  proves a machine is at that address

Dropping silently is the usual choice for internet-facing rules. A firewall may instead reject (answer with a RST or an ICMP error), which is friendlier for honest clients but tells a scanner the firewall is there. Because the first match wins, put specific rules above broad ones. A broad allow placed first makes every rule below it dead.