SlideShare a Scribd company logo
1 of 34
NETWORKING IN LINUX
DNS Related Commands
Sayed Ahmed
Computer Engineering, BUET, Bangladesh (Graduated on
2001 )
MSc, Computer Science, U of Manitoba, Canada
http://www.justetc.net
http://sayed.justetc.net
sayed@justetc.net
INTRODUCTION
 Will list mostly DNS related commands and
concepts
 At one point, will try to discuss DNS system
 At another point, will try to explain how to
configure DNS system
 Related
 Zones (Forward Zones, Reverse Zones)
 And related
SO WHAT IS MY BACKGROUND IN THIS AREA
 Some of my study and experience can be checked here
 http://sayed.justetc.net/skills.php#networkSkills
 Started to use Linux on 3rd year of my undergraduate study
 Used several, like Red Hat, Debian, probably one another at that point
 Yes, I also taught Linux at a training center in Bangladesh on my 3rd year in university
 On 3rd or 4th year, we have connected two buildings in our university residence and provided
services like email, and internal websites [in addition to sharing stuff]
 At that point Internet was not widespread like now
 I taught Computer Networks theory and also practical courses (both Linux and Windows) in
Bangladesh in Universities and training Institutes
 I was thought/treated to be good (at least to some degree for sure)
 However, not everything is on top of my head; also, I do not try much to keep it up; but they
should be somewhere in my brain
 I must have some sense left in my brain if I do not remember it exactly
 So if I want to do something in Linux or in Networking, I always find a way
 And planning to get back on it to some extent
 Sure, I have checked/studied lightly CCNA, CCNP stuff
 Probably, more lightly on other CISCO stuff as well
 I read a book on establishing an ISP ground up – looks like totally forgot – need to skim through to
remember the stuff
DNS COMMAND ANSWER TYPES
 Authoritative Answer vs Non-Authoritative
Answer
 For a DNS related Linux command
 Any answer that originates from the DNS Server
which has the complete zone file information
available for the domain is said to be authoritative
answer.
 In many cases, DNS servers will not have the
complete zone file information available for a given
domain. Instead, it maintains a cache file which has
the results of all queries performed in the past for
which it has gotten authoritative response. When a
DNS query is given, it searches the cache file, and
return the information available as “Non-Authoritative
Answer”.
GET DOMAIN/HOST IP ADDRESS
 Get domain/host IP address
 nslookup yahoo.com
 host -t A yahoo.com
NSLOOKUP
 1. nslookup – Simple Example
 nslookup followed by the domain name will
display the “A Record” ( IP Address ) of the
domain
 $ nslookup redhat.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 Name: redhat.com
 Address: 209.132.183.181
NSLOOKUP AND QUERY THE MX RECORD
2. Query the MX Record using -query=mx
 MX ( Mail Exchange ) record maps a domain name to a list of mail exchange
servers for that domain. The MX record tells that all the mails sent to
“@redhat.com” should be routed to the Mail server in that domain.
 $ nslookup -query=mx redhat.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 redhat.com mail exchanger = 10 mx2.redhat.com.
 redhat.com mail exchanger = 5 mx1.redhat.com.
 Authoritative answers can be found from:
 mx2.redhat.com internet address = 66.187.233.33
 mx1.redhat.com internet address = 209.132.183.28
QUERY THE NS RECORD USING -QUERY=NS
 3. Query the NS Record using -query=ns
 NS ( Name Server ) record maps a domain name to a list of DNS servers authoritative for
that domain. It will output the name serves which are associated with the given domain
 nslookup -type=ns redhat.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 redhat.com nameserver = ns4.redhat.com.
 redhat.com nameserver = ns2.redhat.com.
 redhat.com nameserver = ns1.redhat.com.
 redhat.com nameserver = ns3.redhat.com.
 Authoritative answers can be found from:
 ns4.redhat.com internet address = 209.132.188.218
 ns2.redhat.com internet address = 209.132.183.2
 ns1.redhat.com internet address = 209.132.186.218
 ns3.redhat.com internet address = 209.132.176.100
QUERY THE SOA RECORD USING -QUERY=SOA
4. Query the SOA Record using -query=soa
 SOA record ( start of authority ), provides the authoritative information about the
domain, the e-mail address of the domain admin, the domain serial number,
etc…
 $ nslookup -type=soa redhat.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 redhat.com
 origin = ns1.redhat.com
 mail addr = noc.redhat.com
 serial = 2012071601
 refresh = 300
 retry = 180
 expire = 604800
 minimum = 14400
