Flamingo Raises $4.5M to Get MSPs Out of the Ticket Queue

Skip to content

How to Fix Slow DNS Lookup: A Field Guide for MSPs and IT Teams

Troubleshooting
March 13, 2026
2,506 views
How to Fix Slow DNS Lookup: A Field Guide for MSPs and IT Teams

Commands for Windows, macOS, Linux and Kubernetes, the resolv.conf and Active Directory settings behind each stall, cache flushes for every OS, and the DNS checks to add to site onboarding and monitoring.


Updated: November 2026

When a browser hangs on "Resolving host" and then loads the page at full speed, a slow DNS lookup is the usual suspect. On a single PC the cause is often a slow resolver, but across client sites and internal IT estates it is more often a timeout: an IPv6 query nobody answers, a search list expanded too many times, or a forwarder pointing at a server that no longer exists. To fix a slow DNS lookup, time it first, then work through the causes below, each with the command that confirms it before you change anything.

TL;DR

  • The short answer. Slow DNS lookups usually trace to a timeout, such as unanswered IPv6 AAAA queries, ndots search expansion, a dead preferred DNS server or a stale AD forwarder, not to the resolver you picked.
  • Diagnose first. Time the lookup against the system resolver and a public one with dig or Resolve-DnsName before changing anything.
  • Linux and containers. Check the options line in resolv.conf first: Kubernetes pods ship with ndots:5.
  • Windows and AD. A preferred DNS server that doesn't answer adds a second to every uncached lookup, and a DC demotion can leave forwarders pointing at a server that's gone.
  • Client sites and offices. A local caching resolver such as Unbound keeps repeat lookups off the WAN.

Diagnose Before You Fix

Changing resolvers without measuring first is guesswork. A slow DNS lookup could be a 200ms resolver, a 5-second IPv6 timeout, or a 15-second ndots misconfiguration. They look identical from the browser. They're not the same fix.

Measure your actual lookup time first:

bash
# Linux / macOS
time dig google.com

# Windows (PowerShell): clear the cache first, or you're timing the cache
Clear-DnsClientCache
Measure-Command { Resolve-DnsName google.com -DnsOnly }

# Test a specific resolver directly
time dig @1.1.1.1 google.com
time dig @8.8.8.8 google.com
Measure-Command { Resolve-DnsName google.com -Server 1.1.1.1 -DnsOnly }

dig also prints a ;; Query time: line, which leaves out the process start-up that time includes.

What the numbers usually mean, as a rule of thumb:

Lookup timeWhat it points to
Under 50msDNS is probably not your bottleneck
50-150msSuboptimal resolver, likely fixable
150-500msCongested or geographically distant resolver
500ms+Something is broken - a timeout, a misconfiguration, or a conflict
Whole seconds (1, 5 or 10)A timeout: a server or query that never gets an answer

If dig @1.1.1.1 google.com is fast but your system DNS is slow, the resolver is the problem. If everything is slow including direct resolver queries, you're dealing with network-level latency or packet loss. If dig is fast but the browser is slow, you've got a client-side caching or adapter conflict.

Slow DNS on One Machine or the Whole Site?

Scope tells you where to look before any command does. The table maps the pattern a technician sees, whether at a client site or in your own offices, to the layer that usually owns it.

Who is slowLook at firstFix in this guide
One PC or laptopAdapter DNS order, VPN client, local cache, hosts fileFix 2, Fix 5
Every device at one siteRouter or firewall DNS settings, ISP resolver, local resolverFix 1, Fix 6
Linux servers and containers onlyresolv.conf options, systemd-resolvedFix 3, Fix 4
Domain-joined PCs, external sites onlyDC forwarders and root hintsFix 7
Internal names onlyAD DNS, split-horizon, DHCP DNS optionsFix 7
Visitors to a site you hostTTLs and CNAME chainsFix 8

If lookups fail outright instead of crawling, start with our guide to DNS server not responding errors, which covers the one-PC and whole-office cases.

Fix 1: Switch to a Faster Resolver

