Skip to content

DMZ Network Diagram: Screened Subnets, Firewalls and Reverse Proxies

How a DMZ works: one firewall or two, the traffic rules between zones, what belongs in a screened subnet, reverse proxies, cloud equivalents and zero trust.

· Founder & developer

Published

Network diagram, left to right: Internet, outer firewall, DMZ with a mail relay and a reverse proxy with WAF, inner firewall, internal servers and a data subnet with Postgres. Green edges mark allowed ports; a red dashed edge from the proxy stops at the inner firewall.

Your marketing site runs on a VM in the server room, on the same network as the file server and the finance database. One unpatched plugin later, someone has a shell on that VM, and nothing stands between that shell and the rest of the network.

A DMZ fixes that. Hosts that must accept connections from the internet live in their own segment, and the rules assume those hosts will be breached. This post covers the two common designs, the traffic rules, what belongs in a DMZ, reverse proxies, cloud equivalents and zero trust.

What a DMZ is

In NIST's glossary entry for demilitarized zone, CNSSI 4009 calls a DMZ a "perimeter network segment that is logically between internal and external networks", and NIST SP 1800-16 calls it "a perimeter network or screened subnet". NISTIR 7711 describes "a network created by connecting two firewalls", while NIST's firewall guide describes an extra interface on one routing firewall. Either way, three rules apply:

  1. The internet reaches the DMZ on the published ports only.
  2. The DMZ reaches very little inside, and only on named host and port pairs.
  3. The internet never reaches the internal network directly.

One firewall or two

In the three-legged design, one firewall has three interfaces (outside, DMZ, inside) and one policy covers all three zones. In the two-firewall design, also called back-to-back, an outer firewall guards the DMZ and an inner firewall guards the internal network.

Three-legged firewall Two firewalls
Cost One device (or HA pair), one policy Two devices (or pairs), two policies, two log sets
One bad rule Can expose the internal network Still meets the second firewall
One firewall vulnerability Exposes all three zones Exposes the DMZ; the inner layer holds unless it shares the flaw
Availability One device in the path Two in series, both must be up
Typical fit Small and mid-size sites, branches Regulated data, separate network and security teams

A well-run single firewall beats two neglected ones, but it is the only control. Layers cost something too: NIST SP 800-41 Rev. 1, NIST's firewall guide, warns that an inner firewall built on assumptions about the outer one exposes its hosts when the outer policy changes, and recommends duplicating the relevant outer rules on the inner firewall.

DMZ firewall rules

Start from deny by default. SP 800-41 says firewalls "should block all inbound and outbound traffic that has not been expressly permitted by the firewall policy", for IPv4 and IPv6 alike. Then allow named flows between named hosts:

From → To Allow Everything else
Internet → DMZ TCP 443 to the reverse proxy, TCP 25 to the mail relay Deny, log
Internet → internal Nothing Deny, log
DMZ → internal Proxy to app servers on TCP 8443, relay to mail server on TCP 25 Deny, alert
Internal → DMZ SSH from admin hosts, deployments from the pipeline Deny, log
DMZ → Internet DNS, NTP, updates through an egress proxy, outbound mail from the relay Deny, alert

Two habits keep the matrix honest:

  • Write rules host to host. "Proxy to app servers on 8443" is a rule; "DMZ to internal on 8443" lets every DMZ host try.
  • Restrict egress. An attacker on a DMZ host wants to download tools and reach a command server, so allow little beyond DNS, NTP and an update mirror.

On Linux, the inner firewall from the diagram below fits in a few lines of nftables; anything not listed is logged and dropped:

table inet inner_fw {
  chain forward {
    type filter hook forward priority 0; policy drop;
    ct state vmap { established : accept, related : accept, invalid : drop }
    ip saddr 172.16.10.10 ip daddr { 10.0.10.11, 10.0.10.12 } tcp dport 8443 accept  # proxy to app servers
    ip saddr 172.16.10.20 ip daddr 10.0.10.25 tcp dport 25 accept  # relay to mail server
    log prefix "inner-fw deny: " counter drop
  }
}

What belongs in the DMZ, and what never does

