DNS filtering

On this page 7

DNS filtering is a security control that inspects domain name lookups and refuses, redirects or logs those that point to malicious, risky or policy-restricted destinations. In infrastructure defense, it acts as an early checkpoint: because almost every connection begins with a DNS query, blocking the lookup stops the connection before it starts, whether the destination is a phishing page, a malware download server or a command-and-control endpoint.

DNS filtering is valued in cybersecurity for its low cost, broad coverage and minimal latency. It protects every device that uses the filtering resolver, including printers, cameras and other systems that cannot run endpoint agents.

How DNS filtering intercepts lookups

DNS filtering works by placing a policy-aware resolver between clients and the wider DNS hierarchy. When a device asks for the address of a domain, the resolver compares the name against threat intelligence feeds, category databases and custom rules before answering.

If the domain is allowed, the resolver returns the normal IP address. If it is blocked, the resolver typically returns NXDOMAIN, a null address such as 0.0.0.0, or the address of a block page that explains the decision to the user. Every query and verdict is logged, which gives defenders a valuable record of which hosts attempted to reach suspicious domains.

The table below shows the common response methods and their trade-offs.

Response methodWhat the client receivesTrade-off
NXDOMAINDomain does not existSilent; users may assume an outage
Null address0.0.0.0 or ::Fast failure; no explanation shown
Block page redirectIP of an informational web pageClear to users; HTTPS triggers certificate warnings
Sinkhole addressIP of a monitored serverReveals infected hosts; needs extra infrastructure
Response policy zone rewriteLocally defined answer via RPZFlexible; requires resolver administration
Ways a filtering resolver answers a blocked query

Many on-premises deployments implement filtering with Response Policy Zones (RPZ), a standardized mechanism supported by common resolvers such as BIND and Unbound, while cloud services apply equivalent logic in their own recursive infrastructure.

Deployment models and policy categories

Organizations deploy DNS filtering through network resolvers, cloud services or endpoint agents, and the choice determines which devices and locations are protected. Coverage gaps usually come from devices that bypass the intended resolver.

The following comparison summarizes the main deployment models.

ModelWhere filtering happensBest suited for
On-premises resolverInternal DNS servers with RPZData centers and controlled networks
Cloud recursive serviceProvider resolvers reached by forwardingBranch offices and small organizations
Endpoint agentLocal client that enforces policyLaptops off the corporate network
Protective DNS for sectorsGovernment or industry-run resolverPublic bodies and critical infrastructure
Home or router filteringConsumer router or family serviceHouseholds and very small offices
DNS filtering deployment models

Policies usually combine security categories, such as malware, phishing, newly registered domains and cryptomining, with acceptable use categories, such as gambling or adult content. Blocking newly observed domains for their first days of existence is particularly effective, because attackers frequently register fresh domains for short campaigns, although it also produces occasional false positives for legitimate new services.

DNS filtering compared with other network controls

DNS filtering decides on the domain name alone, which makes it faster and broader but less precise than controls that inspect the full request. It is best viewed as one layer among several.

The table places it alongside neighboring infrastructure defenses.

ControlDecision basisMain limitation
DNS filteringRequested domain nameCannot see URL paths or direct IP connections
Secure web gatewayFull URL, content and user identityHigher cost; needs traffic proxying or TLS inspection
FirewallIP addresses, ports and protocolsWeak against domains on shared hosting
IPSPacket and session signaturesEncrypted traffic limits visibility
EDRProcess behavior on the endpointRequires an agent on each device
DNS filtering and related controls

Because DNS logs reveal which internal host asked for which domain, they are a valuable feed for a SIEM or XDR platform. Repeated queries to algorithmically generated domains, for example, often indicate malware using a domain generation algorithm.

Encrypted DNS and bypass risks

The effectiveness of DNS filtering depends on every device actually using the filtering resolver. Encrypted DNS protocols and hard-coded resolvers can route lookups around it entirely.

  • DNS over HTTPS (DoH) carries queries inside ordinary HTTPS traffic on port 443, so browsers or malware configured with an external DoH resolver can evade local policy.
  • DNS over TLS (DoT) uses port 853 and is easier to identify and block at the firewall.
  • Hard-coded public resolvers in applications or IoT firmware ignore the resolver supplied by DHCP.
  • Direct IP connections skip DNS completely, so filtering offers no protection against them.

Sound practice is to block outbound DNS on port 53 except from approved resolvers, block or restrict known external DoH endpoints, and use browser enterprise policies or canary domains to disable automatic DoH. Organizations can still offer encrypted DNS themselves, keeping privacy for users and visibility for defenders.

Tuning policies and avoiding common mistakes

A DNS filter succeeds when it blocks threats without disrupting legitimate work, which requires ongoing tuning rather than a one-time configuration. Most failures trace back to coverage gaps or overly broad categories.

The table below lists typical problems and how to correct them.

SymptomLikely causeCorrection
Business site blockedOverly broad category or misclassificationAdd an allowlist entry and report the category
Malware traffic still observedDoH or hard-coded resolver bypassEnforce egress rules for DNS and DoH
No visibility into infected hostsLogs show only the forwarder addressLog client IPs at the internal resolver
Remote staff unprotectedFiltering applied only on office networkDeploy endpoint agents or roaming clients
Certificate warnings on block pagesHTTPS redirected to block serverUse NXDOMAIN for HTTPS or deploy trusted certificates
Frequent DNS filtering problems

A staged rollout in monitor mode helps teams see what would be blocked before enforcement begins, and periodic review of allowlist exceptions prevents them from becoming permanent blind spots.

A non-technical view

Every time a device visits a website, it first asks a kind of phone book for the site address. DNS filtering puts a careful operator in charge of that phone book. When someone asks for a known dangerous address, the operator simply refuses to give out the number.

Because the device never learns where the dangerous site lives, it cannot connect to it. The check is quick and covers every device on the network. It does not catch everything, so it works best alongside other protections.

A concrete example

A regional accounting firm with 60 employees and two offices forwards all internal DNS queries to a cloud filtering service and blocks outbound port 53 at both firewalls. Policies block malware, phishing and domains registered within the last 30 days, and laptops carry a roaming agent for staff working from home.

During tax season an employee clicks a link in a convincing invoice email. The link points to a credential harvesting page on a domain created two days earlier, and the resolver returns a block page instead of the site. The security log also shows the same domain requested by three other workstations, which lets the IT provider warn those users and reset one password within an hour, before any account is misused.