Primary / Secondary DNS Configured but fail-over doesn't work after primary DNS shutdown

MuttleyDoSomething 35 Reputation points
2025-01-23T15:10:12.2966667+00:00

I am using a Windows 10 client. There are 2 DNS servers configured and working fine. Primary and Secondary DNS IP's are handed out by the router and the network is fine.

However...
If the primary DNS server is shut down the secondary DNS server should instantly kick in right?

But this does not work. Windows 10 keeps trying to use the primary server and all requests fail.
The solution used to be to disable DNS Client services, or the DNS Cache but if I do this on Windows 10 all drive shares stop working.

I hear from some posts that the secondary DNS server will kick in after a time-out of about two hours but this is not quite the 'seamless' effect I'm after.

Is there a way to get the secondary DNS server to instantly kick-in as it should do?

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
720 questions
{count} votes

Accepted answer
  1. Ganesh Patapati 3,135 Reputation points Microsoft Vendor
    2025-01-23T21:38:37.9333333+00:00

    Hi MuttleyDoSomething

    Greetings!

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    NOTE: Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution.

    Please click "Accept" the answer as original posters help the community find answers faster by identifying the correct answer.

    Issue: Primary / Secondary DNS Configured but fail-over doesn't work after primary DNS shutdown

    Resolution: I've managed to find a solution for Windows 10/11 so we don't have to put up with 'expected behaviour' (which seems to be a synonym for 'badly programmed') and can instead provide an actual solution.

    It involves a few registry additions, but the solution works perfectly for most small to medium sized networks without flooding the network with DNS requests and the name servers fail-over instantly.

    In regedit locate the key: \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters

    Create a DWORD called MaxCacheTtl and set it's value to 1 (sets cache TTL to 1 second) Create a DWORD called MaxNegativeCacheTtl and set it's value to 0 (this stops the system caching invalid or unresolved DNS values Create a DWORD called ServerPriorityTimeLimit and set it's value to 0 (this stop Windows from persisting with the primary name server and allows it to fall through to the secondary Create a DWORD called ServiceDllUnloadOnStop and set it's value to 1

    Finally reboot your system You can export the entire key so it can be added to other Windows 10/11 systems

    Now as soon as your primary DNS server goes offline the secondary will kick-in instantly. Welcome to the world of correctly configured client DNS.

    PS. Sorry, also 'expected behavior' and what actually happens are two different things. The Windows 10 client is given 2 DNS servers, primary and secondary by the DHCP server. In an uncorrected Windows network when the primary DNS server goes offline the secondary DNS server is NOT queried whatsoever. (Sometimes the timeout is 2 hours!) though waiting 2 hours for a webpage to load is a little excessive.

    Your table suggests that after 1 second of the primary DNS server being unresponsive the secondary server is queried, but in reality the DNS request simply fails. If Microsoft Windows DNS actually worked like this I wouldn't have needed to ask the question in the first place, nor in the past would I have had to find a solution in disabling the Windows Client DNS service.

    Windows DNS has had these flaws for over 30 years and in all cases a workaround has been needed.

    Also sorry, I can't see any button/box that says 'Solved'


    Hope this clarifies!

    If above is unclear and/or you are unsure about something add a comment below.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    Looking forward to your response and appreciate your time on this.

    Regards,

    Ganesh


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.