ALL THE AVAILABLE DNS RECORDS USING -QUERY=ANY
 Authoritative answers can be found from:
 ns1.redhat.com internet address = 209.132.186.218
5. View available DNS records using -query=any
 We can also view all the available DNS records using -query=any option.
 $ nslookup -type=any google.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 Name: google.com
 Address: 173.194.35.7
 Name: google.com
 Address: 173.194.35.8
 google.com nameserver = ns1.google.com.
 google.com nameserver = ns2.google.com.
ALL THE AVAILABLE DNS RECORDS USING -QUERY=ANY
 google.com
 origin = ns1.google.com
 mail addr = dns-admin.google.com
 serial = 2012071701
 refresh = 7200
 retry = 1800
 expire = 1209600
 minimum = 300
 google.com mail exchanger = 20 alt1.aspmx.l.google.com.
 google.com mail exchanger = 30 alt2.aspmx.l.google.com.
 google.com mail exchanger = 40 alt3.aspmx.l.google.com.
 google.com mail exchanger = 50 alt4.aspmx.l.google.com.
 google.com mail exchanger = 10 aspmx-v4v6.l.google.com.
 google.com has AAAA address 2a00:1450:4002:801::1004
 Authoritative answers can be found from:
 ns4.google.com internet address = 216.239.38.10
 ns3.google.com internet address = 216.239.36.10
REVERSE DNS LOOKUP
 6. Reverse DNS lookup
 You can also do the reverse DNS look-up by
providing the IP Address as argument to
nslookup.
 $ nslookup 209.132.183.181
 Server: 192.168.19.2
 Address: 192.168.19.2#53
 Non-authoritative answer:
 181.183.132.209.in-addr.arpa name = origin-
www2.redhat.com.
USING SPECIFIC DNS SERVER
 7. Using Specific DNS server
 Instead of using default DNS server’s for querying, you can
also specify a particular name server to resolve the domain
name.
 $ nslookup redhat.com ns1.redhat.com
 Server: 209.132.186.218
 Address: 209.132.186.218#53
 Name: redhat.com
 Address: 209.132.183.181
 In the above command, we have used the
ns1.redhat.com as the DNS server. Here you may notice
that, we don’t get any “Non-authoritative answer:” header,
since ns1.redhat.com has all the zone information of
redhat.com
PORT FOR DNS
 8. Change the port number to connect with
 By default DNS servers uses the port number 53.
If for any reasons, the port number got changed,
then we can specify the port number using -port
option
 $ nslookup -port 56 redhat.com
DNS TIMEOUT
 9. Change timeout interval to wait for a reply
 You can change the default timeout to wait for a
reply using -timeout option
 $ nslookup -timeout=10 redhat.com
ENABLING DEBUG MODE USING -DEBUG
 10. Enabling debug mode using -debug
 You can turn on/off the debugging using -debug
option in the command line
 $ nslookup -debug redhat.com
 Server: 192.168.19.2
 Address: 192.168.19.2#53
ENABLING DEBUG MODE USING -DEBUG
 ------------
 QUESTIONS:
 redhat.com, type = A, class = IN
 ANSWERS:
 -> redhat.com
 internet address = 209.132.183.181
 ttl = 5
 AUTHORITY RECORDS:
 ADDITIONAL RECORDS:
 ------------
 Non-authoritative answer:
 Name: redhat.com
 Address: 209.132.183.181
FIND IP MAPPING
 Code:
 host 66.94.234.13
 nslookup 66.94.234.13
DIG
 You can also use dig
 Code:
 dig yahoo.com
 dig 66.94.234.13
NAMESERVER FOR YOUR HOST
 Your name server listed in /etc/resolv.conf file
 Code:
 more /etc/resolv.conf
 cat /etc/resolv.conf
 vi /etc/resolv.conf
HOST
 host
 This is the simplest of the DNS commands. It is a
quick way to determine the IP address of a
hostname:
 host www.linuxjournal.com
 www.linuxjournal.com has address 207.178.22.49
 www.linuxjournal.com mail is handled (pri=80)
 by www.ssc.com
 www.linuxjournal.com mail is handled (pri=10)
 by mail.ssc.com
 www.linuxjournal.com mail is handled (pri=40)
 by cascadia.a42.com
REVERSE LOOKUP
 Now that you know the IP address for
