At some point, DNS will make its way to you. For the older generation System Administrator, there is a famous quote “It is always DNS”. DNS propagation in some countries might take 1×24 hour to propagated, the ISP had some weird caching technique. To troubleshooting DNS problem on Linux use dig or nslookup. TTL (time to live) is important when setting DNS record, the lower TTL goes, the public DNS will more often query the records for changes.
6 of the most used DNS records
1. A record, used to store an IP address.
2. AAAA, IPv6 version of A record
3. CNAME, canonical name or alias
4. MX, mail exchange record
5. NS, name server record
6. TXT, text record, usually used to verify ownership of the domain for some services, such as Google Webmaster, Bing Webmaster, Docusign.
Check DNS Records
On following tutorial both dig and nslookup will be used. It handy to know both tools because some distro include one or the other on default instalation.
A Record
To check the A record using dig
dig a domain.com
the result similiar to just dig domain.com
, it’s defaulted to check A record.
to check A record using nslookup
nslookup domain.com
MX Record
MX record used to serve mail server
dig mx domain.com # or nslookup <enter> set type=mx <enter> domain.com <enter>
nslookup command on Linux compatible with Windows.
Automated Script
A simple script to check multiple public DNS server
for SERVER in 1.1.1.1 8.8.4.4 9.9.9.9 208.67.222.222 8.26.56.26 64.6.64.6; do echo "$SERVER" dig mx domain.com @$SERVER +short echo "--------------------------" done
replace domain.com with yours, and mx with any record.
Let’s test the script to check A record of domain atetux.com
> for SERVER in 1.1.1.1 8.8.4.4 9.9.9.9 208.67.222.222 8.26.56.26 64.6.64.6; do > echo "$SERVER" > dig a atetux.com @$SERVER +short > echo "--------------------------" > done 1.1.1.1 104.27.174.65 104.27.175.65 172.67.141.163 -------------------------- 8.8.4.4 172.67.141.163 104.27.175.65 104.27.174.65 -------------------------- 9.9.9.9 104.27.174.65 172.67.141.163 104.27.175.65 -------------------------- 208.67.222.222 104.27.174.65 104.27.175.65 172.67.141.163 -------------------------- 8.26.56.26 104.27.175.65 172.67.141.163 104.27.174.65 -------------------------- 64.6.64.6 104.27.174.65 172.67.141.163 104.27.175.65 --------------------------