SlideShare a Scribd company logo
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
BUT SOME RESOURCES
 How to configure DNS in Linux
 http://www.tldp.org/LDP/lame/LAME/linux-admin-
made-easy/domain-name-server.html
 http://computernetworkingnotes.com/network-
administrations/dns-server.html
 How does the DNS system work
 http://en.wikipedia.org/wiki/Domain_Name_Syste
m
 http://wiki.bravenet.com/How_the_domain_name
_system_works
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
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
.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

PPTX
Linux networking commands short
PPTX
Linux networking commands
PPT
2009 Itc Nslookup Rev01
PDF
6. reverse primarydns using bind for ptr and cname record ipv6 with forwarder
PDF
DNS Configure
PDF
2. reverse primarydns using bind for ptr and cname record ipv4
DOCX
DNS windows server(2008R2) & linux(SLES 11)
PPT
DNS – Domain Name Service
Linux networking commands short
Linux networking commands
2009 Itc Nslookup Rev01
6. reverse primarydns using bind for ptr and cname record ipv6 with forwarder
DNS Configure
2. reverse primarydns using bind for ptr and cname record ipv4
DNS windows server(2008R2) & linux(SLES 11)
DNS – Domain Name Service

What's hot (20)

PDF
Configure Proxy and Firewall (Iptables)
PPTX
BIND DNS Configuration Red Hat 5
PDF
DNS Server Configuration
PDF
Basic security &amp; info
PPTX
Linux System Administration - DNS
PDF
1. primary dns using bind for a and cname record for ipv4 and ipv6
PDF
linux_Commads
PDF
3. reverse primarydns using bind for ptr and cname record ipv6
DOCX
M7 - Manual
PDF
Dns configuration on rhel 5
PPT
PPTX
DNS SERVER
PDF
Tibero sql execution plan guide en
PDF
DNS 101: Introducción a DNS en Español
PPTX
Linux Addministration
PDF
4 technical-dns-workshop-day2
PDF
7 technical-dns-workshop-day3
PDF
Build Dynamic DNS server from scratch in C (Part1)
PPTX
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
PDF
2 technical-dns-workshop-day1
Configure Proxy and Firewall (Iptables)
BIND DNS Configuration Red Hat 5
DNS Server Configuration
Basic security &amp; info
Linux System Administration - DNS
1. primary dns using bind for a and cname record for ipv4 and ipv6
linux_Commads
3. reverse primarydns using bind for ptr and cname record ipv6
M7 - Manual
Dns configuration on rhel 5
DNS SERVER
Tibero sql execution plan guide en
DNS 101: Introducción a DNS en Español
Linux Addministration
4 technical-dns-workshop-day2
7 technical-dns-workshop-day3
Build Dynamic DNS server from scratch in C (Part1)
Modul mengamankan jaringan dhcp server menggunakan arp reply only menggunakan...
2 technical-dns-workshop-day1
Ad

Similar to linux networking commands short (20)

PPTX
Linux networking commands
PDF
DNS (Domain Name System)
PPTX
DNS.pptx
PDF
Alternative Dns Servers Choice And Deployment And Optional Sql Ldap Backends ...
PPTX
2_Chapter 2_DNS.pptx
PDF
Domain Name System (DNS) Fundamentals
PPTX
DNS_Tutorial 2.pptx
PDF
What You Need to Know - Domain Name System (DNS)
PDF
Lets talk dns
PPT
THBTHRTHRETHBTHJNRTFGNJRFTJNTNJMRTJNTTHJR
PDF
DNS and BIND, 5th Edition.pdf
PPT
PPTX
06- 1 Active Information Gathering part 1.pptx
PDF
understanding-dns-essential
PDF
DNS Over HTTPS by Michael Casadevall
PDF
Presentation on Domain Name System
PPT
Domain Name Service
PPT
13-DNSksjsjsjndndndjsjjsjsjsjsjsjsjsjsjjs.ppt
PPT
13 dns
Linux networking commands
DNS (Domain Name System)
DNS.pptx
Alternative Dns Servers Choice And Deployment And Optional Sql Ldap Backends ...
2_Chapter 2_DNS.pptx
Domain Name System (DNS) Fundamentals
DNS_Tutorial 2.pptx
What You Need to Know - Domain Name System (DNS)
Lets talk dns
THBTHRTHRETHBTHJNRTFGNJRFTJNTNJMRTJNTTHJR
DNS and BIND, 5th Edition.pdf
06- 1 Active Information Gathering part 1.pptx
understanding-dns-essential
DNS Over HTTPS by Michael Casadevall
Presentation on Domain Name System
Domain Name Service
13-DNSksjsjsjndndndjsjjsjsjsjsjsjsjsjsjjs.ppt
13 dns
Ad

More from Sayed Ahmed (20)

PDF
Workplace, Data Analytics, and Ethics
PPTX
Python py charm anaconda jupyter installation and basic commands
PPTX
[not edited] Demo on mobile app development using ionic framework
PPTX
Sap hana-ide-overview-nodev
PPTX
Invest wisely
PPTX
Will be an introduction to
PPTX
Whm and cpanel overview hosting control panel overview
PPTX
Web application development using zend framework
PPTX
Web design and_html_part_3
PPTX
Web design and_html_part_2
PPTX
Web design and_html
PPTX
Visual studio ide shortcuts
PPTX
Virtualization
PPT
User interfaces
PPT
Unreal
PPTX
Unit tests in_symfony
PPTX
Telerik this is sayed
PPTX
System analysis and_design
PPTX
Symfony 2
PPT
Story telling and_narrative
Workplace, Data Analytics, and Ethics
Python py charm anaconda jupyter installation and basic commands
[not edited] Demo on mobile app development using ionic framework
Sap hana-ide-overview-nodev
Invest wisely
Will be an introduction to
Whm and cpanel overview hosting control panel overview
Web application development using zend framework
Web design and_html_part_3
Web design and_html_part_2
Web design and_html
Visual studio ide shortcuts
Virtualization
User interfaces
Unreal
Unit tests in_symfony
Telerik this is sayed
System analysis and_design
Symfony 2
Story telling and_narrative

Recently uploaded (20)

PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
project resource management chapter-09.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
Hindi spoken digit analysis for native and non-native speakers
Developing a website for English-speaking practice to English as a foreign la...
WOOl fibre morphology and structure.pdf for textiles
A novel scalable deep ensemble learning framework for big data classification...
Group 1 Presentation -Planning and Decision Making .pptx
Assigned Numbers - 2025 - Bluetooth® Document
project resource management chapter-09.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
1 - Historical Antecedents, Social Consideration.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Zenith AI: Advanced Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
Programs and apps: productivity, graphics, security and other tools
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
A comparative study of natural language inference in Swahili using monolingua...

linux networking commands short

  • 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. BUT SOME RESOURCES  How to configure DNS in Linux  http://www.tldp.org/LDP/lame/LAME/linux-admin- made-easy/domain-name-server.html  http://computernetworkingnotes.com/network- administrations/dns-server.html  How does the DNS system work  http://en.wikipedia.org/wiki/Domain_Name_Syste m  http://wiki.bravenet.com/How_the_domain_name _system_works
  • 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. FIND IP MAPPING  Code:  host 66.94.234.13  nslookup 66.94.234.13
  • 18. DIG  You can also use dig  Code:  dig yahoo.com  dig 66.94.234.13
  • 19. 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
  • 20. 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
  • 21. 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
  • 22. 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
  • 23. 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
  • 24. 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:
  • 25. 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.
  • 26. 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
  • 27. .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
  • 28. 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
  • 29. 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