ISP-provided resolvers can be the slowest option on the network, because one that is overloaded or far from the site adds latency to every uncached lookup. Public resolvers run large anycast networks, but which one answers fastest depends on the site's ISP and region, so run the dig @ test above from the client network before you switch.

ResolverAddressesNotes
Cloudflare1.1.1.1, 1.0.0.1Supports DoH and DoT; 1.1.1.2 adds malware blocking
Google Public DNS8.8.8.8, 8.8.4.4Supports DoH and DoT
Quad99.9.9.9, 149.112.112.112Blocks known malicious domains

For MSP client sites and multi-site offices alike, the right place to set this is on the router or DHCP server, not on individual endpoints. One change reaches every device at the site on its next DHCP renewal.

Windows DNS client (per machine):

code
netsh interface ip set dns "Ethernet" static 1.1.1.1
netsh interface ip add dns "Ethernet" 8.8.8.8 index=2

# PowerShell equivalent
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 1.1.1.1,8.8.8.8

On a pfSense/OPNsense router: set 1.1.1.1 and 8.8.8.8 as the DNS servers under System > General Setup on pfSense or System > Settings > General on OPNsense. Uncheck "Allow DNS server list to be overridden by DHCP/PPP on WAN" so the ISP's servers don't return after the next WAN lease. Both firewalls run Unbound as a recursive resolver by default, which ignores that list for client queries until you turn on forwarding: Services > DNS Resolver > Enable Forwarding Mode on pfSense, or Services > Unbound DNS > Query Forwarding on OPNsense.

On UniFi: Networks > [Your Network] > DHCP Name Server > Manual > 1.1.1.1, 8.8.8.8.

Fix 2: The IPv6 AAAA Timeout

This one shows up on networks where IPv6 is switched on but only half-configured, and it looks exactly like a slow internet connection.

Modern operating systems - and glibc on Linux - send A (IPv4) and AAAA (IPv6) queries in parallel by default. If the DNS server doesn't respond to the AAAA query, the resolver waits for a timeout before falling back. That timeout is typically 5 seconds. So instead of a 20ms lookup, you get a 5000ms lookup. The browser shows "Resolving host" and everyone assumes the internet is broken.

It happens when a DNS server, router or firewall can't handle two queries sent from the same port at once, when IPv6 is enabled on the interface but not routing, or when a security appliance silently drops AAAA queries instead of answering them.

Diagnose it:

bash
time dig AAAA google.com

If that hangs for 5+ seconds or times out, you've found it.

Fix on Linux (resolv.conf):

code
options single-request-reopen

This tells glibc to open a new socket for the second query when a router or firewall answers only one of the two it received from the same port, instead of waiting out the 5-second timeout. If the stall continues, options single-request sends the A and AAAA queries one after the other, which costs a little time on every lookup, and on IPv4-only networks glibc 2.36 and later accept options no-aaaa, which stops AAAA queries altogether. If /etc/resolv.conf points at 127.0.0.53, systemd-resolved sends the upstream queries, so these options won't reach the problem; fix IPv6 on the interface or the upstream server instead.

A cleaner long-term fix is to ensure IPv6 is either properly working or properly disabled on the interface:

bash
# Check if IPv6 is routing at all
ping -6 -c2 2606:4700:4700::1111

# Half-working IPv6 you can't fix today: prefer IPv4 for connections
# Add to /etc/gai.conf:
# precedence ::ffff:0:0/96  100

The gai.conf line changes which address a program connects to first; it doesn't stop the AAAA queries themselves.

On Windows: Microsoft advises against unchecking IPv6 on the adapter, because some Windows components expect it. On an IPv4-only network, prefer IPv4 over IPv6 instead by setting DisabledComponents to 0x20 under HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters, then restart. Push it as a registry policy or an RMM script rather than machine by machine.

Fix 3: ndots Misconfiguration on Linux and Containers

Kubernetes made this one famous, but it affects any Linux environment with multiple DNS search domains configured.

