What is the order DNS servers are called?

  • When you have more than one DNS server, what is the order of selection? Can you control it?

    My pfSense router accesses a pi-hole server in an i5 PC. It's new but appears to be working great. I actually have two i5 servers in my basement (Dell Optiplex micro 3020). They were under $200 each as refurbs and I had enough extra equipment at home to beef them up. One's a file/media/backup server. The other is a playground, sort of a backup to the backup and the pi-hole server.

    I'm thinking of making the other one into a failover pi-hole server. The current server will always have the most up to date white lists so I want it used most of the time.

    The failover config should - I think - be a no-brainer (add the IP into the DHCP DNS server area and adjust my LAN port forward port 53 to include the new pi-hole server - probably BELOW the current pi-hole server rule.

    (Config; Add pi-hole server IP to DHCP screen. LAN port forward port 53 to pi-hole servers. Nothing else worked as described in various set-up articles.)

    I would like confirmation that this would work as intended.

    Thank you.

  • LAYER 8 Global Moderator

    You have no control over what dns a client would use if there is more than 1.. There are all kinds of variables a client might use depending on os, etc. to figure out which one to ask, etc.. And they could flip about how the client sees fit..

    This is why you need to make sure that the dns clients if pointing to more than 1 resolve the same stuff the same way..

    So for example if you have list where something is blocked and another where its not - if client asks ns 1, and gets back nx or bogas IP (blocking it) then no its not going to go ask the other one, etc.

    If gets nothing back (ie timeout) then yeah it will go ask the other ns.. But in such a case your whitelist/blacklist need to be same on both or you could run into problem were some clients gets blocked, others don't etc. Since you can not really control which one the client might decide to ask first..

    Shoot its even possible that the client could ask both - and use the first response, etc.

  • @johnpoz Thanks. Not so simple.

    Maybe I'll install it in the other server (Hyper-V) and keep the VM off until needed. Better than nothing. Or keep it on and reasonably current, but not point pfSense to it unless needed. Or keep pfBlockerNG installed but disabled for emergency purposes. This could give me time to play around with the new pfBlockerNG version without being disruptive.

    I had planned to periodically install pi-hole backups into the 2nd pi-hole server manually. I'm not good enough with Linux anymore to figure out a script to automate in background. I'm sure that is possible, just not by me.

  • My solution:

    I tried removing pfBlockerNG to replace it with pfBlockerNG-devel and ran into an issue with it. The new package sucked in some lists from the old install that could not be removed. I removed the new version and reinstalled the original pfBlockerNG. To the good, it installed all my old lists plus all of the new ones I installed for pfBlockerNG-devel.

    I will use pfBlockerNG as the backup for pi-hole when/if needed. It would take 10 seconds to switch over. it has about 200,000 sites blocked vs 1.3 milion with pi-hole, although I thought my old pfBlockerNG blocked a fair amount of sites as it was. (My LAN port 53 bypass sends all DNS requests to pi-hole, so pfBlockerNG can remain active with no CPU hit - of course it doesn't do anything, either)

    Edit: DNSBL worked fine with the setup described above. I disabled it for now since it was duplicative.

Log in to reply