0

Hi all,

Because HOSTS file could only define static A records, is there a way I could inject a MX record/create arbitrary name into a Windows workstation DNS Cache service?

TIA

3 Answers 3

2

No, not without running your own resolver on the workstation itself.

1
  • 1
    Or some other machine under your control.
    – Richard
    May 12, 2009 at 10:19
1

MX-records are used by e-mail servers to find out which host(s) to send e-mails to for a domain name.

The Windows DNS cache (the "DNSClient" service) is populated whenever a program uses the Windows API "GetHostByName" (and a few other API functions).

However, there are no Windows API functions for retrieving MX-records - only for A/AAAA records and PTR-records (reverse).

Therefore e-mail servers have to do their own DNS lookups directly (via IP sockets etc.) - bypassing the Windows DNS cache.

So even if you could inject MX-records into the Windows DNS cache somehow, they wouldn't be used by your e-mail server.

The solution probably is to run a real DNS server program on the same computer as the mail-server and configure Windows / the e-mail server to use this. This allows you to configure MX-records (and other record types) directly for any domain name that you want. A nice choice would be Simple DNS Plus.

0

While you can't add mx records to a host file, you can "override" the address of the mail exchange. MX records point to host names so all you have to do is map the hostname of any MX record to an IP address in your HOSTS file.

You must log in to answer this question.