Split Domain Config possible

Hi Guys
Is this generally possible with pihole?

External-Domain: sunny.com
Internal-Domain: rainy.com

  • External Service: e.g. Mail-Sevice (mail.sunny.com points to their MailServer)
  • Internal Service: e.g. File-Server (file.sunny.com points to my router where ports are NATed to target)

(A) Internal / External Clients:
Hey Pihole I want to setup my mail Programm could you tell me the IP of mail.sunny.com?

  • sure no problem champ, here you are x.x.x.x (external ip of mail server)

(B) External Client:
Hey external DNS-Server I want to copy a file to file.sunny.com could you tell me the IP?

  • sure no problem champ, here you are x.x.x.x (external ip of router)

(C) Internal Client:
Hey Pihole I want to copy a file to file.sunny.com could you tell me the IP?

  • sure no problem champ, here you are x.x.x.x (internal ip the Fileserver)

At the moment A and B work and while C also works, they ask the external DNS and are then routed back through the router. I would like Internal Clients to know the internal IP of the fileserver so that they can communicate with the fileserver without going over the router....

I have done this already with "company"-grade gear and I remember having to maintain external and internal records for everyhing i wanted to reach from outside and for everything I wanted to reach from inside.

It would be cool to say hey Pihole: if internal Clients look for file.sunny.com give them the internal ip of the file-server and for all other queries to *.sunny.com send them outside.
That would be awesome. If not possible, I would also be okay with having to maintain internal and external records for domain sunny.com

But at the moment I dont even know if pihole knows sunny.com or rainy.com

Mike

Local resolution of fully qualified names takes precedence over forwards to upstream DNS.
You can supply any desired hostname to IP mapping via /etc/hosts on your Pi-hole machine, see also existing answers/remarks, e.g. in Can I use Pi-Hole DNS as a online hosts manager? as well as Set own DNS enteries via web interface - #2 by Bucking_Horn

Thanks m8

One more question:

As soon as I add "file.sunny.com" to the etc/hosts file will also have to add mail.sunny.com in the file as well?

Or will it relay queries that it can't handle outside?

Your entries in /etc/hosts will be matched exactly, so if you would redirect google.com, www.google.com would still resolve fine, or in your case, if you just add file.sunny.com, a DNS query for mail.sunny.com will still be forwarded upstream.

Don't forget to restart Pi-hole's DNS server after editing (takes a few seconds):
pihole restartdns

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.