Firewall rule order simulator
Reorder and disable rules on a first-match firewall until every test packet gets the verdict the policy asks for, and see which rule decided each one.
Goal
The perimeter firewall checks rules top to bottom and stops at the first match. Anything that matches no rule is dropped by the default deny.
The policy: anyone may reach the web server on 80 and 443, only the admin network may use SSH, only the web server may reach the database, and the abusive range is blocked everywhere. Three test packets get the wrong verdict today.
- allowweb
tcp any → 10.0.1.10/32 port 80,443Public web traffic - allowssh-any
tcp any → any port 22Temporary SSH rule from a migration - denyblocklist
any 198.51.100.0/24 → anyKnown abusive range - allowssh-admin
tcp 10.0.9.0/24 → 10.0.1.10/32 port 22SSH from the admin network - allowapp-db
tcp 10.0.1.10/32 → 10.0.2.20/32 port 5432Web app to its database - allowdb-any
tcp any → 10.0.2.0/24 port 5432Database subnet, added during an outage - denydefault deny
any any → any
| Packet | Flow | Policy wants | Firewall says | Decided by |
|---|---|---|---|---|
| p1Visitor loads the site over HTTPS | tcp 203.0.113.5 → 10.0.1.10:443 | allow | allow | web |
| p2Visitor hits plain HTTP (redirected to HTTPS) | tcp 203.0.113.9 → 10.0.1.10:80 | allow | allow | web |
| p3Internet host tries SSH on the web server | tcp 203.0.113.5 → 10.0.1.10:22 | deny | allow ✕ | ssh-any |
| p4Admin workstation opens SSH | tcp 10.0.9.14 → 10.0.1.10:22 | allow | allow | ssh-any |
| p5Blocklisted host requests the site | tcp 198.51.100.77 → 10.0.1.10:443 | deny | allow ✕ | web |
| p6Web app queries the database | tcp 10.0.1.10 → 10.0.2.20:5432 | allow | allow | app-db |
| p7Internet host connects to the database | tcp 203.0.113.5 → 10.0.2.20:5432 | deny | allow ✕ | db-any |
| p8Internet host sends an SNMP query | udp 203.0.113.5 → 10.0.1.10:161 | deny | deny | default deny |
Steps
01Reorder and disable rules until all eight test packets get the verdict the policy asks for.
Do this in the workbench above. This step completes itself when the condition is met.
02Before any change, which rule lets the blocklisted host reach the site?
03Which rule has to go so that internet hosts cannot open SSH?
04Packet p8 (UDP 161) matches no rule at all. What decides it?