Using NSlookup.exe for DNS Testing

In a future post I’m going to cover how to use Telnet to query a mail server for testing and troubleshooting SMTP, but before we can test a mail server we need to know how to find out the mail server for a particular domain.

NSlookup.exe is a command line tool that can be used to test and query DNS servers.

To start it open a command prompt and type nslookup.


Set the type of record we want to query in this case we want to query the mail exchange record (MX), type set type=mx.

nslookup set type mx

Type the name of the domain you want to query the MX record of. In the example below I’ve queried You can see there are two MX records for the The MX record with the lowest preference is used first, but in the event it is unavailable the MX record with the next lowest preference will be used.

nslookup bbc mx records

All of the queries above have been done against my local DNS server, in this case my router is acting as a DNS server (, but you can change the server that you query against.

In the example below I’ve changed the server to one of the Google public DNS servers, and queried the MX record for

nslookup change server

Microsoft have a good knowledgebase article available here, if you require further information.