The ndots option in /etc/resolv.conf controls how many dots a domain needs before the resolver treats it as a fully qualified domain name (FQDN). glibc's default is 1, but Kubernetes writes ndots:5 into every pod's resolv.conf, and the value can travel into hand-built images copied from a pod's config. With ndots:5, a query for api.example.com (two dots) gets tried with every configured search domain appended before the resolver finally tries the actual domain.

If you have three search domains configured, that's three failed lookups before you get the right answer, six once A and AAAA queries are counted. Each one is a full round trip to the DNS server, and if the server is slow to answer for one of those suffixes, each can wait out the 5-second glibc timeout.

Check your current resolv.conf:

bash
cat /etc/resolv.conf

If you see something like:

code
search corp.client.local internal.client.local ad.client.local
options ndots:5

...and your clients are complaining about slow internet, this is likely part of the problem.

Fix: Lower ndots to 2 or 1 outside Kubernetes. FQDNs (which include a trailing dot) bypass the ndots logic entirely.

code
options ndots:2

For containers and VDI deployments, ndots:1 is often the right value. External domains get resolved immediately without suffix appending.

Inside Kubernetes, override the value per pod instead of editing resolv.conf, which the kubelet writes for each pod:

yaml
spec:
  dnsConfig:
    options:
      - name: ndots
        value: "2"

Short service names such as my-svc.my-namespace still resolve through the search list with ndots:2, while external names like api.example.com go out as absolute queries on the first try.

Fix 4: systemd-resolved Conflicts with dnsmasq or avahi

On current Ubuntu and Fedora releases, and on Debian or RHEL-family systems where it's enabled, systemd-resolved handles DNS. It's a caching stub resolver that listens on 127.0.0.53. Problems start when another service wants the same ports: dnsmasq or a VPN client on port 53, or avahi-daemon on the multicast DNS port 5353, which systemd-resolved also uses when its MulticastDNS setting is on.

Symptoms: DNS works, then stops, then works again; the first lookup takes 15-30 seconds while later ones are fast; or systemctl status systemd-resolved shows errors and repeated restarts.

Diagnose:

bash
sudo ss -ulnp | grep -E ':(53|5353)\b'
resolvectl status

If two processes hold the same port, whether 53 or 5353, you've got a conflict.

Fix for avahi conflict (common on desktop distros):

bash
# In /etc/systemd/resolved.conf, let avahi own multicast DNS:
MulticastDNS=no

sudo systemctl restart systemd-resolved

If the client's AD domain ends in .local, there's a second problem. That suffix is reserved for multicast DNS, so the mdns4_minimal [NOTFOUND=return] entry in /etc/nsswitch.conf can send domain names to multicast DNS and stop there. If .local names stall or fail on Linux machines joined to such a domain, drop the mdns entries so those names reach the domain controllers:

code
# /etc/nsswitch.conf
hosts: files resolve [!UNAVAIL=return] dns

If systemd-resolved itself is the problem (cache stale, service stuck):

bash
sudo resolvectl flush-caches
sudo systemctl restart systemd-resolved

If the service keeps hanging after restarts, consider switching to a dedicated caching resolver like Unbound - covered in Fix 6.

Fix 5: Windows DNS Client Service and Ghost Adapters

On Windows, two things cause slow DNS that rarely show up until someone goes looking:

The DNS Client service not running: If the Windows DNS Client service is stopped or in a degraded state, every lookup goes direct to the DNS server with no caching, so names the machine resolved a second ago make the full round trip again. On Windows 10 and 11, the Services console greys out Stop and Startup type for this service, so a stopped Dnscache usually means a script or tuning tool changed its Start value in the registry.

powershell
Get-Service -Name Dnscache
# Start value: 2 = Automatic (the default), 4 = Disabled
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache -Name Start
# Restore it, then restart the machine
Set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache -Name Start -Value 2

Ghost network adapters: Old VPN clients, VMware, VirtualBox, and Hyper-V all create virtual network adapters. Hidden ones clutter the configuration, and any that are still enabled can carry their own DNS servers, which Windows may try before the real ones depending on the interface metric. When the first DNS server on an adapter doesn't answer, Windows waits 1 second before trying the second and gives up on a query that gets no answer at all after 10 seconds, per Microsoft's resolution timeline. One dead DNS server early in the list therefore adds a second to every uncached lookup, which reads as slow DNS rather than broken DNS.

