Security notice: Synology owners, install the latest DSM update now. It blocks the sign-in exploit used by the C3RB3R ransomware. What to do →

Blog · Security

Synology firewall rules: how to set up the DSM 7 firewall without locking yourself out (2026)

DSM ships with a perfectly decent firewall, switched off, tucked three clicks deep in Control Panel. Turning it on takes one checkbox. Turning it on well takes four rules in the right order, which is where most people go wrong. Here's the setup we'd use, real screenshots from DSM in our lab, and the one mistake that turns a security upgrade into a long walk to the NAS with a paper clip.

Updated November 23, 2026 · 8 min read

TL;DR

  • Where: Control Panel → Security → Firewall → tick Enable firewall → Edit Rules on the default profile.
  • Order matters: rules run top to bottom, first match wins. Allow rules first, one Deny all rule last.
  • Rule 1 is always your LAN subnet. Skip it and the firewall's first victim is you.
  • Country blocking (Source IP → Location) is great for noise on forwarded ports. It's a filter, not a lock.
  • Pair it with Auto Block, 2FA and a patched DSM. Better still, forward nothing and there's nothing for the rules to defend.
How DSM's firewall reads your rules: top to bottom, first match wins
Diagram: three incoming connections checked against four Synology firewall rules in order. A laptop on the LAN matches rule 1, allow LAN subnet. A phone abroad on VPN port 1194 from your country matches rule 3, allow. A scanner from elsewhere matches nothing until rule 4, deny all, and is dropped. Incoming Laptop at home 192.168.1.23 → 5001 You, on mobile data your country → 1194 UDP Random scanner elsewhere → 5000 Your rule list (Edit Profile "default") 1 · AllowAll ports · source: LAN subnet The rule that keeps you in. 2 · AllowAll ports · source: VPN client subnet Only if you run VPN Server. 3 · AllowForwarded port only · source: your country Only if something is forwarded on the router. 4 · DenyAll ports · source: all The bouncer. Always last. ✓ ✓ ✗ Put rule 4 at the top and all three connections are dropped, including yours. Order is the whole game.
An example rule set. Your LAN range may be 192.168.0.x or 10.0.0.x; check it in Control Panel → Network.

Where the Synology firewall lives in DSM 7

Open Control Panel → Security and pick the Firewall tab. On a fresh DSM you'll find Enable firewall unticked, a Firewall Profile called default, and an Edit Rules button. Notifications are worth keeping on: when an app gets blocked, DSM tells you and offers to unblock it, which beats an afternoon of wondering why Plex went quiet.

A profile is just a named list of rules. You can keep several (say, “home” and “travel”) and switch between them from the dropdown, but one well-built default profile is all most people need.

Synology DSM 7 firewall Edit Profile dialog with an empty firewall rules list, All interfaces selector, and notes that rules at the top have higher priorities
Control Panel → Security → Firewall → Edit Rules, captured today in our DSM lab. Read the two notes at the bottom: they're the entire rulebook.

Those two notes are DSM telling you how it thinks: rules at the top have higher priority (drag and drop to reorder), and rules under “All interfaces” are checked before the rules of each individual interface (LAN 1, LAN 2, a VPN interface…). In practice: build everything under All interfaces unless you have a NAS with several networks and a reason to treat them differently.

Creating a firewall rule: ports, source, action

Click Create and you get one small dialog with three questions. That's the whole firewall:

Synology Create Firewall Rules dialog in DSM 7 with Ports (all, built-in applications, custom), Source IP (all, specific IP, location) and Action (allow or deny)
The Create Firewall Rules dialog from our DSM lab, untouched defaults: all ports, all sources, Allow.

Notice the defaults: all ports, all sources, Allow. Clicking OK on an untouched dialog creates a rule that lets the entire internet in. It's the firewall equivalent of a door that's locked unless you push it.

The rule set we'd use (and why in this order)

Here's a sensible baseline for a home or small-office NAS. Build it under All interfaces, top to bottom:

#PortsSource IPActionWhy
1AllSubnet 192.168.1.0 / 255.255.255.0 (your LAN)✓AllowYour own network gets in. This is the rule that stops you locking yourself out
2AllYour VPN client subnet (if you run VPN Server)✓AllowVPN users arrive from the VPN's own range, not your LAN's
3Only what you forward (e.g. OpenVPN 1194 UDP)Location → your country✓AllowOptional. Only needed if a port is forwarded on the router
4AllAll✗DenyEverything that didn't match above is dropped
  1. Find your LAN subnet first. If your computer is 192.168.1.23, your subnet is almost certainly 192.168.1.0 with mask 255.255.255.0. Enter it under Source IP → Specific IP → Subnet.
  2. Add the Allow rules, LAN first. If you run Container Manager, containers on a bridge network talk to DSM from Docker's private range (often 172.17.x.x), so allow that range too or your containers may lose access to the NAS.
  3. Add Deny all last: ports All, source All, action Deny.
  4. Check the order, drag if needed, click OK, then Apply. Test from your computer, and from a phone on mobile data if you forward anything.

Do this from a computer on your LAN, not over a remote session. Building a firewall remotely is like sawing off the branch you're sitting on, carefully, with excellent technique.

Blocking countries (Location rules)

The Location source lets you allow or deny by country. The classic recipe is in rule 3 above: allow your forwarded port from your own country only, and let rule 4 drop everyone else. It cuts a lot of the automated noise in your logs, because most opportunistic scanning comes from wherever the cheapest servers are.

