TechnitiumSoftware/DnsServer · error · DnsServerException

Failed to resolve forwarder domain name for all forwarders:

Error message

Failed to resolve forwarder domain name for all forwarders: {forwarders}

What it means

Thrown when none of the forwarder hostnames (forwarders specified as domain names rather than IPs) could be resolved to addresses. The server first resolves each forwarder's domain name via System.Net.Dns (or local resolver) and only then queries them; zero successes is fatal.

Source

Thrown at DnsServerCore/Dns/DnsServer.cs:5236

                        }

                        Exception lastException = null;

                        foreach (Task<NameServerAddress> resolveTask in resolveTasks)
                        {
                            try
                            {
                                newForwarders.Add(await resolveTask);
                            }
                            catch (Exception ex)
                            {
                                lastException = ex;
                                _resolverLog?.Write(ex);
                            }
                        }

                        if (newForwarders.Count < 1)
                            throw new DnsServerException("Failed to resolve forwarder domain name for all forwarders: " + forwarders.Join(), lastException);

                        forwarders = newForwarders;
                    }

                    //query forwarders and update cache
                    DnsClient dnsClient = new DnsClient(forwarders);

                    dnsClient.Cache = dnsCache;
                    dnsClient.Proxy = _proxy;
                    dnsClient.IPv6Mode = _ipv6Mode;
                    dnsClient.RandomizeName = _randomizeName;
                    dnsClient.Retries = _forwarderRetries;
                    dnsClient.Timeout = _forwarderTimeout;
                    dnsClient.Concurrency = _forwarderConcurrency;
                    dnsClient.UdpPayloadSize = _udpPayloadSize;
                    dnsClient.DnssecValidation = dnssecValidation;
                    dnsClient.EDnsClientSubnet = eDnsClientSubnet;
                    dnsClient.ConditionalForwardingZoneCut = question.Name; //adding zone cut to allow CNAME domains to be resolved independently to handle cases when private/forwarder zone is configured for them

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Specify forwarders by IP address to eliminate the bootstrap resolution step.
  2. Ensure the server's own system resolver (or bootstrap) can resolve the forwarder hostnames (configure a known-good upstream just for bootstrap).
  3. Correct typos in forwarder hostnames; verify with nslookup/dig from the server host.
  4. Restore upstream connectivity before relying on hostname-based forwarders.

Example fix

// before
server.Forwarders = new[] { "dns.internal.example.com" };

// after
server.Forwarders = new[] { "10.0.0.53:53" };  // IP to avoid bootstrap resolution
Defensive patterns

Strategy: fallback

Validate before calling

IList<NameServerAddress> PreferIps(IEnumerable<NameServerAddress> fwd)
    => fwd.Select(f => f.IsIPEndPoint ? f : new NameServerAddress(IPAddress.Parse(System.Net.Dns.GetHostAddresses(f.Host)[0].ToString()))).ToList();

Type guard

static bool AllForwardersAreIps(IEnumerable<NameServerAddress> fwd) => fwd.All(f => f.IsIPEndPoint);

Try / catch

try { await server.ResolveAsync(q); }
catch (DnsServerException ex) when (ex.Message.Contains("Failed to resolve forwarder domain name")) { /* replace hostname forwarders with IPs, retry */ }

Prevention

When it happens

Trigger: Configuring forwarders using hostname:port or domain names (e.g. dns.example.com) when the bootstrap resolution path itself is broken; forwarder hostnames that do not exist; the resolver used for bootstrapping has no working connectivity.

Common situations: Forwarder entry like 'my-resolver.internal' on a host whose own DNS points only at that same (broken) resolver (circular dependency); typo in forwarder hostname; no internet connectivity to resolve public forwarder hostnames; DoH/DoT bootstrap failing.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/1aa2c1c2a2a8d0f1. Report an issue: GitHub.