SimulatorUnit 3 · Topic 3.4

Firewall rules: first match wins

Order firewall rules and test packets: the first match wins.

New to this? Read the topic first: 3.4 Protecting Networks.

Simulation · Firewall rule order [3.4.B.2, 3.4.D.3]

Simulator: first match wins

You manage the firewall in front of the school web server (10.0.1.20). Test the queued traffic against the policy, then change the rule order and test again.

edge-fwFirewall managementOnline
Inbound policy · checked top to bottom, first match wins
Rule numberActionSourceDestinationDirectionPort numberProtocolHitsMove
Deny 198.51.100.0/2410.0.1.20Inbound443HTTPS 0
Allow ALL10.0.1.20Inbound443HTTPS 0
Allow 10.0.5.0/2410.0.1.20Inbound3389RDP 0
Deny ALLALLInboundALLALL 0
Live test results4 connections queued
TimeSourcePortActionMatched ruleNote
08:14:02192.0.2.20443/HTTPS Allow 2 student at home opening the school site
08:14:05198.51.100.7443/HTTPS Deny 1 server in the known bad range
08:14:0910.0.5.123389/RDP Allow 3 network admin, remote desktop
08:14:11192.0.2.453389/RDP Deny 4 stranger trying remote desktop
Traffic log · every connection, newest last
TimeInterface (in)SourceDestinationPort numberProtocolActionRule number
08:14:02outside192.0.2.2010.0.1.20443HTTPS Allow 2
08:14:05outside198.51.100.710.0.1.20443HTTPS Deny 1
08:14:09mgmt10.0.5.1210.0.1.203389RDP Allow 3
08:14:11outside192.0.2.4510.0.1.203389RDP Deny 4
Interfaces · rules are checked as traffic enters (ingress)
InterfaceFacesIP addressStatusIn (ingress)DroppedOut (egress)
outsideInternet203.0.113.2/30 Up 320
insideSchool LAN (web server 10.0.1.20)10.0.1.1/24 Up 002
mgmtAdmin network10.0.5.1/24 Up 100

Connections from the internet enter on outside; the admin's remote desktop enters on mgmt. Allowed connections leave on inside toward the web server. Denied ones are dropped where they entered and never reach the LAN.

HTTPS: Hypertext Transfer Protocol Secure. RDP: remote desktop protocol. mgmt: management. 198.51.100.0/24 covers 198.51.100.0 to 198.51.100.255.

Walkthrough: what happens if rules 1 and 2 are swapped?

With "Allow port 443 from ALL" first, the connection from 198.51.100.7 matches it immediately and is allowed. The deny rule for the bad range is never reached. Specific rules must come before broad ones [3.4.D.3].

Go to the topic: 3.4 Protecting Networks

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

Course map
↑ Top

Enlarged view of the selected figure