The principle of DNS parsing and configuration __linux under Linux

Source: Internet
Author: User
Tags domain name server domain server nameserver

First, DNS resolution process

To resolve the www.baidu.com domain name for example. When the system needs to invoke the data of the www.baidu.com host, send an instruction to query the domain name of the www.baidu.com.

(1) The system has a hosts file that can be used to resolve domain names. In the system, you can define the order in which to find the domain name: First find the Hosts file, or find the DNS server first. General settings to find the Hosts file first, if the hosts file found in the Www.baidu.com records, then directly return the results.

(2) If no record is found in the Hosts file, the query instruction is forwarded to the designated domain name server in the system for DNS query.

(3) The Domain name server finds the corresponding domain name record in its own cache, and returns the result if the record exists; otherwise, forward the query instruction to the root domain server.

(4) In the record of the root domain name server, according to the rules of recursive query, only the top-level domain name COM can be returned, and the address of the domain name server that can parse COM is told to the client.

(5) According to the returned information, the client continues to send a recursive request to the COM domain name server, receiving the requested name server that can correctly return the baidu.com domain name information, and returning the relevant information to the client.

(6) The client again sends a recursive request to the Baidu.com domain name server, and the server that receives the request resolves again; The server has been able to fully resolve the www.baidu.com domain name to an IP address and return the IP address.

Second, the configuration of DNS server under Linux

The common domain resolution software on Linux systems is bind, and in addition, there are two files in the Linux system that are related to DNS resolution.

(1) Two files related to DNS resolution (./etc/resolv.conf and./etc/host.conf)

./etc/reolv.conf This file specifies the IP address and some relevant information for the DNS server in the system. The format is generally as follows:

Search www.baidu.com

NameServer 192.168.1.1

NameServer 192.168.1.154

When the first line specifies the domain of the computer, the default belongs to the specified domain.

The second and third lines specify the IP address of the domain name server that the system uses to find the domain name. You can specify multiple domain name servers for your system. When the system for Domain name query, first look for the first domain name server, if the first domain name server does not respond, then look for a second domain name server, and so on.

./etc/host.conf the order in which the host files and DNS servers are located when the file is resolved for domain name resolution. The general format is as follows:

Orderhost,bind

(2) Bind configuration: Please refer to other configuration instructions

There are two files associated with domain resolution in bind (named.ca, named.local, etc.) in the/var/named directory

Attention:

Remember to configure the DNS service in the DNSServer server

Related Article

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.