Keep expectations honest, though. Country is worked out from IP geolocation, which is occasionally wrong, and an attacker who cares can rent a server in your country for the price of a sandwich. Geo-blocking is a filter for the lazy, not a wall for the determined. It also locks you out the day you travel, so remember it before you board the plane.

Auto Block, account protection, and the rest of the Security page

The firewall decides who can knock. The Protection tab next door decides what happens when they knock wrong. Turn on Auto Block so an IP that fails too many sign-ins in a few minutes gets blocked, and keep your own addresses on its allow list. Add 2-factor sign-in for admin accounts, and let Security Advisor run its scan: it flags the classic mistakes (default admin account, weak passwords, outdated DSM) in plain language.

And patch. A firewall rule that allows port 5001 from your country will happily let a sign-in exploit from your country through. Outdated Synology boxes with exposed logins are being hit by ransomware right now; an update closes holes that rules can't.

Synology firewall not working? Symptom → fix

The best rule is the port you never opened

Most firewall effort goes into defending ports you forwarded so you could reach the NAS from outside. The other way to get there is to forward nothing and let the NAS dial out. QuickConnect does that for DSM and Synology's apps. Tailscale gives you a private network. Cloudflare Tunnel publishes web apps on your domain. All good tools, and with any of them the internet-facing part of your rule list shrinks to “Deny all”.

If what you wanted from outside was your files, as a drive, that's what RocketZero does. Install the package on the NAS and the desktop app on Windows or macOS, sign in with your existing DSM username and password, and your shares show up as real network drives: Z: in Explorer, or in Finder. No port forwarding, no DDNS, works behind CGNAT. The drive runs over WireGuard, peer-to-peer when the network allows and through an encrypted relay when it doesn't, end-to-end encrypted either way.

Windows This PC showing Synology NAS shares mounted as network drives remotely with no ports forwarded through the router or firewall
The NAS as ordinary drives in Windows' “This PC”, with nothing forwarded on the router. Real capture from our Windows lab.

The honest small print: RocketZero also gives your NAS an <id>.roze.to address that opens DSM and its web apps in a browser, but that path is a hosted reverse proxy with TLS terminated at our relay (the Cloudflare Tunnel model), so it isn't end-to-end encrypted. Only the drive is. DSM's 2FA protects the web UI, not the drive mount, so use a dedicated account with a strong password. And keep the firewall on for your LAN regardless; it's still the best way to stop the smart fridge from browsing your shares.

RocketZero ships today for Synology DSM 7, OpenMediaVault 7 and TrueNAS SCALE, with desktop apps for Windows and macOS (on first launch on macOS you'll need to allow it in System Settings → Privacy & Security). Setup walkthrough: the RocketZero setup guide.

Firewall rules for forwarded ports if…

  • you have a real public IP and must forward something;
  • you'll keep the Allow list short and DSM patched;
  • you've got Auto Block and 2FA on.

Forward nothing if…

  • you're behind CGNAT or can't touch the router;
  • you'd rather have no login page on the internet;
  • you just want your NAS as a drive: download RocketZero.

FAQ

Does Synology have a firewall?

Yes. DSM has a built-in firewall in Control Panel → Security → Firewall. It's off by default. You turn it on, then build rules in a firewall profile: each rule matches ports, a source (all, a specific IP/range/subnet, or a country) and an action (Allow or Deny).

Should I enable the firewall on my Synology NAS?

Yes, if you forward any port to the NAS, and it's still worth it if you don't: it limits what other devices on your own network (that smart plug, the kids' laptop) can reach. Set it up carefully, because the most common firewall problem on a Synology is the owner locking themselves out.

In what order are Synology firewall rules applied?

Top to bottom, first match wins. DSM's own rule editor says it: rules at the top have higher priorities, and you drag and drop to reorder. Rules under "All interfaces" are checked first, then the rules for the specific network interface. So put your Allow rules first and a Deny-all rule last.

How do I block all countries except mine on Synology?

Create an Allow rule for the ports you expose with Source IP → Location → your country, keep an Allow rule for your LAN subnet above it, and add a final rule that denies all ports from all sources. Country data comes from IP geolocation, so it's a good filter for noise, not a guarantee.

I locked myself out with a Synology firewall rule. What now?

First try from a device whose IP your rules still allow, or from a computer connected directly to the NAS. If nothing is allowed, the reset button's Mode 1 (hold about 4 seconds until it beeps) resets the network settings and the admin sign-in without touching your data; several guides report it also turns the firewall off, but Synology's own article doesn't list that, so check your model's documentation. Prevention is cheaper: always make the LAN allow rule the first rule.

What's the difference between the firewall and Auto Block?

The firewall decides who can reach a port at all. Auto Block (Control Panel → Security → Protection) watches sign-ins and blocks an IP after too many failed login attempts. They complement each other: the firewall shrinks the audience, Auto Block punishes the guessers who are left.

Do I need a firewall rule to access my NAS remotely without port forwarding?

Tools where the NAS dials out (QuickConnect, Tailscale, Cloudflare Tunnel, RocketZero) don't need a port forwarded on your router, so there's no internet-facing port to write an Allow rule for in the first place. Keep the firewall on for your LAN anyway.

Fewer rules. Same files.

RocketZero mounts your NAS as a drive from anywhere: no port forwarding, no DDNS, works behind CGNAT, no extra account. Free to get started.

Download RocketZero Read the setup guide