webfilteringdatabase.com
Home Find Your Solution
Features
Domain Categorization API Real-Time Classification 58 Filtering Categories Offline Database (120M) SaaS App Hostnames Managed DNS Filter ML Classification Content Classification
Industries
K-12 Schools Corporate Healthcare Government ISPs
Tools
Domain Lookup Bulk Categorization Category Explorer
Resources
Pricing API Documentation Login / Sign Up

How to block websites with Windows Server DNS: policies, zones and forwarders

On an Active Directory network every domain-joined computer already asks your domain controllers for names. That makes Windows Server DNS a natural place to block websites. This guide is for Windows admins: three methods, the PowerShell for each, and the pitfalls that catch people out.

# Windows Server 2016 or later: block a domain and its sub-domains Add-DnsServerQueryResolutionPolicy -Name "Block-Example" ` -Action IGNORE ` -FQDN "EQ,example.com,*.example.com" -PassThru # list and remove Get-DnsServerQueryResolutionPolicy Remove-DnsServerQueryResolutionPolicy -Name "Block-Example" -Force

Three ways to block at the domain controller

They differ in how much you can block, how they replicate, and how much work each new site costs.

2016 and later

Query resolution policies

Rules on the DNS server that ignore or refuse queries for listed names. Precise, but stored per server.

Any version

Local blocking zones

A zone named after the blocked domain that answers with an empty address. Replicates with Active Directory, but one zone per domain.

By category

Forwarders to a DNS filter

Send every outside lookup to a category filter. Covers whole categories without lists on the server.

Keep AD, add categories

Forward outside lookups to a category filter and keep your zones local

Point your DNS servers' forwarders at our managed DNS filter and switch off root hints. Internal Active Directory names are still answered by your domain controllers, and every outside name is checked against 22 category switches and your own lists.

  • No policy or zone to add per blocked site.
  • One change per DNS server, nothing on the clients.
  • The same rules for guests and devices that use the filter directly.
Lookups forwarded from Windows DNS servers to the managed DNS filter
22
category switches behind your forwarders
120M+
outside domains with a category on file
Milliseconds
added to a forwarded lookup

Method 1: query resolution policies

DNS policies arrived in Windows Server 2016. A policy matches queries by criteria such as the name asked for and decides what the server does with them.

# block several domains in one policy
Add-DnsServerQueryResolutionPolicy -Name "Block-Games" `
  -Action IGNORE `
  -FQDN "EQ,example-games.com,*.example-games.com,example-play.net,*.example-play.net"

