Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

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

share|improve this answer
1  
Or some other machine under your control. –  Richard May 12 '09 at 10:19
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.