1

This question already has an answer here:

I have a mailserver that should resolve everything from mydomain.com to an internal DNS server and everything else (to send email) from an external DNS server. The internal DNS server can't resolve (forward) from the public internet.

It appears to me that that can't be done in resolv.conf and i wonder if i need to setup DNS locally on that mailserver.

Or are there other ways?

marked as duplicate by MadHatter, womble, HBruijn, kasperd, Falcon Momot Sep 7 '15 at 7:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Yep, you'll need a local DNS server. But managing split-horizon DNS is a nightmare; avoid it at all costs. – womble Sep 4 '15 at 6:49
0

If you already have an internal DNS server for example.com and you want your mail server to query it for *.example.com and the public DNS for everything else then you can use dnsmasq to do this.

The -S, --local, --server= directive allows you to

Specify IP address of upstream servers directly ... If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers:

  • This was helpfull to my solution. To bad that it appears that you can only enter 1 DNS server for an internal domain, no failover. – user3193469 Sep 4 '15 at 12:54
0
systemctl enable dnsmasq.service
systemctl start dnsmasq.service

/etc/resolv.conf:

nameserver ::1
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844

/etc/dnsmasq.conf:

server=/mydomain.com/2001:DB8:cafe::53

Not the answer you're looking for? Browse other questions tagged or ask your own question.