3 Easy Ways To Check DNS (Domain Name Server) Records In Linux Terminal
There are many third party website is available to check domain DNS records but as a server administrator you should know this small geek to check the domain DNS records from the Linux terminal.
This small geek will help you to check DNS records information when you doesn’t have GUI (on headless server). In Linux three command line utilities are available to check this information.
The utilities are below.
- Host Command
- Dig Command
- NSLookup Command
DNS stands for Domain Name System or Domain Name Servers translates Internet domain and host names to IP addresses and vice versa.
DNS is a hierarchical decentralized naming system for computers, services, or other resources connected to the Internet or a private network. It’s basically mapping files that tell the DNS server which IP address each domain or host is associated with, and how to handle requests sent to each domain. It stores various information about a domain & host such as A, AAAA, CNAME, MX, PTR, NS, SOA, SRV, TXT, and NAPTR.
A Record: A record stands for Address record. The ‘A’ record specifies the IP address (IPv4) of a host. Whenever DNS server get a query to resolve domain-name, it will refer the A record to answer the IP address.
AAA Record: The ‘AAA’ record specifies the IP address (IPv6) of a host.
NS Record: NS Record stands for Name Server record. NS Records maps a domain name to a list of authoritative DNS servers.
MX Record: MX Record stands for mail exchange record. MX Records maps a domain name to a list of mail exchange servers.
PTR Record: PTR record stands for Reverse lookup record or Pointer record. A PTR record maps the IP address to a specific host.
CNAME Record: CNAME Record stands for Canonical Name. CNAME record is used to create aliases that point to other names such as WWW, FTP, MAIL & subdomains to a domain name. Example : a CNAME record can associate the subdomain www.2daygeek.com with 2daygeek.com
SOA Record: SOA record stands for Start of Authority records. SOA records contain information about a DNS zone such as Primary nameserver, Hostmaster E-mail address, zone file seriel number, zone transfer interval and zone expiry details.
TXT Record: TXT Record stands for text record. A TXT record is a type of DNS record that provides text information to sources outside your domain. The text can be either human-or machine-readable and can be used for a variety of purposes.
SPF Record: SPF Record stands for Sender Policy Framework. SPF is an extension to the SMTP mail protocol which is used for e-mail authentication. SPF record used to verifies that the message came from an authorized mail server or not. SPF is designed to detect SPAM & PHISHING mail sender’s, IP address which was included in e-mail header.
DKIM Record: DKIM record stands for Domain Keys Identified Mail. DKIM is an email validation system designed to detect email spoofing by providing encryption authentication to receiving mail exchangers. It will check whether the incoming mail domain is authorized by the domain’s administrators and that the email (including attachments) has not been modified during transport. A digital signature included with the message can be validated by the recipient using the signer’s public key published in the DNS.
1) Check DNS Records Using Dig Command
Dig stands for domain information groper is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.
# dig 2daygeek.com ANY +noall +answer ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> 2daygeek.com ANY +noall +answer ;; global options: +cmd 2daygeek.com. 12922 IN TXT "v=spf1 ip4:18.104.22.168 +a +mx +ip4:22.214.171.124 ?all" 2daygeek.com. 12693 IN MX 0 2daygeek.com. 2daygeek.com. 12670 IN A 126.96.36.199 2daygeek.com. 84670 IN NS ns2.2daygeek.in. 2daygeek.com. 84670 IN NS ns1.2daygeek.in.
2) Check DNS Records Using NSlookup Command
Nslookup is a program to query Internet domain name servers. Nslookup has two modes interactive and non-interactive.
Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain.
Non-interactive mode is used to print just the name and requested information for a host or domain. It’s network administration tool which will help them to check and troubleshoot DNS related issues.
# nslookup -type=any 2daygeek.com Server: 188.8.131.52 Address: 184.108.40.206#53 Non-authoritative answer: 2daygeek.com origin = ns1.2daygeek.in mail addr = magesh.gmail.com serial = 2013110202 refresh = 86400 retry = 7200 expire = 3600000 minimum = 86400 2daygeek.com nameserver = ns1.2daygeek.in. 2daygeek.com nameserver = ns2.2daygeek.in. Authoritative answers can be found from: 2daygeek.com nameserver = ns2.2daygeek.in. 2daygeek.com nameserver = ns1.2daygeek.in.
3) Check DNS Records Using Host Command
host is a simple utility for performing DNS lookups. It is normally used to convert names to IP addresses and vice versa. When no arguments or options are given, host prints a short summary of its command line arguments and options.
# host -a 2daygeek.com Trying "2daygeek.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59145 ;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 2, ADDITIONAL: 3 ;; QUESTION SECTION: ;2daygeek.com. IN ANY ;; ANSWER SECTION: 2daygeek.com. 86321 IN SOA ns1.2daygeek.in. jeyakabil.gmail.com. 2013110202 86400 7200 3600000 86400 2daygeek.com. 14233 IN TXT "v=spf1 ip4:220.127.116.11 +a +mx +ip4:18.104.22.168 ?all" 2daygeek.com. 12127 IN MX 0 2daygeek.com. 2daygeek.com. 12127 IN A 22.214.171.124 2daygeek.com. 84127 IN NS ns1.2daygeek.in. 2daygeek.com. 84127 IN NS ns2.2daygeek.in. ;; AUTHORITY SECTION: 2daygeek.com. 84127 IN NS ns2.2daygeek.in. 2daygeek.com. 84127 IN NS ns1.2daygeek.in. ;; ADDITIONAL SECTION: 2daygeek.com. 12127 IN A 126.96.36.199 ns1.2daygeek.in. 12127 IN A 188.8.131.52 ns2.2daygeek.in. 12127 IN A 184.108.40.206 Received 304 bytes from 220.127.116.11#53 in 13 ms