DNS & BIND (1)

Source: Internet
Author: User
Tags domain name server
DNS and bind

--------------- DNS: Domain Name System

1. Development of DNS

DNS works at the application layer and listens to UDP and TCP ports 53 at the same time.

UDP response query request

TCP response

The/etc/directory in each system contains a hosts file, which implements the most direct configuration of the DNS server. At the beginning, there was a corresponding relationship between the places you want to access and those in it. However, as the network grows, the management and maintenance of host files becomes very troublesome. At this time, the international organization for address allocation has come up with a method. They set up an organization dedicated to Address Allocation. They regularly spread all the websites on the Internet by updating the hosts files on the FTP server. However, with the explosive growth of the Internet. The hosts file needs to be changed almost every minute every day, which greatly increases the difficulty of the service staff and makes the volume of the hosts file extremely huge. This directly gave birth to the emergence of the DNS protocol.

The DNS protocol is an extension of the host file, which only fragment the host file. All users create a database and name resolution database on their own servers. Once someone finds that they want to access a domain name, the database will first go to the DNS to find the corresponding IP address of the domain name. This allocation method greatly reduces the pressure on the hosts file. However, this still does not work, and the development of Internet applications is too fast. As a result, DNS has enabled its own hierarchical management system. Like the Linux file system structure, the top-down tree hierarchy structure is similar.

The top is "." root. Many domain names are separated under the root. For example ". com ",". net ",". org ",". CN, and so on. Under each domain name, a second-level domain is extended, for example ". baidu ",". sina ",". sohu "is a branch where our server names, such as WWW, BBS, and blog, are separated ". In this way, the name of a server can be stretched from the bottom up, and finally become www.baidu.com

 

2. How does DNS help us resolve the address?

There are two types of DNS queries:

A recursive query (recursive)

When querying a, you must know the answer once.

A asks B, B doesn't know, but B knows C knows, so B gets the answer from C and tells

2. Iterative Query

When a queries the answer, the method that is finally queried many times

A asks B, B does not know, but B tells a, c knows, so a asks C again, C tells

On the Internet, users generally query the server recursively. As a server, queries on the Internet are always iterative. Therefore, applications on the Internet are generally two-step. Recursion of the first half and iteration of the second half. The reason why DNS queries are not recursive is that the recursion method consumes a lot of resources, so generally only recursion is performed on the local client.

 

Iii. DNS resolution methods

Forward resolution: FQDN → IP

Reverse resolution: IP → FQDN

How is the parsing process implemented?

First, in the tree structure, the upper-level will always know the lower-level, and the lower-level will never know where the upper-level is, but as long as it is a DNS server, it will always know where the root is. This is required. Therefore, when a user on www.baidu.com goes to www.sina.com, the DNS of Baidu will find the root directly. The root tells the DNS that it does not know where www.sina.com is,. com. com. com tells it. HP may know, So DNS will find it. HP. In the end, I found the WWW server name in. HP, So I completed the query and resolution process from www.baidu.com to www.hp.com.

Small Scale-out: there are 13 root nodes in the world, one in Japan, one in Europe, and the other in the United States.

It is too slow for us to bypass every query, so we have images in China.

4. Host record type.

A host has a "record type" to indicate its own functions.

So what is a record?

DNS is actually a database, which contains various mappings.

Although they all correspond to each other, the records are different.

Common record types:

1. FQDN --> IP: a record (address)

2. IP --> FQDN: pointer record (PTR)

3. Domain --> server: NS (Name Server)

4. Domain --> MTA: MX (Mail exchanger) is used to identify the mail domain name of a domain

5. nickname --> name: cname record type (formal name record type)

6. SOA (start of authority) is used to indicate the start authorization domain type of the current domain.

Generally, it indicates who the Primary Domain Name Server belongs.

V. DNS server type:

A. Master name server and slave name server

To ensure service availability, we usually configure one primary server and multiple secondary servers in one domain.

This means that we have two or more DNS servers, each of which knows all the host names in the domain. However, if a new host obtains a domain name, it will be created/deleted on the master server. To ensure that the information of other government-assisted servers is consistent with that of the Government-responsible server, the server copies the information on the government-responsible server every time. The synchronous mode is region transfer.

Axfr full zone transfer transfers all information

Ixfr incremental region transfer only transfers the new information

Generally, the master server will notify the slave server to synchronize data. Whenever new things enter, they are automatically notified. Synchronize immediately from the server, instead of based on the set synchronization time. In this way, the master server is directly avoided and the slave server is not updated.

 

B. Cache Server

Accelerate access and save bandwidth

After the first person accesses the domain name, if the second person accesses the domain name again, it will directly read it from the cache. There is no real de-connection at all

C. forwarder:

Implement interaction between two DNS servers isolated from internal and external firewalls.

6. How does one query www.a.org?

1. First find the/etc/host file to see if there is a corresponding parsing record in the host file.

2. Find the local DNS cache on the current host

3. Use a client tool to find the first DNS server,

4. the DNS server needs to find the server cache again

5. If no cache is available, check whether the domain is resolved by yourself.

If yes, contact the local domain

Return the result to the user

6. Find the root ......

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.