Linux Learning Server build--dns Server

Source: Internet
Author: User
Tags file permissions

DNS server is actually a domain name resolution system, the prerequisite is only that two virtual machines can ping the same can, so can be in the basic network configuration alone, or you can follow the DHCP server to practice, but we used to ping the IP address, now become ping domain name (example: Ping www.qq.com)

DNS can be said to be the most important, only the DNS domain name resolution has been established, the Internet does not have to enter the IP address to login to our website or Web page, which involves the next section of my Apache server to mention, here is an unknown solution.

The following I began to talk about DNS server (DNS file a lot, to pay attention to the place is also the details of the problem, a little careless will ping does not pass) before the disadvantage of eating big ....

First step: Open CentOS (set up the environment based on the basic network configuration)--it's used every time.

Step two: Directly edit the first file of DNS (DNS has 4 files altogether)

Edit Command # vim/etc/named.conf (actually better remember DNS is changed name, so the last restart with the "service named restart")

Go to File

This is the beginning of the file, we want to modify the place is here, the three painted places are changed to "any", and then save the exit

(Note: The semicolon in curly braces {} ";" Don't delete it.)

Step three: Edit the second file of DNS (this file is mainly edit positive and negative parsing)

Edit Command #vim/etc/named.rfc1912.zone (to be flexible with TAB key)

This is the first page to enter the file, we have to edit the second "zone" inside the content (do not edit the wrong)

Edit the place for the picture of the "localhost" and "name.localhost" the contents of the quotation marks are all deleted, changed to the following:

    • "LocalHost" to qq.com (assuming the domain name to resolve is www.qq.com)
    • "Name.localhost" is changed to qq.com.zone(suffix is especially important, you need to copy the file later)

-This is the positive parsing file editing method, the forward parsing file can be edited countless , if you want to copy the entire forward parsing of the whole content of n copies

    • First press ESC to return to command mode
    • Move the cursor to the first letter you want to copy
    • Press "V" on the keyboard to select it, and the arrows around the top and bottom delimit the selected range
    • Finally Press "Y" for copy

    • After the first forward parsing the file press "P" paste (you want a few domain names, you can paste a few, but these domain names are the IP address: 192.168.1.100)

(within the area is the content after being re-pasted)

    • It's good to change QQ in the area to the domain you want.

()

-This is the parsing process for forward multi-domain names

Positive to the domain name resolution is done, followed by the reverse domain name resolution.

Move the cursor down to see the entire contents of the reverse domain

What we want to edit is the middle content ( although there is n for the domain name, there is only one reverse domain name )

The resolution of reverse domain name is also two parts to be edited

Change the part of the drawing to the following form

    • Change "1.0.0.127.in-addr.arpa" to "1.168.192.in-addr.arpa" (Note: Reverse Domain name resolution is to read the first three bits of the IP address from right to left, and also to delete the content . in-addr.arpa )
    • Change "Named.loopback" to "1.168.192.rev" (suffix "rev" is also used to copy files later)

--Reverse Domain name resolution has also been completed, compared to the forward domain name resolution, reverse Domain name modification is more prone to error

Fourth step: Generate positive and negative parsing of the file, and modify the content

1. Forward parsing

    first to enter the directory # cd/var/named and "ll" to see the details (two domain name resolution files are copied in this directory is completed)

The next step is to generate a forward-and-backward parsing file

    • Copy the forward domain "Qq.com.zone" content to the "Named.localhost" forward Domain name resolution file
    • Copy the forward domain "1.168.192.rev" content to the "named.loopback" reverse Domain name resolution file
    • It should be noted that the "CP" command must be added "-p" to take effect ("-p is to retain the original file permissions, if there is no"-P "in the last" service named restart "will not display errors, but can not implement the domain name resolution--ping domain name) This is a pit ....

After the copy is finished, edit the forward "Qq.com.zone" first.

The file is as follows:

(The two parts we're going to edit are those that are drawn)

The edits are also very large:

    • The first section deletes the original content and adds "dns.qq.com." and "root.qq.com." (DNS represents the domain name resolution; Root is the privilege of giving IT administrators; Note: Be sure to add a little "after" com ".) Otherwise you will get an error)--You should be aware of this point in all positive and negative parsing files.
    • In the second part, we can compare the changes according to the diagram (it is easy to miss the front "www" and "DNS"; These two represent our IP address: 192.168.1.100 finally resolves to "www.qq.com" The other is to tell us that he was implemented through the Domain name resolution "DNS" server)

This is the forward domain name of the file modification, remember that the forward domain name can have n, so we are in the modification of other forward domain files are can follow this method.

Made a few changes:

As our "Qq.com.zone" file has been modified to complete, as long as the Qq.com.zom files are copied to "Baidu.com.zone" and "Sina.com.zone" and then the "QQ" into "Baidu" and "Sina" words can be

Entering the file will find the same as the "Qq.com.zone" we have modified.

We have to do is also become very simple, as long as the "QQ" to "Baidu" or "Sina" can be

Here, the parsing file is modified.

2. Reverse parsing

The first is also the editor we copied the reverse parse file "1.168.192.rev", edit command #vim 1.168.192.rev (reverse parse file for multi-domain name resolution only need to add, no need to copy separately)

Into the file, the editing is still that two parts

The main editorial content is as follows:

I would like to make a specific analysis: (To add ".") )

    • In the first part, it is the same as the edit of the first part of the domain name, deleting the original content and adding "dns.qq.com." and "root.qq.com." ()
    • In the second part, the "dns.qq.com" is added after the NS
    • Remove all of the following and edit the main template as shown in the figure: PTR www.qq.com.
    • "+"-is the end of our IP address, our experimental IP is: 192.168.1. If you change to: 172.30.18. The previous one should be "the"
    • Our newly added domain names are written in the following "www.baidu.com." and "www.sina.com."

Fifth step: Here four DNS files are resolved, the next step is to restart the DNS #service named restart

Three "OK" is the best return ...

Sixth step: Finally in the Test side of Windows to see if the domain name is really resolved successfully

(QQ success)

(Baidu Success)

(Sina Success)

The configuration of the DNS server can be completed successfully!! But this is only a small part of the environment, our DNS is for the Apache server, the next thing to say is the Apache server

Note: An IP is best if its domain name is within 10, if too many servers will not survive

Linux Learning Server build--dns Server

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.