Somehow, I've been having a chronic issue where my computer will get an invalid DNS lookup in its cache for either of the two Exchange servers I use from Mail.app. My workplace runs one of the Exchange servers and I run the other (they are totally unrelated, hosted by different companies, etc.). The problem manifests as a certificate domain error.
When it happens, I can run
nslookup mail.mydomain.com and I see the incorrect IP address (usually owned by either Apple or Akamai), but if I run
nslookup mail.mydomain.com 18.104.22.168, I get the correct address. In fact, if I specify any of my computer's or router's DNS servers to
nslookup, I get the correct address.
My real quest is to find out why this keeps happening, and to do that, I'd like to know which server is supplying me this bad DNS entry. Is there a way to check my DNS cache to see where this bad lookup came from?