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 @8.8.8.8 domain.com

 

 

whois 1.2.3.4

 

 

—===—===—===—
—===—===—===—

 

 

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
OK
[root@dns01 named]# named-checkzone domain1.com domain1.com.hosts
zone domain1.com/IN: loaded serial 1389974311
OK
– 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 (
                        1389974311
                        10800
                        3600
                        604800
                        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       1.2.3.4
sbam                            A       1.2.3.4
tc                              A       12.13.14.15
ald                             A       1.2.3.4
osi                             A       1.2.3.4
mx                              A       13.14.15.16
pd                              A       1.2.3.4
isi                             A       2.3.4.5
nald                            A       2.3.4.5
ldsaving                        A       1.2.3.4
quasar                          A       5.6.7.8
sat                             A       5.6.7.8
conectado                       A       2.3.4.5
nsb                             A       2.3.4.5
mlld                            A       2.3.4.5
lds                             A       1.2.3.4
ctl                             A       5.6.7.8
peak                            A       21.22.23.24
cbs                             A       1.2.3.4
lld                             A       1.2.3.4
nlds                            A       2.3.4.5
dld                             A       1.2.3.4
dp                              A       1.2.3.4
bnld                            A       2.3.4.5
bsa                             A       1.2.3.4
lda                             A       1.2.3.4
lcr                             A       2.3.4.5
ceot                            A       1.2.3.4
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 (
                        1389974311
                        10800
                        3600
                        604800
                        38400 )
directdns.com.      IN      NS      dns01.domain2.com.
directdns.com.      IN      NS      dns02.domain2.com.


boss                          A       123.123.13.123
legent                       A       123.123.14.123
peak                          A       123.123.15.123
quasar                      A       5.6.7.8
telecircuit                A       123.123.16.123
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>