Modify DNS cache other than HOSTS file?
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
No, not without running your own resolver on the workstation itself.
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.