DNS Explained – Part 2 (Tools)

In linux, there are some tools that we use to check what DNS settings that domain name are using. Most linux servers to include Redhat / CentOS / Debian use built in DNS services such as named. The named service is the built in DNS service which control panel such as Plesk and CPanel use to host their DNS settings locally.

Commands Used for DNS Queries:

  • nslookup command – Name Server Lookup Tool for finding the name servers where the zone file is located for the domain you are looking for.




  • dig command – Just using dig with a domain name brings back the IP Address of where the domain lives.





  • whois command – Looks for information about the domain stored at ICANN.





  • host command – The host command is used to do DNS lookups and will convert a domain name to an IP address.









Files used in DNS related queries:


  • /etc/resolv.conf – holds name servers used by server





  • /etc/hosts – holds all host related information. Contains domain names and IP Addresses








Search for domains mail exchanger record:
  • nslookup -type=mx domain.com





  • dig mx google.com 





Search for domains A record:
  • nslookup -type=a domain.com





  • dig a domain.com





Search for domains Name Server record:



  • nslookup -type=ns domain.com





  • dig ns domain.com





Search for domains CNAME record:



nslookup -type=cname domain.com






  • dig cname domain.com





Search for domains SPF record:



  • nslookup -type=spf domain.com





  • dig spf google.com





List All records for a domain:



  • nslookup -type=any domain.com





  • dig google.com any





dig @ domain.com









When migrating zones from GoDaddy, make sure that everything comes across except for the GoDaddy specific entries i.e. domaincontrol.com. Double or even triple check the information to makes sure that everything needed has been added to the /var/named/domain.com.hosts file.
– Verify that all new domains that have been added have the group of named added.
chgrp named /var/named/domain.com.conf
– Verify that the named service configuration file does not have errors.
named-checkconf /etc/named.conf
Also check the domain zone files to make sure that there are no errors.
[root@dns01 named]# named-checkzone directdns.com directdns.com.hosts
zone directdns.com/IN: loaded serial 1389974311
[root@dns01 named]# named-checkzone domain1.com domain1.com.hosts
zone domain1.com/IN: loaded serial 1389974311
– Reload the named service configuration.
[root@dns01 named]# rndc reload
server reload successful
– Restart the named service.

[root@dns01 named]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
– Verify the named service status.
[root@dns01 named]# service named status
version: 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 (Not available)
CPUs found: 2
worker threads: 2
number of zones: 48
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
named (pid  7264) is running…

[root@dns01 ~]# cat /var/named/domain1.com.hosts
$ttl 300
domain1.com.  IN      SOA     dns01.domain2.com. postmaster.domain2.com (
                        38400 )
domain1.com.  IN      NS      dns01.domain2.com.
domain1.com.  IN      NS      dns02.domain2.com.

@                               MX      10      mx.domain1.com.
@                               TXT     “v-spf1 a mx include:subdomain.domain3.com incluide:authsmtp.com ~all”
as                              A
sbam                            A
tc                              A
ald                             A
osi                             A
mx                              A
pd                              A
isi                             A
nald                            A
ldsaving                        A
quasar                          A
sat                             A
conectado                       A
nsb                             A
mlld                            A
lds                             A
ctl                             A
peak                            A
cbs                             A
lld                             A
nlds                            A
dld                             A
dp                              A
bnld                            A
bsa                             A
lda                             A
lcr                             A
ceot                            A
ftp                             CNAME   domain1.com
www                             CNAME   domain1.com

[root@dns01 ~]# cat /var/named/directdns.com.hosts
$ttl 300
directdns.com.      IN      SOA     dns01.domain2.com. postmaster.domain2.com (
                        38400 )
directdns.com.      IN      NS      dns01.domain2.com.
directdns.com.      IN      NS      dns02.domain2.com.

boss                          A
legent                       A
peak                          A
quasar                      A
telecircuit                A
ftp                             CNAME   directdns.com
www                         CNAME   directdns.com

A few web sites for troubleshooting

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>