Wednesday, July 13, 2016

How to Lookup the MX record(s) for a Domain

Windows (nslookup):

You can use nslookup in Windows to query DNS zones.  To lookup the MX records for a domain, open a command prompt:
C:\> nslookup
Default Server:  xxxxxxxxxx
Address:  xxx.xxx.xxx.xxx

> set type=mx
> example.com

Non-authoritive answer:
example.com      MX   preference = 10, mail exchanger = mail1.example.com
example.com      MX   preference = 20, mail exchanger = mail2.example.com
OSX / Linux / BSD (host):

I’ll explain how to use host in OSX and on Linux/BSD. Anyway, host is installed by default on OSX, but probably not on Linux or BSD – you may have to install it manually. (On Ubuntu and Debian, you can install it by using ‘apt-get install host‘ if it’s not already installed).

From a terminal:
$ host -t MX example.com
example.com mail is handled by 10 mail1.example.com.
example.com mail is handled by 20 mail2.example.com.
MX records are always an FQDN (Fully Qualified Domain Name, if setup properly) and have priority levels which are the 10 and 20 you see.  Priorities are important; if a mail server tries to send an e-mail to anything@thedomain, then it’ll use the LOWEST priority mail server first. If this accepts the mail, then job complete.. if it times out or the lookup of the IP address doesn’t complete, then it’ll try the next lowest priority mail server. You can also use two mail servers with the same priority level, and mail servers will just choose one when sending – useful for a bit of simple load balancing.

























0 comments:

Post a Comment