Check for inactive adapters:

powershell
# Show ALL adapters including hidden ones
Get-PnpDevice -Class Net | Where-Object {$_.Status -ne "OK"}

# Which DNS servers each adapter hands out, and which adapter Windows prefers
Get-DnsClientServerAddress -AddressFamily IPv4
Get-NetIPInterface -AddressFamily IPv4 | Sort-Object InterfaceMetric

To remove them properly: Device Manager > View > Show hidden devices. Expand Network Adapters. Remove anything greyed out that isn't in active use.

Flush DNS cache on Windows:

code
ipconfig /flushdns
ipconfig /registerdns

Also flush the Chrome internal cache separately if browser slowness is the complaint: chrome://net-internals/#dns > Clear host cache.

Flush the DNS Cache on Windows, macOS and Linux

Flushing clears stale or negative answers, such as a record that changed during a migration. It does nothing for a slow resolver or a timeout, so flush after you've ruled those out, or when one name resolves to the wrong place.

SystemCommandNotes
Windowsipconfig /flushdns or Clear-DnsClientCacheRun from an elevated prompt; ipconfig /displaydns lists what's cached
macOSsudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderWorks on macOS 10.11 and later
Linux with systemd-resolvedsudo resolvectl flush-cachesresolvectl statistics shows the cache size before and after
Linux with nscdsudo nscd -i hostsOnly if nscd is installed and caching hosts
Linux with dnsmasqsudo pkill -HUP dnsmasqA HUP clears the cache and rereads /etc/hosts
Chrome and Edgechrome://net-internals/#dns or edge://net-internals/#dnsClick Clear host cache; the browser keeps its own cache

Across a fleet, push the flush as an RMM script to the affected devices rather than walking a user through it.

Fix 6: Deploy a Local Caching Resolver at Client Sites

Switching the resolver to Cloudflare or Google is a quick win. A local caching resolver is the longer-term answer once a site has more than a handful of devices resolving the same names.

Unbound from NLnet Labs is the open-source recursive resolver to know for client sites and branch offices. It runs on anything - a Raspberry Pi, a spare VM, a firewall appliance. Deployed as the site's primary DNS, it:

  • Answers repeat queries from its local cache without leaving the site
  • Performs recursive resolution directly, bypassing overloaded ISP resolvers
  • Supports DNSSEC validation out of the box
  • Has no licensing cost

Basic Unbound setup on Ubuntu:

bash
apt install unbound

On Ubuntu, systemd-resolved already holds port 53 on 127.0.0.53, which can clash with interface: 0.0.0.0. Bind Unbound to the server's LAN address instead, or set DNSStubListener=no in /etc/systemd/resolved.conf, and run unbound-checkconf after every edit.

/etc/unbound/unbound.conf:

yaml
server:
  interface: 0.0.0.0
  access-control: 192.168.0.0/24 allow
  cache-max-ttl: 86400
  cache-min-ttl: 300
  prefetch: yes
  prefetch-key: yes
  num-threads: 2
  so-reuseport: yes
  hide-identity: yes
  hide-version: yes
  use-caps-for-id: yes

The prefetch: yes option is particularly useful - it refreshes popular cache entries before they expire, so clients almost never see a cold lookup.

Pi-hole pairs well with Unbound if you also want DNS-level ad/malware blocking for clients. The combination gives you: network-wide blocking + local recursive caching + a clean dashboard for per-device DNS activity. Useful data for quarterly business reviews with clients.

For the full setup, Pi-hole's Unbound guide covers the config file and the test queries, and the walkthrough below runs through the same build end to end.

If you're building out a fully open-source monitoring stack, OpenMSP's open-source MSP software directory lists 34 tools with every repo verified.

Fix 7: Active Directory DNS Issues

For MSPs and internal IT teams running Windows domains, AD DNS is its own category of problems, because the domain controllers usually double as the DNS servers for every machine that joins the domain.