www.linuxjournal.com, you might want to
make sure the reverse lookup works.
 The reverse lookup checks to see if the reverse
zone file maps the IP address to the hostname:
 host 207.178.22.49 49.22.178.207.IN-ADDR.ARPA
 domain name pointer www.linuxjournal.com
LISTING 1. DNS INFO IN VERBOSE FORMAT WITH -A OPTION
 Listing 1. DNS Info in Verbose Format with -a Option
 host -a www.linuxjournal.com
 Trying null domain
 rcode = 0 (Success), ancount=4
 The following answer is not authoritative:
 The following answer is not verified as authe
 by the server:
 www.linuxjournal.com 19788 IN MX 80 www.ssc.com
 www.linuxjournal.com 19788 IN MX 10 mail.ssc.com
 www.linuxjournal.com 85833 IN A 207.178.22.49
 www.linuxjournal.com 19788 IN MX 40
cascadia.a42.com
LISTING 1. DNS INFO IN VERBOSE FORMAT WITH -A OPTION
 For authoritative answers, see:
 linuxjournal.com 85833 IN NS NS2.ssc.com
 linuxjournal.com 85833 IN NS cascadia.a42.com
 linuxjournal.com 85833 IN NS
NS2.RACKSPACE.com
 Additional information:
 www.ssc.com 226 IN A 207.178.22.48
 mail.ssc.com 86261 IN A 216.39.159.17
 cascadia.a42.com 72030 IN A 216.39.159.18
 NS2.ssc.com 88090 IN A 209.61.155.155
 NS2.RACKSPACE.com 172308 IN A
207.71.44.121
DIG
 dig (domain information groper)
 This powerful command gathers and returns DNS
information in a format the name server can use directly.
For this reason, dig is particularly useful in scripts. You
will find it easy to query specific name servers with dig,
making it a useful tool for narrowing down the source of
DNS problems.
 Suppose you have just transferred your domain name
hosting from old-host.com to new-host.com. A customer
sends you an e-mail saying he cannot reach your web
site when he is logged into his ISP. You suspect the zone
information simply has not had time to propagate. So,
you find out what the NS records are for the ISP in
question:
DIG
 dig ns isp-in-question.com
 ;; ANSWER SECTION:
 isp-in-question.com. 10H IN NS
ns1.hugeupstream.com.
 isp-in-question.com. 10H IN NS isp-in-
question.com.
 isp-in-question.com. 10H IN NS ns.isp-in-
question.com.
 isp-in-question.com. 10H IN NS
ns.goodnameserver.com.
DIG
 Then you check your company's web site
against the ISP's name servers:
 dig www.yourcompany.com @ns.isp-in-
question.com
 ;; ANSWER SECTION:
 www.yourcompany.com. 59m53s IN A
192.168.5.10
DIG
 Wait a minute, that is your old IP address. It appears
the DNS information has not fully propagated yet.
 Next, you decide to see if old-host.com has removed
the old zone information from their name servers. The
“any” option will retrieve all the DNS information:
 dig any www.yourcompany.com @ns.old-host.com
 ;; ANSWER SECTION:
 www.yourcompany.com. 1H IN A 192.168.200.250
 ;; AUTHORITY SECTION:
 yourcompany.com. 1H IN NS webns.new-isp.com.
 yourcompany.com. 1H IN NS srvns.new-isp.com.
DIG
 In this case the A record shows your new IP address for your web
server, and it shows the new authoritative name servers for your
domain name. This is the information you hoped to find.
 These are the most useful dig query types: dig any (gathers all
DNS information), dig ns (gathers name server information), dig
mx (gathers mail exchanger information) and dig a (gathers
network address information).
 The dig command can also do reverse lookups with output
formatted for the zone file:
 dig -x 192.168.200.250
 ;; ANSWER SECTION:
 250.200.168.192.in-addr.arpa.
 4h11s IN PTR www.yourcompany.com.
NSLOOKUP
 nslookup
 You can use this tool as a single line command,
or you can use it interactively, which
distinguishes it from the other DNS commands.
Once you have started nslookup, type set all to
list the default options. As with dig you can
choose the server (name server) you want to
query, and you can decide the type of DNS
information on which to focus.
.NSLOOKUPRC
 Just as you can issue commands to
nslookup interactively, you can also change
the initial defaults by starting a .nslookuprc
file. The format of the .nslookup is one
command per line:
 set type=NS
 set domain=srvns.new-host.com
 set timeout=10
