In a network set up with the TCP/IP protocol family, each node has a unique IP address that is used as their only token. However, it would be unthinkable if the user were to be remembered for such an IP address without a memory rule. People need a string of memory rules to be the name of a unique tag node.
However, although the symbol name is very convenient for people, it is not so convenient to implement on the computer. In order to solve this demand, a Domain Name Service system DNS, which runs on the TCP protocol, is responsible for converting the character name-domain name to the corresponding IP address. This process is the domain name resolution, is responsible for the domain name resolution machine is called the domain name server.
1, the method of domain name resolution
1.1 The first domain name resolution method
The simplest method of host name resolution is to record all the host names and their corresponding IP addresses in a file, and to ensure the uniqueness of the hostname in the file, and to complete the resolution of the host name by retrieving the file. There are historical reasons for adopting this simplest approach:
Throughout the 70 's, Apranet was only a small group composed of similar hundreds of hosts. In order to solve the problem of host name resolution, the name of each host connected to the ARPANET and the corresponding address are saved in the HOSTS.TXT file. So every time you add a machine, you must modify the HOSTS.TXT file once. With the continuous development of the network, the number of hosts in the network explosive increase, this method of domain name resolution has been unable to adapt to the new resolution needs.
1.2 Distributed domain name servers
In this way, we have detailed descriptions in the sixth chapter of the basic article, which we will not repeat here. In this distributed Domain Name server system, each domain name server (DNS) is responsible for resolving its own part of this host domain name.
Generally speaking, if you are in the company or the organization has not many hosts, is generally the domain name parsing work to the ISP's domain name server to complete. And if your organization has more hosts, we can build our own domain name server to resolve the host of your organization.
2, the Domain name server establishes the example
2.1 Instance Environment
Suppose we need to set up a business name server that applies to the following conditions.
1. Have a Class C network segment address, for 202.101.55.0
2. Enterprise Domain name registration for company.com.
3. The IP of the domain name server is set to 202.101.55.55 and the host name is dns.company.com. It acts as a proxy at the same time.
4. The enterprise network is connected to the Internet through routers.
5. The servers to be resolved are:
Www.company.com (202.101.55.1) Web server
Mail.company.com (202.101.55.2) e-mail server
2.2 Pre-installation preparatory work
First of all, it is necessary to ensure that there are/etc/resolv.conf and/etc/hosts.conf two documents in the department. The contents of the/etc/resolv.conf file are as follows:
Domain compay.com
NameServer 202.101.55.55
The first line indicates the domain that the host that you want to connect to should search for. And the second line indicates at which address you can find the required domain Name service large. The contents of the/etc/hosts.conf are shown below:
Order Hosts,bind
Multi on
The settings here tell the host name to search in the/etc/hosts file first, and then query the domain name server.
2.3 Definition File/etc/named.boot
To enable the Linux system to complete the function of the domain name server, you need to run a named service process. This service process can be selected when Linux is installed.
Named needs to read an initialization file--/etc/named.boot when it is started, which is the basic configuration file for named. It does not contain any DNS data, and for the preceding hypothetical environment, we will write in this file:
Diretory/etc/named
Primary company.com Db.company
Primary 0.0.127.in-addr. ARPA db.127.0.0
Primary 55.101.202.in-addr. ARPA db.202.101.55
Cache. Db.cache
Let's go through the contents of this document line by row:
1 in the first row we specify that named read the DNS data files from the/etc/named directory. This directory can be specified and created by itself, specifying that all DNS data files are stored in this directory;
2 The second line specifies named as the primary domain name server for the company.com, and Db.company file contains parsing data for all *.my.com forms of domain names.
3 The third row specifies named as the conversion master server for the 127.0.0 network segment (local loopback) address. The db.127.0.0 file contains the conversion data for all 127.0.0.* forms of address to the domain name.
4 The fourth row specifies named as the 202.101.55 network segment address Conversion master server, db.202.101.55 file contains all the 202.101.55.* form of address to the domain name of the conversion data.
5 The last line specifies that named obtains the top-level "root" server address of the Internet from the Db.cache file. To illustrate, the names of these data files are determined by themselves.
2.4 Establishing a forward domain conversion data file Db.company
Based on the definition in the/etc/named.boot file, we create the file Db.company in the/etc/named directory and write all the host nodes in the company.com domain. Based on the previously assumed environment, you can write to:
@ in SOA dns.company.com. Root.dns.company.com. (
200002011. File version number
28800; Refresh Time (sec)
7200; retry time (seconds)
3600000; End Time (sec)
86400); TTL lifetime (sec)
In NS dns.company.com
www in A 202.101.55.1
Email in A 202.101.55.2
Proxy in CNAME