Slow external lookups from domain-joined PCs: If clients are pointed directly at the domain controller for DNS, and that DC is handling external forwarding through a slow ISP resolver, every external lookup takes the long route. Fix: point the DC's server forwarders at Cloudflare or Google. Conditional forwarders, which have their own node in DNS Manager, are for specific partner or internal domains, not for general internet traffic.

In DNS Manager: right-click the server name > Properties > Forwarders tab. Add 1.1.1.1 and 8.8.8.8, or run Set-DnsServerForwarder -IPAddress 1.1.1.1,8.8.8.8 on each DC. If the list is empty, the DC falls back to root hints, which works but adds latency to uncached names.

Forwarders left pointing at a retired DC: A newly promoted domain controller can end up with forwarders that point at the other DCs, including one you're about to retire. After the demotion, every external lookup waits on a server that's gone before moving on, so outside websites turn sporadically slow while internal names stay fast. That's the pattern in this r/sysadmin thread after a 2012 R2 demotion: the top reply was to check forwarders and root hints, and the poster reported faster lookups after removing the stale entries.

After any DC change, run Get-DnsServerForwarder on every remaining DC and remove addresses that no longer answer.

Split-horizon DNS not resolving correctly: If internal and external zones share the same name (e.g., company.com), clients must hit the internal DNS server for internal resolution. If they're getting the external resolver for internal queries, you'll see intermittent "host not found" errors for internal services.

Verify which DNS server is being used:

code
ipconfig /all
nslookup internalserver.company.com

If the response comes from an external resolver, your DHCP is handing out the wrong DNS server. Fix the DHCP scope options on the DC or on your router.

DNS scavenging not configured: Over time, AD DNS accumulates stale A records that can cause incorrect resolutions. Scavenging needs two switches: on the zone (DNS Manager > right-click zone > Properties > General > Aging, with the default 7-day no-refresh and 7-day refresh intervals) and on at least one server (right-click server > Properties > Advanced > Enable automatic scavenging of stale records). Turning on only the zone setting removes nothing.

Fix 8: Authoritative DNS - TTL and CNAME Chains

If client-side DNS is fine but the sites your clients run are loading slowly for their end users, the issue might be on the authoritative side.

TTL values that are too low: Some hosting control panels default to 60-second TTLs. That means every resolver in the world re-queries your nameserver every minute. For a busy site, this hammers your nameservers and means every cold visitor gets a live lookup instead of a cached one.

Check your TTLs:

bash
# Find the authoritative nameservers, then read the configured TTL (second column)
dig +short NS example.com
dig +noall +answer example.com @ns1.example-dns.com

Set records to 3600 seconds (1 hour) for stable infrastructure. 300 seconds during migrations is fine temporarily, but increase it again afterwards.

CNAME chains: Each CNAME that points into a different zone can add a lookup. www → cdn.provider.com → anycast.provider.net → A record can mean three lookups before you get an IP. Flatten chains where possible. DNS hosts sell this under different names: Cloudflare calls it CNAME flattening, Amazon Route 53 uses alias records, and other providers offer ALIAS or ANAME records at the zone apex.

How to Reduce DNS Lookups on a Website

Every distinct hostname a page loads from costs the visitor's browser a lookup before the first byte from that host. Count them in the browser's developer tools (add the Domain column to the Network tab and sort by it), drop third-party hosts the page doesn't need, and add resource hints for the few that load early:

html
<link rel="preconnect" href="https://cdn.example.com">
<link rel="dns-prefetch" href="https://analytics.example.com">

preconnect resolves the name and opens the connection; dns-prefetch only resolves it, which makes it the lighter choice for hosts needed later in the page.

If "reduce DNS lookups" came from an email deliverability warning, that's a different limit: RFC 7208 caps an SPF check at 10 mechanisms that trigger DNS queries, and a record past that fails with a permerror. Our DMARC guide walks through SPF alongside DKIM and DMARC.

Monitoring DNS at Scale

One-off fixes aren't enough when you're managing 30+ client environments or a multi-site estate. You need to know when DNS degrades before a client or a colleague tickets you.

