Install the DNS configuration document under Redhat Linux9 __linux

Source: Internet
Author: User
Tags nslookup to domain

Article keywords: DNS Linux RedHat

installation of DNS

Profile: File name and source/etc/named.conf,/var/named/named.local,/var/named/named.ca (caching-nameserver-7.2-7.noarch.rpm)

/etc/resolv.conf System self-belt

Installation:

B, start the service

/etc/rc.d/init.d/named start

Service named start

C, stop the service

Ps–ef |grep named #找到进程号

Kill Process Number

D, detection

Modify/etc/resolv.conf

Nslookup

>127.0.0.1

>localhost

  configuration file Resolution

Basically, the main configuration of BIND is placed in the/etc/named.conf file. But for the hostname <--> IP correspondence, it needs to be set by zone. But this zone file name is stipulated in the/etc/named.conf. So please note that each zone name is variable, but it needs to be named in/etc/named.conf. In addition, it is best to place zone files directly into the default directory of BIND, which is/var/named. This is better management.

Configuration file instance:

/etc/named.conf is the primary configuration file for DNS.

[Root@wljs Root] #vi/etc/named.conf

Options {

Directory "/var/named"; This is the "positive and negative solution" document

Placed directory ", default directory

};

First, define the. (root) This type is hint file content, generally does not modify

Zone "." {//define Root

Type hint; The selected type is hint (. private)

File "named.ca"; The default filename named.ca

}; Sometimes it can be named.root.

In the DNS database, the addresses of all the root DNS servers are listed in the named.ca file.

  

/again is defined as the positive and negative solution of the localhost.

Zone "localhost" {//this zone is to parse localhost domain name and use.

Type master; The main set of files in this machine.

File "Named.localhost"; The file name is being solved. You can take it with your own pleasure.

};

Zone "0.0.127.in-addr.arpa" {

The IP network segment of the inverse solution. The In-addr.arp.

is a fixed IP paragraph.

Type master;

File "named.127.0.0";//name arbitrary.

};

Note: When writing reverse address resolution, write with the usual

The IP address order is reversed.

Then define the positive and negative solutions of your own domain.

Zone "wljs.edu.cn" {

Let's say this is the domain name you want to define.

Type master;

File "named.wljs.edu.cn";

};

Zone "162.45.210.in-addr.arpa" {

Type master;

File "named.210.45.162";

};

  

  

Attention:

1. Directory: This value is the directory where each zone file is placed. For example, in localhost positive solution zone, the file is Named.localhost, then the path of this file is/var/named/named.localhost.

2, about. (root): The most important thing for root is that the value of that type is hint. Remember to write right oh.

3, on the localhost of the positive and negative solution: the positive and negative solution file name can be set at will, however, to pay special attention to that is the zone after the domain name!

4, about other domain's positive and negative solution: in fact, and localhost no different, just domain name is different.

5, the inverse solution of the writing: the Zone of the inverse solution is more special, it must be the IP in turn, such as 127.0.0.0/24 this class C network segment, to write, it must be written in reverse 0.0.127 such a form. It should be noted that the last side must be added In-addr.arpa. Don't forget it.

Configuration file Named.local

The named.local stores the forward parsing of the localhost, which reads as follows:

[Root@localhost root]# vi/var/named/named.local

$TTL 86400

@ in SOA localhost. Root.localhost. (

2002120601; Serial

28800; Refresh

14400; Retry

720000; Expire

86400); Minimum

@ in NS localhost.

localhost. In A 127.0.0.1

Comments:

1, $TTL 86400; This is related to the time to clear the cache. The unit is seconds. It defines how long records of an outward lookup can be maintained in the cache of DNS. This value is too big and too small to be bad. TTL is time to live!

2, @ This represents the zone definition of the part. Take this file as an example, because we define the localhost as a zone in the/etc/named.conf, so here, this symbol represents localhost.

3, SOA This is the start of the authority content. That is, the set to be followed is to begin. This is present in every zone file.

