---
title: "DMZ networks explained: zones, rules and when to use one · CloudSat"
description: "What a DMZ is, which servers belong in it, the traffic rules between internet, DMZ and internal zones, a Linux router example, and the cloud equivalent."
url: https://cloudsat.io/learn/dmz-network-zones-and-rules
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Networking](https://cloudsat.io/learn/topic/networking-and-dns)

# DMZ networks explained: zones, rules and when to use one

What a DMZ is, which servers belong in it, the traffic rules between internet, DMZ and internal zones, a Linux router example, and the cloud equivalent.

CloudSat team November 18, 2026 7 min read

A DMZ, short for demilitarized zone, is a network segment for the machines that must accept connections from the internet, kept apart from everything that should not. Vendors also call it a perimeter network or a screened subnet. The idea is simple: when a public-facing server is broken into, and public-facing servers are the ones that get broken into, the intruder lands in a zone that can reach almost nothing else. This guide covers the rules that make a DMZ work, a working Linux router example, and how the same thinking applies to cloud servers.

## Three zones and a traffic matrix

A classic design has three zones:

- **Internet:** untrusted, everything outside your control.
- **DMZ:** the services the public must reach, trusted only a little.
- **Internal:** staff devices, databases, directory services, file shares and backups.

A DMZ is defined less by its cabling than by the traffic allowed between zones. Write it down as a matrix before you configure anything:

| From / to | Internet | DMZ | Internal |
| --- | --- | --- | --- |
| **Internet** |  | Published ports on named hosts only | Nothing |
| **DMZ** | Only what the services need: DNS, time, updates | Only between services that talk to each other | Nothing, except a few named host and port pairs |
| **Internal** | Through your normal outbound policy | Administration and application traffic |  |

The pattern behind it: connections flow from more trusted zones toward less trusted ones. Every flow in the other direction is an exception with an owner and a reason. The most important cell is DMZ to internal. If it says "anything", you built a second LAN, not a DMZ.

## Where the firewalls go

Two layouts dominate:

|  | One firewall, three interfaces | Two firewalls in series |
| --- | --- | --- |
| Layout | One device with internet, DMZ and internal ports | A front firewall between internet and DMZ, a back firewall between DMZ and internal |
| Cost and effort | One device, one rule set | Two devices, two rule sets |
| If the firewall is misconfigured or compromised | Both boundaries fall at once | The second boundary still holds |
| Typical home | Small offices, labs, branch sites | Larger networks and regulated environments |

Some organizations pick different vendors for the two firewalls, so that one software flaw cannot open both. Whichever layout you choose, the matrix above is the specification and the firewall is only its implementation.

## What belongs in the DMZ, and what never does

Good DMZ residents are machines whose job is to face the internet and pass work inward through a narrow channel:

- reverse proxies and load balancers,
- public web front ends that hold no sensitive data,
- mail relays that accept internet mail and hand it to an internal mailbox server,
- authoritative DNS servers for your public zones,
- file transfer endpoints for partners, ideally SFTP.

Keep these out: databases with real data, directory services such as Active Directory domain controllers, file shares, backup servers, admin workstations and the log collector. If DMZ hosts must ship logs inward, allow one port to one collector and nothing more.

The cleanest split puts only the reverse proxy in the DMZ, with the application and its database inside. The proxy's single connection to the application port then becomes the only DMZ-to-internal rule you maintain.

## The home router's "DMZ host" is not a DMZ

Consumer routers offer a DMZ setting that forwards every unsolicited inbound port to one device on your LAN. The device stays on the same network as your laptops and phones. That is the opposite of isolation: the device is fully exposed to the internet and one hop from everything else. Use specific port forwards instead, or give exposed devices a separate network, such as a router interface or VLAN with its own firewall rules.

## A DMZ on a Linux router with nftables

Take a Linux router with three interfaces: `wan0` toward the internet, `dmz0` for `10.0.50.0/24` with a reverse proxy at `10.0.50.10`, and `lan0` for `10.0.10.0/24` with an application server at `10.0.10.20`. Build this from a console session or with a scheduled rollback, because a wrong forward policy can cut you off. Forwarding must be on (`net.ipv4.ip_forward = 1` in a file under `/etc/sysctl.d/`).

```text
table inet filter {
    chain forward {
        type filter hook forward priority filter; policy drop;
        ct state established,related accept
        ct state invalid drop

        # internet -> DMZ: web traffic to the reverse proxy only
        iifname "wan0" oifname "dmz0" ip daddr 10.0.50.10 tcp dport { 80, 443 } accept

        # DMZ -> internal: the proxy may reach one application port, nothing else
        iifname "dmz0" oifname "lan0" ip saddr 10.0.50.10 ip daddr 10.0.10.20 tcp dport 8080 accept

        # DMZ -> internet: DNS, time and package updates
        iifname "dmz0" oifname "wan0" udp dport { 53, 123 } accept
        iifname "dmz0" oifname "wan0" tcp dport { 53, 80, 443 } accept

        # internal -> anywhere, tighten as needed
        iifname "lan0" accept
    }
}

table ip nat {
    chain prerouting {
        type nat hook prerouting priority dstnat;
        iifname "wan0" tcp dport { 80, 443 } dnat to 10.0.50.10
    }
    chain postrouting {
        type nat hook postrouting priority srcnat;
        oifname "wan0" masquerade
    }
}
```

Destination NAT happens before the forward chain, which is why the first rule can match the proxy's private address. The `policy drop` line implements every empty cell of the matrix. The router's own input chain needs a policy of its own, with SSH accepted from the LAN only. Check the file with `sudo nft -c -f /etc/nftables.conf` before you load it.

## The same idea on cloud servers

Cloud servers rarely share a physical segment, so zones are built from firewall rules, private addresses and tunnels. The matrix carries over unchanged. Public-facing servers admit web ports from anywhere. Private servers admit nothing from the internet, only the proxy's tunnel or private address on the ports it needs. Admin access arrives through a VPN. [Layered security for cloud servers](https://cloudsat.io/learn/layered-security-for-cloud-servers) draws a full reference layout with WireGuard.

The cell people forget is DMZ to internet. On CloudSat, [cloud firewalls](https://cloudsat.io/docs/cloud-firewalls) filter inbound traffic only, so the outbound limits for a DMZ-role server belong in its own firewall, for example with UFW's `default deny outgoing` and a few allow rules, as shown in [UFW in practice](https://cloudsat.io/learn/ufw-commands-rule-order-profiles-logs).

## When a DMZ is the wrong tool

A DMZ protects against attacks that start at the edge. It does little once an attacker is already inside, for example through a phished laptop on the internal network. Three newer patterns cover those gaps:

- **Segmentation inside the internal zone,** so a compromised laptop cannot reach the database servers directly.
- **Identity-aware access to internal applications,** often called zero trust network access, where every connection is authenticated instead of trusted for its source network.
- **Outbound-only connectors,** where an application dials out to an edge service and accepts no inbound connections at all.

None of these makes the DMZ obsolete for an office or a site that hosts public services itself. They answer a different question: what happens after the first machine falls.

## FAQ

### Is a DMZ just another name for a firewall?

No. A DMZ is a zone; firewalls enforce the boundaries around it. A firewall with no DMZ behind it can still protect a network, but every public service then sits next to internal machines.

### Should DMZ servers use private or public addresses?

Either works. Private addresses behind destination NAT add a small hurdle, but the firewall rules do the real work. With IPv6 there is usually no NAT at all, so the forward rules must be just as strict for both address families.

### Can a web server in the DMZ query the internal database?

Only through one narrow rule from that server to the database port, and only if the design truly needs it. Better: keep the application and database inside and let the DMZ hold just the reverse proxy.

### Is a separate VLAN enough to make a DMZ?

Not on its own. A VLAN separates traffic at layer 2. It becomes a DMZ only when traffic between it and other VLANs passes through a firewall that enforces the matrix. A core switch routing between VLANs with no access lists gives you no DMZ.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Networking](https://cloudsat.io/learn/topic/networking-and-dns)

- [Hardware vs software firewalls, and where cloud firewalls fit](https://cloudsat.io/learn/hardware-software-cloud-firewalls): Security Hardware vs software firewalls, and where cloud firewalls fit 6 min read
- [Cloud security architecture: a layered design for VPS apps](https://cloudsat.io/learn/layered-security-for-cloud-servers): Security Cloud security architecture: a layered design for VPS apps 6 min read
- [UFW commands in practice: rule order, profiles and logs](https://cloudsat.io/learn/ufw-commands-rule-order-profiles-logs): Security UFW commands in practice: rule order, profiles and logs 8 min read
- [Cloud networking explained: VPCs, subnets, gateways and CDNs](https://cloudsat.io/learn/cloud-networking-building-blocks): Networking Cloud networking explained: VPCs, subnets, gateways and CDNs 7 min read