Zabbix (open-source) has built-in DNS check items. Since Zabbix 7.0, the agent's net.dns.perf item returns the response time in seconds, or 0 when the DNS service is down, so one item covers both latency and failure:

code
net.dns.perf[,google.com,A,3,1]

Alert if the value exceeds 0.5 or drops to 0. Run it from an agent inside each site so the check sees what that site's devices see; on Windows, the server, timeout and count parameters need Zabbix agent 2.

Prometheus + Blackbox Exporter can probe DNS endpoints and expose response times as metrics. Combine with Grafana for visibility across all client sites in one dashboard. Our Prometheus monitoring review covers the trade-offs of running it.

Both tools are free, and both watch the resolver from the network side. To see what endpoints see, add a scheduled script check that times a lookup on each device and fails above a threshold; TacticalRMM runs PowerShell and shell checks like this on a schedule.

The same check works in any RMM platform that runs scripts. OpenMSP is published by Flamingo, which builds OpenFrame: open, AI-native infrastructure for IT and security with RMM, a native PSA and remote access in one platform. Its built-in RMM runs the timing check on a schedule across every site, with AI agents working inline: Fae resolves support requests and Mingo runs IT operations. It costs $1 per device a month with 10M AI tokens included, or $0.80 on annual billing, after a 14-day free trial.

Add DNS Checks to Site Onboarding

The cheapest fix is the one written into the build. Whether you're onboarding a client site or standing up a new office, a short DNS check at handover catches the causes above before users notice them.

CheckCommand or placePass
Lookup time from the sitedig google.com or Resolve-DnsNameUnder 150ms, no whole-second stalls
DNS servers handed out by DHCPRouter or DHCP scope optionsInternal DCs for domain sites, otherwise the chosen resolver
DNS servers on each adapterGet-DnsClientServerAddressNo dead or leftover VPN entries first in the list
DC forwardersGet-DnsServerForwarderOnly addresses that answer
IPv6ping -6 to a public addressRoutes end to end, or IPv4 preferred on purpose
Linux resolver options/etc/resolv.confNo ndots:5 outside Kubernetes
MonitoringZabbix or Prometheus probe at the siteAlerts on latency and on failure

Quick Reference: What to Check First

SymptomMost likely causeFirst fix
All sites slow, first visit onlyNo local DNS cachingDeploy Unbound, or restore the DNS Client service (Dnscache)
5-second hangs on specific sitesIPv6 AAAA timeoutFix IPv6, or add single-request-reopen to resolv.conf
Slow on Linux, fast on Windowsndots misconfigurationSet options ndots:2 in resolv.conf
Intermittent, gets worse over timesystemd-resolved stuckresolvectl flush-caches, restart service
Slow only on some Windows machinesGhost network adaptersRemove via Device Manager > Show hidden
One-second delay on every new name (Windows)First DNS server on the adapter doesn't answerFix or remove it, check Get-DnsClientServerAddress
Slow inside Kubernetes podsndots:5 search expansionSet ndots to 2 in the pod's dnsConfig
Internal names don't resolveAD DNS / split-horizonCheck DHCP DNS options, verify DC forwarders
External sites slow after a DC changeForwarders pointing at a retired DCGet-DnsServerForwarder, remove dead entries
External sites slow from all endpointsISP resolver overheadSwitch to 1.1.1.1 at router level
Client's site slow for end usersLow TTL or long CNAME chainIncrease TTL, flatten CNAME

Switching resolvers fixes one cause of slow DNS. The rest live in resolv.conf options, IPv6 stacks that half-work, adapter order and DC forwarders, and once each check is part of your site build, the same tickets stop coming back every few months.

If you want to compare notes on open-source DNS tooling with other MSPs and IT admins, join the OpenMSP community. It's where operators share working configs 🦩

Kristina Shkriabina

Content Marketing Lead

Ohayo! I run content, SEO, social, and community at Flamingo. Before IT, I worked as a correspondent for Ukraine's Public Broadcasting Company and have a Master's in journalism.

Related Content

Frequently Asked Questions

/blog/how-to-fix-slow-dns-lookup

Loading related content and questions