SP 800-41 notes that public-facing servers, such as web and email servers, commonly sit in the DMZ. A host belongs there only if the internet must reach it; for public APIs, that is an API gateway at the edge, not the services behind it.

System In the DMZ? Why
Reverse proxy or load balancer with a WAF Yes Terminates TLS, forwards to one port, holds no data
Inbound mail relay Yes Accepts SMTP from anyone, forwards to one server
VPN gateway Often Must answer IKE on UDP 500 and NAT traversal on UDP 4500
Databases Never The data is what attackers came for
Domain controllers Never They hold the keys to every account
Secrets stores, CI/CD, backups Never Each can reach or rebuild everything else

Never join DMZ hosts to your Active Directory domain. That means opening Kerberos (88), LDAP (389 and 636), SMB (445) and RPC (135 plus 49152–65535) to your domain controllers, per Microsoft's port reference, and turns the inner firewall into a formality. Use local accounts and authenticate users at the proxy. The site-to-site VPN diagram covers VPN gateways.

The reverse proxy pattern

Put a reverse proxy in the DMZ and keep the application inside. The proxy terminates TLS, applies WAF rules and rate limits, and forwards to the app servers on one port. With no business logic and no database credentials, a breached proxy is a host that reaches the app servers on 8443 and nothing else. An application in the DMZ would need a path to its database, exactly what the DMZ exists to close.

Encrypt the inner leg too, ideally with mutual TLS. The proxy passes the client's address in the Forwarded header (RFC 7239) or X-Forwarded-For; the RFC warns that the header "cannot be relied upon to be correct", so trust only the entry your own proxy added. The load balancer diagram covers TLS termination.

DMZs in the cloud

In AWS, a public subnet is one whose route table has a direct route to an internet gateway. Put only load balancers and NAT gateways there, and instances in private subnets.

Subnets are not firewalls; the rules on each resource are. Every AWS route table has a local route for traffic within the VPC, and every Azure network security group starts with a default rule, AllowVNetInBound (Azure NSG overview), that admits the whole virtual network, including peered networks and connected on-premises ranges. At the time of writing (November 2026), the pieces map like this:

DMZ piece AWS Azure Google Cloud
Reverse proxy and WAF Application Load Balancer with AWS WAF Application Gateway with WAF External Application Load Balancer with Cloud Armor
Per-resource rules Security groups Network security groups VPC firewall rules
Managed network firewall AWS Network Firewall Azure Firewall Cloud NGFW

In AWS's comparison, security groups are stateful and allow-only; network ACLs apply per subnet, are stateless and can deny. "From proxy only" becomes an app-tier security group rule allowing 8443 from the load balancer's security group. Mind egress: a new security group allows all outbound traffic. The guide to public and private subnets in a VPC covers route tables.

Monitoring the DMZ

Log every deny on both firewalls and ship the logs to a collector inside (syslog over TLS on TCP 6514, RFC 5425), a third DMZ → internal rule the diagram leaves out. Alert on any deny that starts in the DMZ, and read the WAF logs: attacks on 443 pass the firewall by design. From outside, only 443 and 25 should answer; scan to confirm.

A DMZ is not enough on its own

A DMZ guards one line, at the edge. A phished laptop or a stolen VPN password lands behind the inner firewall, and the DMZ never sees it. NIST SP 800-207 describes the alternative: zero trust "assumes there is no implicit trust granted to assets or user accounts based solely on their physical or network location".

Zero trust changes what sits behind the DMZ: mutual TLS to the app, internal segmentation like the data subnet, and per-request checks on user and device. The zero trust architecture diagram shows the policy engine and enforcement points.

The DMZ network diagram

Network diagram, left to right: Internet, outer firewall, DMZ with a mail relay and a reverse proxy with WAF, inner firewall, internal servers and a data subnet with Postgres. Green edges mark allowed ports; a red dashed edge from the proxy stops at the inner firewall.

18 components · 9 connections

