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.
TL;DR
- Where: Control Panel → Security → Firewall → tick Enable firewall → Edit Rules on the
defaultprofile. - 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.
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.
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:
- Ports: All, Select from a list of built-in applications (DSM fills in the right ports for its own services, which saves you memorising the Synology ports list), or Custom for a port number or range and protocol.
- Source IP: All, Specific IP (a single host, an IP range, or a subnet), or Location, which matches by country.
- Action: Allow or Deny. Plus an Enabled tick, handy for switching a rule off without deleting it.
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:
| # | Ports | Source IP | Action | Why |
|---|---|---|---|---|
| 1 | All | Subnet 192.168.1.0 / 255.255.255.0 (your LAN) | ✓Allow | Your own network gets in. This is the rule that stops you locking yourself out |
| 2 | All | Your VPN client subnet (if you run VPN Server) | ✓Allow | VPN users arrive from the VPN's own range, not your LAN's |
| 3 | Only what you forward (e.g. OpenVPN 1194 UDP) | Location → your country | ✓Allow | Optional. Only needed if a port is forwarded on the router |
| 4 | All | All | ✗Deny | Everything that didn't match above is dropped |
- Find your LAN subnet first. If your computer is
192.168.1.23, your subnet is almost certainly192.168.1.0with mask255.255.255.0. Enter it under Source IP → Specific IP → Subnet. - 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. - Add Deny all last: ports All, source All, action Deny.
- 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
- Rules don't seem to apply. You clicked OK in the rule editor but not Apply on the Firewall tab, or Enable firewall is still unticked.
- Everything is blocked. A Deny rule sits above your Allow rules, or your LAN rule uses the wrong subnet. Reorder or fix it from a device that's still allowed.
- Remote access stopped after enabling it. Your forwarded port (or the VPN client range) has no Allow rule, so it falls through to Deny all.
- Settings greyed out. Tick Enable firewall first; the profile and rule controls only come alive once it's on.
- Locked out completely. Try a device that matches an Allow rule. Failing that, the reset button's Mode 1 (hold about 4 seconds until the beep) resets network settings and the admin sign-in without touching your data. Several guides say it also turns the firewall off; Synology's own reset article doesn't list it, so check your model's docs before relying on it.
- Behind CGNAT nothing reaches the NAS anyway. If your router's WAN address starts with
100.64–100.127, no port forward works no matter what the firewall says. Here's why, and what to do.
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.
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