Rotten mud: centos installation and configuration of DNS server, centosdns

Source: Internet
Author: User
Tags server installation and configuration domain server nslookup command

Rotten mud: centos installation and configuration of DNS server, centosdns

This article was sponsored by Xiuyi linfeng and first launched in the dark world.

To configure the DNS server in centos, you must first install the DNS software BIND. Of course, we can also install other DNS software, such as the domestic open source DNS software DNSPod.

Here we use the DNS software BIND as an example to conduct an experiment.

This experiment: OS centos6.5 64bit

Run the following command to install the DNS software:

Yum-y install bind-chroot bind-utils

The BIND configuration file is stored in two main locations:

/Etc/named. conf is the main configuration file of the BIND service.

/Var/named/This is the zone file used to store DNS

If bind-chroot is installed, BIND will be encapsulated into a pseudo root directory, and the original configuration file location will change:

/Var/named/etc/named. conf and/var/named/

Chroot encapsulates related files in a pseudo root directory for security protection. Once this program is cracked, you can only access the contents in the pseudo root directory, rather than the real root directory.

After the bind has been installed, the configuration file content is blank. We can use the bind help document for configuration. Because there are many bind configuration parameters, we strongly recommend that you configure it on the basis of the help document through the template provided by bind. View the bind configuration as follows:

Rpm-ql bind | tac

Copy the files in the/usr/share/doc/bind-9.8.2/sample/var/and/usr/share/doc/bind-9.8.2/sample/etc/directories respectively, go to the/var/named/chroot/var/AND/var/named/chroot/etc/directories, as shown below:

Cp-rv/usr/share/doc/bind-9.8.2/sample/var/*/var/named/chroot/var/

Cp-rv/usr/share/doc/bind-9.8.2/sample/etc/*/var/named/chroot/etc/

After the configuration template is copied, modify the bind master configuration file/var/named/chroot/etc/named. conf as follows:

Vi/var/named/chroot/etc/named. conf

We will find that there are many options in this configuration file. For the simplicity of the experiment, we delete other functions that are not needed for the moment and only retain the most basic functions of bind. As follows:

This file is retained only. The bind working directory is/var/named/, and the port and IP address of the bind listener are specified.

We have configured the bind configuration file above. If we only follow the above operations, our dns will not work properly yet. Because no related domain is created, we will create a primary domain server.

First, add a definition of the primary domain in the bind configuration file. As follows:

Zone "ilanni.com "{

Type master;

File "ilanni.com. zone ";

};

Zone "ilanni.com" defines the ilanni.com domain

Type master; defines the domain as the main domain service

File "ilanni.com. zone" defines the zone file in the/var/named/chroot/var/named/directory.

Now let's create a zone file in the ilanni.com domain. By default, the bind does not generate this file. We need to add it manually, but we mentioned that the bind configuration file is complicated, therefore, we recommend that you use the template file named provided by bind. localhost. As follows:

Copy the named. localhost file and rename it ilanni.com. zone as follows:

Cp named. localhost ilanni.com. zone

Now, edit the ilanni.com. zone file and add relevant address resolution to it. As follows:

Vi ilanni.com. zone

We only need to add a new resource record at the end of the file,A resource record is generally composed of four parts. The first part is the host name, the second part is the type, and the third part is the classification, where A represents the IPv4 address, and the fourth part represents the IP address.

Note that three resource records are added here. The first is the mail resource record. The mail resource record must be written in the front of other resource records, and the mail resource record is in the form of a domain name, and there is a last point behind the domain name.

In this case, our ilanni.com. after the zone file has been configured, we will check the/var/named/chroot/var/named directory. All file attributes must have readable attributes. As follows:

After all the above configurations are complete, we can start the bind. Run the following command:

/Etc/init. d/named start

If the bind has been started, we can use the/etc/init. d/named reload command to reload the configuration file. As follows:

Since this machine has already set up a DHCP server, we can modify the DNS address obtained by the client through The DHCP Service as follows:

10.5.5.1 is the IP address of the local machine.

Now let's take a look at the IP address obtained by the client, as shown below:

Run the nslookup command to test the function:

Run the host command to test the IP addresses of www.ilanni.com and ftp.ilanni.com, as shown below:

Host www.ilanni.com

Host ftp.ilanni.com

We can see that www.ilanni.com and ftp.ilanni.com have been resolved. This is the same as the configuration on BIND.

Run the dig command to test the IP address of the email server, as shown below:

Dig-t MX ilanni.com

We can see that the email server has been correctly resolved to 10.5.5.3.

You can also use the dig command to test the www and ftp resolution, as shown below:

Dig-t A www.ilanni.com

Dig-t A ftp.ilanni.com

Now we can access the web server that has been built on 10.5.5.3 through the most practical results, as shown below:

By now, DNS installation and simple configuration for centos have all been completed.


How to build a DNS server in centos 65 in linux

Centos6.5 DNS Server installation and configuration of BIND
For detailed steps, see the following document.
I am from Baidu.
Cache.baiducontent.com/..?&p1=1

CentOS64 DNS server configuration cannot resolve Internet problems

Full recursive search, and forwarding
Allow-recursion yes
Forwarders {external DNS address}

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.