Open in Archboard
Diagram contents
  • Internet
  • Outer firewall
  • DMZ (screened subnet)
  • Mail relay
  • Reverse proxy + WAF
  • Inner firewall
  • Internal servers
  • Mail server
  • App servers
  • Data subnet
  • Postgres
  • all inbound traffic
  • TCP 25 (SMTP)
  • TCP 443 (HTTPS)
  • TCP 25
  • TCP 8443, TLS
  • from relay only
  • from proxy only
  • TCP 5432
  • TCP 5432 to Postgres: denied
A DMZ between two firewalls. The outer firewall publishes only HTTPS to a reverse proxy and SMTP to a mail relay. The inner firewall lets each of them reach one internal server on one port, so a breached DMZ host still has no path to the database.

How to read it:

  • Trust rises from left to right: untrusted internet, semi-trusted DMZ, trusted internal subnets.
  • Green edges are allowed flows: the outer firewall passes only TCP 443 to the reverse proxy and TCP 25 to the mail relay.
  • The inner firewall passes two flows: proxy to app servers on 8443 and relay to mail server on 25. Only the app servers reach Postgres on 5432.
  • The red dashed edge is what the design exists to stop: a DMZ host trying Postgres on 5432 ends at the inner firewall.
  • The Markdown block holds the rule matrix.

Drawing DMZ network diagrams clearly

  • Draw each zone as a container with its CIDR and a trust color. No edge from the internet or the DMZ should skip a firewall.
  • Label every edge with protocol and port, drawn from the side that opens the connection.
  • Draw at least one denied path. Reviewers can check the rules against it.
  • Leave out switches, cabling and HA pairs. Draw the physical layout separately, like the network topology diagram.
  • Avoid the classic mistakes: an arrow from the internet straight to an app server, a database in the DMZ "temporarily", edges labeled "any", and no egress rules.

Build it in Archboard

  1. Sign in with Google or GitHub and create a network diagram.
  2. From the Network pack, add an Internet node on the left and two Firewall nodes, labeled Outer firewall and Inner firewall.
  3. Between the firewalls, add a Subnet from the Network pack labeled DMZ (screened subnet), CIDR 172.16.10.0/24. Inside it, add a Server labeled Mail relay and a WAF from the Security pack labeled Reverse proxy + WAF.
  4. Right of the inner firewall, add a Subnet labeled Internal servers (10.0.10.0/24) with two Server nodes, Mail server and App servers. Below it, add a Subnet labeled Data subnet (10.0.20.0/24) with a Postgres node from the Data pack.
  5. Draw a gray edge labeled "all inbound traffic" from Internet to the outer firewall, then solid green edges labeled "TCP 25 (SMTP)", "TCP 443 (HTTPS)", "TCP 25", "TCP 8443, TLS", "from relay only", "from proxy only" and "TCP 5432", following the picture left to right.
  6. Draw a dashed red edge from the proxy to the bottom of the inner firewall, labeled "TCP 5432 to Postgres: denied", with a cross at the end.
  7. Add a Markdown block from the Core pack with the rule matrix, plus Text labels for the three trust zones, the two firewalls and the DMZ.

If your cloud version lives in Terraform, the Terraform to diagram tool makes a first draft. The example uses 12 diagram nodes, within the Free plan.

FAQ

What is a DMZ in networking? A network segment between the internet and your internal network for hosts that must accept outside connections, such as a reverse proxy or mail relay. The internet reaches them on a few ports; they reach almost nothing inside.

Is a screened subnet the same as a DMZ? Yes. NIST SP 1800-16 defines a DMZ as a perimeter network or screened subnet, so the three terms name the same segment.

Do you need two firewalls for a DMZ? No. One firewall with three interfaces also creates a DMZ. A second firewall adds a layer against a bad rule or a firewall bug, at the cost of a second policy to maintain.

Can a database go in the DMZ? No. The DMZ is where you expect breaches, and the database holds what attackers want. Keep it inside, reachable only from the application servers.

Do you still need a DMZ in the cloud or with zero trust? Yes. Keep internet-facing entry points in their own subnet and everything else private. Zero trust adds identity checks behind that edge; it does not replace it.

Start free — one seat, no credit card.

Related posts

← Back to blog

Open a canvas in a minute

Sign in with Google or GitHub. Free for a single seat. Upgrade when the team joins.