1

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?

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

2 Answers2

1

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:

user9517
  • 115,471
  • 20
  • 215
  • 297
  • 1
    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 04 '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
sebix
  • 4,313
  • 2
  • 29
  • 47