It is essential to have proper DNS entries for your email infrastructure. I have seen many misconfigured DNS system causing the entire mail system to go bad. Some serious scenarios include:
- Mail server being blacklisted
- Mail server has bad reputation causing email sent from that server to be bounced (unaccepted by other mail servers).
- Mail loss leading to business loss.
In assisting the administrator to troubleshoot email issues, I have included here a few command-line tools such as NSLOOKUP, TELNET, and PING for your references.
Ping to verify a host (A) record. We need to verify that a host (A) record exists for email. This host record should potentially be placed in the MX record section as well. Ping and ensure that the record returns an IP address. You may not get a reply from the ping as the administrator might have blocked pinging on the firewall.
NSLOOKUP to verify forward host (A) record. Instead of pinging, we can use the NSLOOKUP command to find out the IP address of the host record. This host record – as mentioned before – should be placed in the MX record section.
In the example below, I try to look up the record mail.dalaris.com using the Google’s DNS server (188.8.131.52).
Note that I did not have to type 184.108.40.206 at the end and the result would be the same. This is because my Primary DNS server is actually 220.127.116.11 as set in the system.
Suppose I would like to use 18.104.22.168 as the DNS Server to test my NSLOOKUP, I can do so by typing:
nslookup mail.dalaris.com 22.214.171.124
NSLOOKUP to verify reverse (PTR) record. PTR record is called a reversed DNS record that points an IP address to a host record. This host record should be placed in your MX record database. In the example below, nslookup cannot locate a PTR record for the IP address 126.96.36.199.
Let’s perform a reverse lookup for another IP address to see if it exists:
nslookup 188.8.131.52 184.108.40.206
Verify MX records. Using nslookup, we can verify the existence of the MX records for a domain using the set q=mx statement.
We can also use nslookup –query=mx domain.com to check for MX record,
Verify SPF record. SPF records are TXT records that mail servers use to validate the source of email. It is nowadays essentials to have SPF record configured correctly for your mail server in order to avoid potential problems for email flow.
nslookup # this will use our system DNS server which is 220.127.116.11 in my case
server 18.104.22.168 # this will change the DNS server to 22.214.171.124
set type=txt # check SPF record
google.com # check SPF record for Google.com
How to use Telnet to test SMTP server
Step 1) Use nslookup to find out what the MX records for a domain are. There might be multiple MX records for backup reasons. In the example below, there are five MX records for the domain pssnet.com. The one with highest priority is spamfilter.pssnet.com. Should this host goes down, the next prioritized one, which is mta1.pssnet.com will receive mail on behalf of the failed server.
Use TELNET to telnet into port 25 of the mail server. In this case, I choose the second prioritized server to access.
telnet mta1.pssnet.com smtp
Issue the HELO command:
Issue the mail from command
mail from: Chuong@test.com
Issue the rcpt to: command
Example: rcpt to: firstname.lastname@example.org
Issue the data command
Now enter the email from, to, subject, and body. Enter a period (.) when done.
Type quit to exit TELNET.
Check Email to verify that we receive the test email.