Start with an allowlist
A service with firewall rules uses an inbound allowlist. Add only the protocols, ports and source networks you need. Unmatched inbound traffic is denied.
Common ports
SSH commonly uses TCP 22, HTTPS uses TCP 443 and Remote Desktop uses TCP 3389. Use a specific source address for administrative access, and use 0.0.0.0/0 only for intentionally public services.
Test before you leave
Keep the console available while changing firewall rules. Confirm that your applications and management connections still work before ending your session.