Tutorials · Security

How to Write Firewall Rules That Actually Protect You

Default-deny, least privilege and clean rule bases: practical rules for any firewall or gateway.

Intermediate14 min6 steps

Before you start

  • Admin access to your firewall
  • A list of applications and who needs them

Step by step

  1. Start from default deny

    Block everything inbound and between zones, then allow only what is required.

  2. Define zones

    For example WAN, LAN, Servers, Guests, CCTV and Management, with clear rules between each pair.

  3. Be specific

    Use exact source, destination and service. Avoid 'any any any' rules.

  4. Order rules carefully

    Put specific rules before general ones, and keep a final explicit deny-and-log rule.

  5. Restrict outbound too

    Allow common business ports outbound and block risky services such as outbound SMB and Telnet.

  6. Review regularly

    Remove unused rules and check hit counts every quarter. Document the business reason for each rule.

Pro tips

  • Never expose RDP, SSH or device admin pages directly to the Internet; use a VPN.
  • Enable intrusion prevention and application control where available.
How to Write Firewall Rules That Actually Protect You | Navijin Tutorials