[Network] DNS resolution

Source: Internet
Author: User
Tags nslookup

DNS Client configuration files: 1)/etc/hosts 2)/etc/resolv. conf 3)/etc/nsswitch. conf
The/etc/hosts file records the relationship between the IP address and the host name. The/etc/resolv. conf file is used to configure the DNS server, as shown below:

$ cat /etc/resolv.conf nameserver 8.8.4.4nameserver 8.8.8.8
The first is the primary DNS server, and the second is the backup DNS server. In general, it is to first parse/etc/hosts and find it in the DNS server. This is because the default configuration of/etc/nsswitch. conf is:
#hosts:     db files nisplus nis dnshosts:      files dns
Therefore, we recommend that you write the ing between the Intranet IP address and the host name to the/etc/hosts file. DNS commands 1. hostAfter the host command is followed by a domain name, you can find the IP address of the domain name:
# host baidu.combaidu.com has address 123.125.114.144baidu.com has address 220.181.111.85baidu.com has address 220.181.111.86baidu.com mail is handled by 20 mx1.baidu.com.baidu.com mail is handled by 20 jpmx.baidu.com.baidu.com mail is handled by 20 mx50.baidu.com.baidu.com mail is handled by 10 mx.mailcdn.baidu.com.
2. nslookupNslookup is similar to host, but it also lists the used DNS Server Information (Server part)
# nslookup baidu.comServer:         8.8.4.4Address:        8.8.4.4#53Non-authoritative answer:Name:   baidu.comAddress: 123.125.114.144Name:   baidu.comAddress: 220.181.111.85Name:   baidu.comAddress: 220.181.111.86
3. digThe dig command will detail the DNS query process:
# dig +trace baidu.com; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5 <<>> +trace baidu.com;; global options:  printcmd.                       19079   IN      NS      m.root-servers.net..                       19079   IN      NS      i.root-servers.net..                       19079   IN      NS      g.root-servers.net..                       19079   IN      NS      a.root-servers.net..                       19079   IN      NS      f.root-servers.net..                       19079   IN      NS      e.root-servers.net..                       19079   IN      NS      l.root-servers.net..                       19079   IN      NS      j.root-servers.net..                       19079   IN      NS      d.root-servers.net..                       19079   IN      NS      b.root-servers.net..                       19079   IN      NS      h.root-servers.net..                       19079   IN      NS      c.root-servers.net..                       19079   IN      NS      k.root-servers.net.;; Received 228 bytes from 8.8.4.4#53(8.8.4.4) in 162 mscom.                    172800  IN      NS      h.gtld-servers.net.com.                    172800  IN      NS      j.gtld-servers.net.com.                    172800  IN      NS      a.gtld-servers.net.com.                    172800  IN      NS      m.gtld-servers.net.com.                    172800  IN      NS      e.gtld-servers.net.com.                    172800  IN      NS      k.gtld-servers.net.com.                    172800  IN      NS      l.gtld-servers.net.com.                    172800  IN      NS      d.gtld-servers.net.com.                    172800  IN      NS      c.gtld-servers.net.com.                    172800  IN      NS      i.gtld-servers.net.com.                    172800  IN      NS      f.gtld-servers.net.com.                    172800  IN      NS      g.gtld-servers.net.com.                    172800  IN      NS      b.gtld-servers.net.;; Received 487 bytes from 202.12.27.33#53(m.root-servers.net) in 174 msbaidu.com.              172800  IN      NS      dns.baidu.com.baidu.com.              172800  IN      NS      ns2.baidu.com.baidu.com.              172800  IN      NS      ns3.baidu.com.baidu.com.              172800  IN      NS      ns4.baidu.com.baidu.com.              172800  IN      NS      ns7.baidu.com.;; Received 197 bytes from 192.54.112.30#53(h.gtld-servers.net) in 483 msbaidu.com.              600     IN      A       220.181.111.86baidu.com.              600     IN      A       123.125.114.144baidu.com.              600     IN      A       220.181.111.85baidu.com.              86400   IN      NS      ns3.baidu.com.baidu.com.              86400   IN      NS      ns2.baidu.com.baidu.com.              86400   IN      NS      ns4.baidu.com.baidu.com.              86400   IN      NS      dns.baidu.com.baidu.com.              86400   IN      NS      ns7.baidu.com.;; Received 245 bytes from 202.108.22.220#53(dns.baidu.com) in 129 ms
From the above output, we can see that DNS is a distributed, hierarchical architecture, first accessing the root server (.), based on the results returned by the root server, access the next layer of DNS server, and so on until the IP address of the target host is found.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.