Let Linux become DNS server ---------- operating system: redhat8.0

xiaoxiao2021-03-06  42

First, what is DNS

DNS is an abbreviation of domain name resolution servers. It is to say that the domain name is converted into an IP address corresponding to it, and the IP address reverse parsing is converted into domain names. For the discussion of DNS, please refer to the DNS article of this site.

Second, prerequisites

1. When you install Linux, you have to choose to install the DNS service and start the DNS at the time of Linux.

2, files that may be used

File name where the file is located

Named.boot / etc / "Self-contained"

Named.conf / etc / "Self-contained"

Named.local / var / named / "Self-contained"

Name2ip (forward parsing) / var / named / "creation or generate"

IP2name (reverse analysis) / var / named / "creation or generated"

Note: If you are also configured with a DNS option while configuring the network after installation, you may have a lot of work to be installed. The detailed description is as follows:

Suppose your IP is the internal IP of the local area network: 192.168.0.88 domain name: mydomain.com

Then type under the console: After entering the detailed DNS information after NetConf, that is, in this option: Domain Name Server (DNS) After configuring the DNS related information, enter the command under the console: NDC Restart will be "" Automatically generate 2 files of "forward parsing" and "reverse parsing" in the directory, and the file name should be: "192.168.0" and "mydomain.com", you just need to add the following format Write to complete the configuration of DNS. You can also name these two files anything, as long as you can understand, but must be in the file named.conf.

Third, the above five files are as follows:

1, Named.boot

;

A Caching Only Nameserver Config

Directory / var / named (tell LinuxDNS configuration file storage)

Chace named.ca

Primary 0.0.127.in-addr.Arpa named.local

PRIMARY MyDomain.com Mydomain.com

Primary 0.168.192.in-addr.Arpa 192.168.0

# The function of the two lines below is to send the domain name that cannot be parsed to the outside to resolve, mainly for hosts in the local area network.

Forwardes mydomain.com

Options forward-only

2, Named.conf

;

Options {

DIRECTORY "/ var / named";

}

"." {

Type hint;

File "named.ca";

}

ZONE "mydomain.com" {

TYPE MASTER;

File "mydomain.com";

}

Zone "0.0.127.in-addr.Arpa" {

TYPE MASTER;

File "named.local";

}

Zone "0.168.192.in-addr.arpa" {Type Master

File "192.168.0";

}

3, Named.local

@ In SOA localhost.root. Localhost

1997022700; Serial

28800; Refresh

14400; RETRY

3600000; EXPIRE

86400); Minimum

IN ns localhost.

1 in ptr localhost.

4, forward parsing file: mydomain.com

@ In soa myname.mydomain.com root.myname.mydomain.com

1997022700; Serial

28800; Refresh

14400; RETRY

3600000; EXPIRE

86400); Minimum

NS myname.mydomain.com.

MX 10 myname.mydomain.com.

;

Localhost in A 127.0.0.1

MyName in A 192.168.0.88

WWW in A 192.168.0.88

Mail in A 192.168.0.88

FTP IN A 192.168.0.88

;

MyName cname myname.mydomain.com.

WWW cname myname.mydomain.com.

Mail cname myname.mydomain.com.

FTP cname myname.mydomain.com.

5, reverse parsing documents: 192.168.0

@ In soa myname.mydomain.com root.myname.mydomain.com

1997022700; Serial

28800; Refresh

14400; RETRY

3600000; EXPIRE

86400); Minimum

NS myname.mydomain.com.

88 in ptr myname.mydomain.com.

At this point, the DNS configuration has been completed, and there are several related files, you can refer to:

/etc/host.conf

Order Host,

bind

Multi on

/ etc / host

MyName

/ etc / host

127.0.0.1 MyName.Mydomain.com MyName Localhost.localhostDomain Localhost

192.168.0.88 myname.mydomain.com myname

At this point, the configuration of the DNS has been completed, and now you want to test, enter the following command under the console:

NDC RESTART

Nslookup

There will be a prompt ">", you can enter your host name MyName, and Mail, FTP, WWW, the machine will resolve into specific information, I believe you will succeed

转载请注明原文地址:https://www.9cbs.com/read-53308.html

New Post(0)