NSLOOKUP
 Listing 2. Output with nslookup
 nslookup
 Default Server: server.randomisp.com
 Address: 172.16.53.130
 > set all
 Default Server: server.randomisp.com
 Address: 172.16.53.130
 Set options:
 nodebug defname search recurse
 nod2 novc noignoretc port=53
 querytype=A class=IN timeout=10 retry=2
 root=a.root-servers.net.
 domain=randomisp.com
 srchlist=randomisp.com
NSLOOKUP
 > set type=mx
 > server srvns.new-host.com
 Default Server: srvns.new-host.com
 Address: 192.168.200.145
 > yourcompany.com
 Server: webns.new-host.com
 Address: 192.168.200.144
 yourcompany.com preference = 10, mail exchanger =<
 mail.new-host.com
 yourcompany.com nameserver = srvns.new-host.com
 yourcompany.com nameserver = webns.new-host.com
 mail.new-host.com internet address = 192.168.200.72
 srvns.new-host.com internet address = 192.168.200.145
 webns.new-host.com internet address = 192.168.200.144
 > exit
REFERENCES
 http://www.linuxjournal.com/article/4597?page=0,0
 http://www.thegeekstuff.com/2012/07/nslookup-examples/

More Related Content

What's hot

101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
Networking session-4-final by aravind.R
Networking session-4-final by aravind.RNetworking session-4-final by aravind.R
Networking session-4-final by aravind.RNavaneethan Naveen
 
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid Umar
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid UmarPENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid Umar
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid UmarWalid Umar
 
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and Rails
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and RailsAnchoring Trust: Rewriting DNS for the Semantic Network with Ruby and Rails
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and RailsEleanor McHugh
 
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)Sam Kim
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014Peter Martin
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filtersAcácio Oliveira
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataAnne Nicolas
 
Ngrep commands
Ngrep commandsNgrep commands
Ngrep commandsRishu Seth
 
linux_Commads
linux_Commadslinux_Commads
linux_Commadstastedone
 
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...idsecconf
 
Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; infoTola LENG
 

What's hot (20)

Mini CTF workshop dump
Mini CTF workshop dumpMini CTF workshop dump
Mini CTF workshop dump
 
Linux administration ii-parti
Linux administration ii-partiLinux administration ii-parti
Linux administration ii-parti
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
Networking session-4-final by aravind.R
Networking session-4-final by aravind.RNetworking session-4-final by aravind.R
Networking session-4-final by aravind.R
 
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid Umar
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid UmarPENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid Umar
PENYELESAIAN SOAL UKK/UPK TAHUN 2018 Paket 3 oleh Walid Umar
 
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and Rails
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and RailsAnchoring Trust: Rewriting DNS for the Semantic Network with Ruby and Rails
Anchoring Trust: Rewriting DNS for the Semantic Network with Ruby and Rails
 
DNS SERVER
DNS SERVERDNS SERVER
DNS SERVER
 
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filters
 
Lession2 Xinetd
Lession2 XinetdLession2 Xinetd
Lession2 Xinetd
 
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataKernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary data
 
Linux class 9 15 oct 2021-5
Linux class 9   15 oct 2021-5Linux class 9   15 oct 2021-5
Linux class 9 15 oct 2021-5
 
Linux class 10 15 oct 2021-6
Linux class 10   15 oct 2021-6Linux class 10   15 oct 2021-6
Linux class 10 15 oct 2021-6
 
Ngrep commands
Ngrep commandsNgrep commands
Ngrep commands
 
linux_Commads
linux_Commadslinux_Commads
linux_Commads
 
Network namespaces
Network namespacesNetwork namespaces
Network namespaces
 
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
 
Basic security &amp; info
Basic security &amp; infoBasic security &amp; info
Basic security &amp; info
 

Similar to Linux networking commands

linux networking commands short
linux networking commands shortlinux networking commands short
linux networking commands shortSayed Ahmed
 
Linux networking commands short
Linux networking commands shortLinux networking commands short
Linux networking commands shortSayed Ahmed
 
DNSPresentation.pptx
DNSPresentation.pptxDNSPresentation.pptx
DNSPresentation.pptxKailashTayde
 
dns-sec-4-slides
dns-sec-4-slidesdns-sec-4-slides
dns-sec-4-slideskj teoh
 
2009 Itc Nslookup Rev01
2009 Itc Nslookup Rev012009 Itc Nslookup Rev01
2009 Itc Nslookup Rev01JayMNEA
 