4, after the SOA will be followed by two parts, the first is the host name (localhost.), please pay special attention to that localhost after a decimal point (.) This thing is very important. He represents "a complete hostname + domain name". If you do not add (.), it means that the text is "hostname only, plus domain name." This is the easiest mistake for beginners. The second e-mail for the administrator. Because you cannot use @ (which is already a special symbol), it is also replaced with (.). For example, I used root@localhost as my e-mail, so I wrote a root.localhost. , similarly, the last side has a (.).

5, the small scraping number () surrounded by five digits, these five numbers in addition to minimum and TTL-related, the rest with the slave and master data synchronization operation.

Serial: This number is used only as a reference value for the update between master and slave that is, when the serial of slave is less than master, then update moves. Usually we use time as the basis for serial, for example, the first time of December 6, 2002, can be written as "2002120601" Please note that this number should not exceed 10 digits.

Refresh:slave how often to update the active time

Retry: If the time to Refresh, but slave can not connect to master, then after how long, slave will again actively try to go online with the host;

Expire: If slave has been unable to connect to master, then after how long, command slave to stop connecting master.

Minimum: This is actually the TTL. If you do not define a TTL, then the value of the TTL is set by this.

6, @ in NS localhost. ; The NS represents the meaning of name server, followed by "hostname or FQDN", which means that the previous domain is managed by the host behind it. This line means that the @ (zone, that is, localhost domain) management of the Name Server for the localhost this host, please note that the localhost must be followed by (.). Why, then? Because if you do not add (.), then the host name will become Localhost.localhost. Why. This is because the BIND preset is not written. , then it means that the name is Hostname and needs to be added to domain name.

7, localhost. In A 127.0.0.1

This sentence specifies the corresponding relationship between the host and the IP address. A positive solution is usually represented by a, and since name server is the name of the host, the subsequent addition of the positive solution of this name server

/var/named/named.127.0.0

The/var/named/named.127.0.0 file is a localhost file for the reverse solution.

[Root@localhost named] #vi named.127.0.0

#这个文件名称是在/etc/named.conf inside.

$TTL 600

@ in SOA localhost. Root.localhost. (2002120601; Serial

28800; Refresh

14400; Retry

720000; Expire

86400); Minimum;

@ in NS localhost.

1 in PTR localhost. PTR This is the symbol of the inverse solution.

;ip-> Host

Named.wljs.edu.cn

$TTL 86400

@ in SOA jsj1.wljs.edu.cn. root.wljs.edu.cn. (

2004102901; Serial

28800; Refresh

14400; Retry

720000; Expire

86400); minimum

@ in NS jsj1.wljs.edu.cn.

@ in MX ten jsj1.wljs.edu.cn.

Jsj1 in A 210.45.162.14

Jsj2 in A 210.45.162.30

Jsj1 in TXT "Red Hat Linux 9"

www in CNAME jsj1.wljs.edu.cn.

Comments:

1, Mx:mail Exchanger (MX), specify the mail distributor. Specifies that a proxy mail distributor receives messages from the Internet. The message is then distributed to the appropriate host by the Agent Mail Distributor.

2, TXT: Description part.

3. CNAME: Specify host Alias

$TTL 86400

@ in SOA jsj1.edu.cn. root.jsj1.edu.cn. (

2004102901; Serial

28800; Refresh

14400; Retry

720000; Expire

86400); minimum

@ in NS jsj1.wljs.edu.cn

In PTR jsj1.wljs.edu.cn.

In PTR jsj2.wljs.edu.cn.

/var/named/named.ca files for primary DNS servers

The named.ca file in the DNS database provides the address of the root DNS server. When a DNS request exceeds the domain's proxy scope, the DNS server will give the request to root DNS. Information about the root name server is included in the named.ca file.

This file usually does not need to be modified. However, for a good system administrator, this file should be updated frequently because the sites in this file will change as the network changes.

  Test

After you have configured your files, you should test:

1, start the service:/etc/rc.d/init.d/named start

2, modify the/etc/resolv.conf file name server for 210.45.162.14

3, Nslookup

>jsj1.wljs.edu.cn

>jsj2.wljs.edu.cn

>210.45.162.14

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.