# fail fast instead of a timeout
Add-DnsServerQueryResolutionPolicy -Name "Refuse-Example" `
  -Action DENY -FQDN "EQ,example.org,*.example.org"

# run the same commands on every DNS server, for example
Invoke-Command -ComputerName dc01,dc02 -ScriptBlock { ... }
Sub-domains. List the domain and "*.domain" so both the bare name and its sub-domains match.
IGNORE or DENY. IGNORE gives no answer, so clients wait and give up; DENY sends an error straight away.
No replication. Policies live on each server. Script them and run the script on every DNS server.
Exceptions. Policies can also match client subnets, so a rule can apply to one office network only.

Method 2: local blocking zones

The older method works on every Windows Server version. You create a zone named after the domain you want to block, and your server answers for it instead of the real one.

# an Active Directory integrated zone that replicates
Add-DnsServerPrimaryZone -Name "example.com" -ReplicationScope Forest

# answer the bare name and every sub-domain with an empty address
Add-DnsServerResourceRecordA -ZoneName "example.com" -Name "@" -IPv4Address 0.0.0.0
Add-DnsServerResourceRecordA -ZoneName "example.com" -Name "*" -IPv4Address 0.0.0.0
Replicates. Integrated zones copy to every domain controller in the scope you choose.
One zone per domain. Fine for ten domains, unmanageable for a thousand.
Block page. Point the records at an internal web server instead of 0.0.0.0 to show your own message.
Careful with real partners. Never create a zone for a domain your business actually uses.
Domains Windows admins are asked about

Five domains and whether a category rule would catch them

Real rows from our data. A category switch at the forwarder catches the first four and their look-alikes; the last one shows where your own block list still matters.

DomainCategories in our dataCaught by a switch?
steampowered.comGamingYes, Gaming
xbox.comGamingYes, Gaming
playstation.comGaming, Streaming MediaYes, Gaming or Streaming Media
lichess.orgGaming, Community SitesYes, Gaming, if chess should be blocked at all
ngrok.comComputers & TechnologyNo; add it to the always-block list if tunnels are banned

Method 3: forwarders to a category DNS filter

Your domain controllers answer internal zones themselves and pass every other name to their forwarders. Make the forwarders a category filter and every outside lookup is filtered.

# send outside lookups to the filter's two addresses
Set-DnsServerForwarder -IPAddress FILTER_MAIN,FILTER_BACKUP -UseRootHint $false

# check
Get-DnsServerForwarder

# conditional forwarders for partner domains stay as they are
# internal zones are never forwarded
Turn off root hints. Otherwise the server resolves names itself when the forwarders are slow, and those lookups skip the filter.
Both filter addresses. Use the main and backup filter, so a failure of one keeps filtering in place.
Clients unchanged. Domain-joined computers keep using the domain controllers; nothing changes on them.
One network view. The filter sees the domain controller asking, so its activity is grouped under that network.

Because the filter sees lookups arriving from the domain controllers, rules apply to the whole network behind them. For different rules per office, give each site's DNS servers their own network in the filter's dashboard.

The three methods side by side

Many networks use two: forwarders for categories, and a policy or zone for a handful of named domains.

QuestionQuery resolution policiesLocal blocking zonesForwarders to a filter
Windows Server version2016 and laterAnyAny
Replicates between serversNo, script itYes, if AD integratedSet once per server
Blocks by categoryNoNoYes
Work per new siteEdit a policy on every serverCreate a zoneNone, or one list entry
Block pageNot with IGNORE or DENYPossible via an internal web serverThe filter's block page
Devices not on the domainOnly if they use these serversSameGuests can use the filter directly

Rolling out forwarders without surprises

Changing forwarders affects everyone at once. Four steps keep the change calm.

Step 1

Allow your business apps

Put sign-in, office and line-of-business domains on the filter's always-allow list first.

Step 2

Start with one server

Change the forwarders on one domain controller that a test group uses.

Step 3

Read the activity

After a day, look for blocks nobody expected and adjust the categories.

Step 4

Move the rest

Apply the same forwarders to every DNS server and note the change in your records.

The guide to an allow list for business apps lists the core domains of the common office suites.

Behind the domain controllers

How the managed filter handles what your DNS servers forward

Forwarded lookups reach the main filter, or the backup when the main does not answer, and receive your categories, always-allow and always-block lists. Changes you make in the dashboard apply in seconds, with no policy to push to every domain controller.

Testing and troubleshooting

Run these on a domain-joined computer and on the DNS server after every change.

CommandWhat it shows
Resolve-DnsName example.com -Server dc01What a specific DNS server answers for a blocked name
Clear-DnsServerCacheEmpties the server's cache after a change, on the server
Clear-DnsClientCacheEmpties the client's cache; ipconfig /flushdns does the same
Get-DnsServerQueryResolutionPolicyLists the policies on this server, to compare servers
Get-DnsServerForwarderConfirms the filter addresses and that root hints are off

Six mistakes with DNS blocking on Windows Server

Each one leads to a filter that works on some machines and not on others.

Policies on one server only

Clients that use the second domain controller are not blocked. Script every server.

Root hints left on

Slow forwarders make the server resolve names itself, skipping the filter.

A public DNS server as a second forwarder

Some lookups go there and are never filtered. Use both filter addresses only.

Forgetting the bare domain

"*.example.com" alone leaves example.com itself open.

Clients with their own DNS

Laptops set by hand to a public resolver skip the domain controllers entirely. Block outside DNS at the firewall.

Browsers with secure DNS

Encrypted DNS in the browser bypasses the server. Turn it off by Group Policy; see blocking in Chrome and Edge.

Blocking with DNS policies by hand, or forwarding to the managed DNS filter

The same Active Directory network, two ways.

TaskPolicies and zones by handForwarders to the managed DNS filter
Block a category of sitesNot possible; list every domainOne of 22 category switches
Add a siteEdit a policy on every DNS serverOne always-block entry, applied in seconds
New sites in a categoryMissed until someone adds themCovered as they are categorized
Show what was blockedEnable and read DNS logs on each serverActivity and reports in one dashboard
Guest Wi-Fi outside the domainA separate setupThe same filter, its own profile

Windows Server DNS blocking: frequently asked questions

How do I block a website with Windows Server DNS?

On Windows Server 2016 or later, add a query resolution policy with Add-DnsServerQueryResolutionPolicy, using the FQDN criterion for the domain and its sub-domains and the action IGNORE or DENY. Repeat it on every DNS server.

Do DNS policies replicate between domain controllers?

No. Query resolution policies are stored per server, so the same command has to run on every DNS server your clients use, unlike Active Directory integrated zones, which replicate.

Can Windows Server DNS block websites by category?

Not by itself. Point its forwarders at a category DNS filter and turn off root hints, so every outside lookup is checked against categories while internal Active Directory names stay on your servers.

What is the difference between IGNORE and DENY?

With IGNORE the server does not answer, so the client waits and then gives up. With DENY the server sends an error straight away, which fails faster.

Will forwarding to a filter break Active Directory?

No. Domain controllers answer your internal zones themselves and only forward names they are not authoritative for. Keep clients pointed at the domain controllers as before.

Can I block websites for one office only?

Yes. Query resolution policies can match the client subnet as well as the name, so a rule can apply to one office network. With forwarders to the filter, give that office's DNS servers their own network and profile in the dashboard.

Do I still need Group Policy for browsers?

Yes, for one setting. Browsers with secure DNS switched on send lookups past your DNS servers, so turn it off by Group Policy on managed computers to keep every lookup going through your domain controllers.

How do I test a DNS block on Windows Server?

Run Resolve-DnsName example.com -Server followed by the server name. Clear the server cache with Clear-DnsServerCache and the client cache with Clear-DnsClientCache after a change.

The managed DNS filter costs $99 a month for one site, and organisations with several sites get one quote. A pilot with one domain controller's forwarders lets your test group try the categories before the whole network does.

Keep Active Directory, add category filtering

Tell us how many sites and domain controllers you run. We will set up a pilot and give you the two forwarder addresses to try.

Windows Server, Active Directory and PowerShell are trademarks of Microsoft Corporation. They are named here only to identify the products discussed. Web Filtering Database is not affiliated with, sponsored or endorsed by Microsoft.