DNS – Domain Name Service
DNS – Domain Name ServiceDNS – Domain Name Service
DNS – Domain Name ServiceJohnny Fortune
 
DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)Tola LENG
 
Footprinting LAB SETUP GUIDE.pdf
Footprinting LAB SETUP GUIDE.pdfFootprinting LAB SETUP GUIDE.pdf
Footprinting LAB SETUP GUIDE.pdfsdfghj21
 
DNS_Tutorial 2.pptx
DNS_Tutorial 2.pptxDNS_Tutorial 2.pptx
DNS_Tutorial 2.pptxviditsir
 

Similar to Linux networking commands (20)

linux networking commands short
linux networking commands shortlinux networking commands short
linux networking commands short
 
Linux networking commands short
Linux networking commands shortLinux networking commands short
Linux networking commands short
 
DNSPresentation.pptx
DNSPresentation.pptxDNSPresentation.pptx
DNSPresentation.pptx
 
Dns
DnsDns
Dns
 
DNS (Domain Name System)
DNS (Domain Name System)DNS (Domain Name System)
DNS (Domain Name System)
 
1.1 DNS.ppt.ppt
1.1 DNS.ppt.ppt1.1 DNS.ppt.ppt
1.1 DNS.ppt.ppt
 
dns-sec-4-slides
dns-sec-4-slidesdns-sec-4-slides
dns-sec-4-slides
 
DNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAIL
DNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAILDNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAIL
DNSSEC - WHAT IS IT ? INSTALL AND CONFIGURE IN CHROOT JAIL
 
Dns
DnsDns
Dns
 
DNS.pptx
DNS.pptxDNS.pptx
DNS.pptx
 
Domain Name Service
Domain Name ServiceDomain Name Service
Domain Name Service
 
Dns
DnsDns
Dns
 
2009 Itc Nslookup Rev01
2009 Itc Nslookup Rev012009 Itc Nslookup Rev01
2009 Itc Nslookup Rev01
 
DNS – Domain Name Service
DNS – Domain Name ServiceDNS – Domain Name Service
DNS – Domain Name Service
 
DNS
DNSDNS
DNS
 
DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)
 
Footprinting LAB SETUP GUIDE.pdf
Footprinting LAB SETUP GUIDE.pdfFootprinting LAB SETUP GUIDE.pdf
Footprinting LAB SETUP GUIDE.pdf
 
6425 b 10
6425 b 106425 b 10
6425 b 10
 
DNS_Tutorial 2.pptx
DNS_Tutorial 2.pptxDNS_Tutorial 2.pptx
DNS_Tutorial 2.pptx
 
M7 - Manual
M7 - ManualM7 - Manual
M7 - Manual
 

More from Sayed Ahmed

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsSayed Ahmed
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commandsSayed Ahmed
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic frameworkSayed Ahmed
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSayed Ahmed
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction toSayed Ahmed
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overviewSayed Ahmed
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend frameworkSayed Ahmed
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3Sayed Ahmed
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2Sayed Ahmed
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_htmlSayed Ahmed
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcutsSayed Ahmed
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfonySayed Ahmed
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayedSayed Ahmed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_designSayed Ahmed
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrativeSayed Ahmed
 

More from Sayed Ahmed (20)

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and Ethics
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commands
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodev
 
Invest wisely
Invest wiselyInvest wisely
Invest wisely
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overview
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend framework
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_html
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcuts
 
Virtualization
VirtualizationVirtualization
Virtualization
 
User interfaces
User interfacesUser interfaces
User interfaces
 
Unreal
UnrealUnreal
Unreal
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfony
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_design
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrative
 

Recently uploaded

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Linux networking commands

  • 1. NETWORKING IN LINUX DNS Related Commands Sayed Ahmed Computer Engineering, BUET, Bangladesh (Graduated on 2001 ) MSc, Computer Science, U of Manitoba, Canada http://www.justetc.net http://sayed.justetc.net sayed@justetc.net
  • 2. INTRODUCTION  Will list mostly DNS related commands and concepts  At one point, will try to discuss DNS system  At another point, will try to explain how to configure DNS system  Related  Zones (Forward Zones, Reverse Zones)  And related
  • 3. SO WHAT IS MY BACKGROUND IN THIS AREA  Some of my study and experience can be checked here  http://sayed.justetc.net/skills.php#networkSkills  Started to use Linux on 3rd year of my undergraduate study  Used several, like Red Hat, Debian, probably one another at that point  Yes, I also taught Linux at a training center in Bangladesh on my 3rd year in university  On 3rd or 4th year, we have connected two buildings in our university residence and provided services like email, and internal websites [in addition to sharing stuff]  At that point Internet was not widespread like now  I taught Computer Networks theory and also practical courses (both Linux and Windows) in Bangladesh in Universities and training Institutes  I was thought/treated to be good (at least to some degree for sure)  However, not everything is on top of my head; also, I do not try much to keep it up; but they should be somewhere in my brain  I must have some sense left in my brain if I do not remember it exactly  So if I want to do something in Linux or in Networking, I always find a way  And planning to get back on it to some extent  Sure, I have checked/studied lightly CCNA, CCNP stuff  Probably, more lightly on other CISCO stuff as well  I read a book on establishing an ISP ground up – looks like totally forgot – need to skim through to remember the stuff
  • 4. DNS COMMAND ANSWER TYPES  Authoritative Answer vs Non-Authoritative Answer  For a DNS related Linux command  Any answer that originates from the DNS Server which has the complete zone file information available for the domain is said to be authoritative answer.  In many cases, DNS servers will not have the complete zone file information available for a given domain. Instead, it maintains a cache file which has the results of all queries performed in the past for which it has gotten authoritative response. When a DNS query is given, it searches the cache file, and return the information available as “Non-Authoritative Answer”.
  • 5. GET DOMAIN/HOST IP ADDRESS  Get domain/host IP address  nslookup yahoo.com  host -t A yahoo.com
  • 6. NSLOOKUP  1. nslookup – Simple Example  nslookup followed by the domain name will display the “A Record” ( IP Address ) of the domain  $ nslookup redhat.com  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  Name: redhat.com  Address: 209.132.183.181
  • 7. NSLOOKUP AND QUERY THE MX RECORD 2. Query the MX Record using -query=mx  MX ( Mail Exchange ) record maps a domain name to a list of mail exchange servers for that domain. The MX record tells that all the mails sent to “@redhat.com” should be routed to the Mail server in that domain.  $ nslookup -query=mx redhat.com  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  redhat.com mail exchanger = 10 mx2.redhat.com.  redhat.com mail exchanger = 5 mx1.redhat.com.  Authoritative answers can be found from:  mx2.redhat.com internet address = 66.187.233.33  mx1.redhat.com internet address = 209.132.183.28
  • 8. QUERY THE NS RECORD USING -QUERY=NS  3. Query the NS Record using -query=ns  NS ( Name Server ) record maps a domain name to a list of DNS servers authoritative for that domain. It will output the name serves which are associated with the given domain  nslookup -type=ns redhat.com  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  redhat.com nameserver = ns4.redhat.com.  redhat.com nameserver = ns2.redhat.com.  redhat.com nameserver = ns1.redhat.com.  redhat.com nameserver = ns3.redhat.com.  Authoritative answers can be found from:  ns4.redhat.com internet address = 209.132.188.218  ns2.redhat.com internet address = 209.132.183.2  ns1.redhat.com internet address = 209.132.186.218  ns3.redhat.com internet address = 209.132.176.100
  • 9. QUERY THE SOA RECORD USING -QUERY=SOA 4. Query the SOA Record using -query=soa  SOA record ( start of authority ), provides the authoritative information about the domain, the e-mail address of the domain admin, the domain serial number, etc…  $ nslookup -type=soa redhat.com  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  redhat.com  origin = ns1.redhat.com  mail addr = noc.redhat.com  serial = 2012071601  refresh = 300  retry = 180  expire = 604800  minimum = 14400
  • 10. ALL THE AVAILABLE DNS RECORDS USING -QUERY=ANY  Authoritative answers can be found from:  ns1.redhat.com internet address = 209.132.186.218 5. View available DNS records using -query=any  We can also view all the available DNS records using -query=any option.  $ nslookup -type=any google.com  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  Name: google.com  Address: 173.194.35.7  Name: google.com  Address: 173.194.35.8  google.com nameserver = ns1.google.com.  google.com nameserver = ns2.google.com.
  • 11. ALL THE AVAILABLE DNS RECORDS USING -QUERY=ANY  google.com  origin = ns1.google.com  mail addr = dns-admin.google.com  serial = 2012071701  refresh = 7200  retry = 1800  expire = 1209600  minimum = 300  google.com mail exchanger = 20 alt1.aspmx.l.google.com.  google.com mail exchanger = 30 alt2.aspmx.l.google.com.  google.com mail exchanger = 40 alt3.aspmx.l.google.com.  google.com mail exchanger = 50 alt4.aspmx.l.google.com.  google.com mail exchanger = 10 aspmx-v4v6.l.google.com.  google.com has AAAA address 2a00:1450:4002:801::1004  Authoritative answers can be found from:  ns4.google.com internet address = 216.239.38.10  ns3.google.com internet address = 216.239.36.10
  • 12. REVERSE DNS LOOKUP  6. Reverse DNS lookup  You can also do the reverse DNS look-up by providing the IP Address as argument to nslookup.  $ nslookup 209.132.183.181  Server: 192.168.19.2  Address: 192.168.19.2#53  Non-authoritative answer:  181.183.132.209.in-addr.arpa name = origin- www2.redhat.com.
  • 13. USING SPECIFIC DNS SERVER  7. Using Specific DNS server  Instead of using default DNS server’s for querying, you can also specify a particular name server to resolve the domain name.  $ nslookup redhat.com ns1.redhat.com  Server: 209.132.186.218  Address: 209.132.186.218#53  Name: redhat.com  Address: 209.132.183.181  In the above command, we have used the ns1.redhat.com as the DNS server. Here you may notice that, we don’t get any “Non-authoritative answer:” header, since ns1.redhat.com has all the zone information of redhat.com
  • 14. PORT FOR DNS  8. Change the port number to connect with  By default DNS servers uses the port number 53. If for any reasons, the port number got changed, then we can specify the port number using -port option  $ nslookup -port 56 redhat.com
  • 15. DNS TIMEOUT  9. Change timeout interval to wait for a reply  You can change the default timeout to wait for a reply using -timeout option  $ nslookup -timeout=10 redhat.com
  • 16. ENABLING DEBUG MODE USING -DEBUG  10. Enabling debug mode using -debug  You can turn on/off the debugging using -debug option in the command line  $ nslookup -debug redhat.com  Server: 192.168.19.2  Address: 192.168.19.2#53
  • 17. ENABLING DEBUG MODE USING -DEBUG  ------------  QUESTIONS:  redhat.com, type = A, class = IN  ANSWERS:  -> redhat.com  internet address = 209.132.183.181  ttl = 5  AUTHORITY RECORDS:  ADDITIONAL RECORDS:  ------------  Non-authoritative answer:  Name: redhat.com  Address: 209.132.183.181
  • 18. FIND IP MAPPING  Code:  host 66.94.234.13  nslookup 66.94.234.13
  • 19. DIG  You can also use dig  Code:  dig yahoo.com  dig 66.94.234.13
  • 20. NAMESERVER FOR YOUR HOST  Your name server listed in /etc/resolv.conf file  Code:  more /etc/resolv.conf  cat /etc/resolv.conf  vi /etc/resolv.conf
  • 21. HOST  host  This is the simplest of the DNS commands. It is a quick way to determine the IP address of a hostname:  host www.linuxjournal.com  www.linuxjournal.com has address 207.178.22.49  www.linuxjournal.com mail is handled (pri=80)  by www.ssc.com  www.linuxjournal.com mail is handled (pri=10)  by mail.ssc.com  www.linuxjournal.com mail is handled (pri=40)  by cascadia.a42.com
  • 22. REVERSE LOOKUP  Now that you know the IP address for www.linuxjournal.com, you might want to make sure the reverse lookup works.  The reverse lookup checks to see if the reverse zone file maps the IP address to the hostname:  host 207.178.22.49 49.22.178.207.IN-ADDR.ARPA  domain name pointer www.linuxjournal.com
  • 23. LISTING 1. DNS INFO IN VERBOSE FORMAT WITH -A OPTION  Listing 1. DNS Info in Verbose Format with -a Option  host -a www.linuxjournal.com  Trying null domain  rcode = 0 (Success), ancount=4  The following answer is not authoritative:  The following answer is not verified as authe  by the server:  www.linuxjournal.com 19788 IN MX 80 www.ssc.com  www.linuxjournal.com 19788 IN MX 10 mail.ssc.com  www.linuxjournal.com 85833 IN A 207.178.22.49  www.linuxjournal.com 19788 IN MX 40 cascadia.a42.com
  • 24. LISTING 1. DNS INFO IN VERBOSE FORMAT WITH -A OPTION  For authoritative answers, see:  linuxjournal.com 85833 IN NS NS2.ssc.com  linuxjournal.com 85833 IN NS cascadia.a42.com  linuxjournal.com 85833 IN NS NS2.RACKSPACE.com  Additional information:  www.ssc.com 226 IN A 207.178.22.48  mail.ssc.com 86261 IN A 216.39.159.17  cascadia.a42.com 72030 IN A 216.39.159.18  NS2.ssc.com 88090 IN A 209.61.155.155  NS2.RACKSPACE.com 172308 IN A 207.71.44.121
  • 25. DIG  dig (domain information groper)  This powerful command gathers and returns DNS information in a format the name server can use directly. For this reason, dig is particularly useful in scripts. You will find it easy to query specific name servers with dig, making it a useful tool for narrowing down the source of DNS problems.  Suppose you have just transferred your domain name hosting from old-host.com to new-host.com. A customer sends you an e-mail saying he cannot reach your web site when he is logged into his ISP. You suspect the zone information simply has not had time to propagate. So, you find out what the NS records are for the ISP in question:
  • 26. DIG  dig ns isp-in-question.com  ;; ANSWER SECTION:  isp-in-question.com. 10H IN NS ns1.hugeupstream.com.  isp-in-question.com. 10H IN NS isp-in- question.com.  isp-in-question.com. 10H IN NS ns.isp-in- question.com.  isp-in-question.com. 10H IN NS ns.goodnameserver.com.
  • 27. DIG  Then you check your company's web site against the ISP's name servers:  dig www.yourcompany.com @ns.isp-in- question.com  ;; ANSWER SECTION:  www.yourcompany.com. 59m53s IN A 192.168.5.10
  • 28. DIG  Wait a minute, that is your old IP address. It appears the DNS information has not fully propagated yet.  Next, you decide to see if old-host.com has removed the old zone information from their name servers. The “any” option will retrieve all the DNS information:  dig any www.yourcompany.com @ns.old-host.com  ;; ANSWER SECTION:  www.yourcompany.com. 1H IN A 192.168.200.250  ;; AUTHORITY SECTION:  yourcompany.com. 1H IN NS webns.new-isp.com.  yourcompany.com. 1H IN NS srvns.new-isp.com.
  • 29. DIG  In this case the A record shows your new IP address for your web server, and it shows the new authoritative name servers for your domain name. This is the information you hoped to find.  These are the most useful dig query types: dig any (gathers all DNS information), dig ns (gathers name server information), dig mx (gathers mail exchanger information) and dig a (gathers network address information).  The dig command can also do reverse lookups with output formatted for the zone file:  dig -x 192.168.200.250  ;; ANSWER SECTION:  250.200.168.192.in-addr.arpa.  4h11s IN PTR www.yourcompany.com.
  • 30. NSLOOKUP  nslookup  You can use this tool as a single line command, or you can use it interactively, which distinguishes it from the other DNS commands. Once you have started nslookup, type set all to list the default options. As with dig you can choose the server (name server) you want to query, and you can decide the type of DNS information on which to focus.
  • 31. .NSLOOKUPRC  Just as you can issue commands to nslookup interactively, you can also change the initial defaults by starting a .nslookuprc file. The format of the .nslookup is one command per line:  set type=NS  set domain=srvns.new-host.com  set timeout=10
  • 32. NSLOOKUP  Listing 2. Output with nslookup  nslookup  Default Server: server.randomisp.com  Address: 172.16.53.130  > set all  Default Server: server.randomisp.com  Address: 172.16.53.130  Set options:  nodebug defname search recurse  nod2 novc noignoretc port=53  querytype=A class=IN timeout=10 retry=2  root=a.root-servers.net.  domain=randomisp.com  srchlist=randomisp.com
  • 33. NSLOOKUP  > set type=mx  > server srvns.new-host.com  Default Server: srvns.new-host.com  Address: 192.168.200.145  > yourcompany.com  Server: webns.new-host.com  Address: 192.168.200.144  yourcompany.com preference = 10, mail exchanger =<  mail.new-host.com  yourcompany.com nameserver = srvns.new-host.com  yourcompany.com nameserver = webns.new-host.com  mail.new-host.com internet address = 192.168.200.72  srvns.new-host.com internet address = 192.168.200.145  webns.new-host.com internet address = 192.168.200.144  > exit