How to install and configure a DNS server in CentOS

Source: Internet
Author: User
Tags server installation and configuration domain name server mx record

[Introduction] Domain Name Server ). Domain names and IP addresses on the Internet correspond one by one. Although domain names are easy to remember, machines can only know each other's IP addresses. The conversion between them is called domain name resolution, domain name resolution must be completed by a dedicated domain name resolution server. DNS is the server for domain name resolution.

This document uses Red Hat Enterprise Linux AS v4 AS a platform

I. Data Reference and preparation:

DNS refers to the Domain Name Server ). Domain names and IP addresses on the Internet correspond one by one. Although domain names are easy to remember, machines can only know each other's IP addresses. The conversion between them is called domain name resolution, domain name resolution must be completed by a dedicated domain name resolution server. DNS is the server for domain name resolution.

Some markup explanations:

@ ---- This symbol means that SOA is the same as the domain

IN ----- IN is A domain name class that provides IP addresses. When used together with A, PTR, or CNAME record, the domain name can be mapped to an IP address, otherwise, NS ----- domain name or IP address of the Regional DNS server specified by the Domain Name Server

MX-the MX record defines the machine on which an email is sent for the domain or a single host. The domain definition tells everyone to send the email to the person or machine in the domain to communicate.

SOA ----- Start Of Authority indicates that the subsequent domain name defines the email address Of the master Domain Name Server and the contact point Of the domain.

PTR --- ing IP addresses to host names. PTR records execute the opposite process of A and record

A ---- map the host name to its IP address

First download the bind installation package from the http://www.isc.org/products/BIND/ or/cdrom/RedHat/RPMS on the disc to find the relevant installation package.

Ii. Server installation and configuration

# Rpm-ivh bind *. rpm
# Vi/etc/name. conf
Directory "/var/named ";
};
Controls {
Inet 127.0.0.1 allow {localhost;} keys {rndckey ;};
};
Zone "." IN {
File "named. ca ";
};

Zone "localhost" IN {
Type master;
File "localhost. zone ";
Allow-update {none ;};
};
Zone "xuanfei.net" IN {
Type master;
File "test.net"
Allow-update {none ;};
};

Zone "0.0.127.in-addr. arpa" IN {
Type master;
File "named. local ";
Allow-update {none ;};
};
Zone "63.45.10.in-addr. arpa" IN {
Type master;
File "10.45.63 ";
# Vi test. zone
$ Ttl 1D
@ In soa linux.xuanfei.net. root.xuanfei.net .(

1053891162
3 H
15 M
1 W
1D)

In ns xuanfei.net.
In mx 5 mail.xuanfei.net.
Www in a 10.45.63.185
It in a 10.45.63.188
# Vi/var/named/10.45.63
@ In soa linux.xuanfei.net. root.xuanfei.net .(
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In ns linux.xuanfei.net.

--------------------------------------------------------------------------------

Main Configuration File explanation:

# Rpm-ql bind | More

List all files and locations of the software package.

The configuration file is usually in/etc/named. conf

The database files are generally under/var/named.

The following are the configuration files used to configure the DNS server:

/Etc/named. conf

/Use // and/**/In the NAMED. CONF configuration file for comments,

Ptions {/* OPTIONS is used to define some environments that affect the entire DNS server. For example, di rectory is used to specify the path of the file specified in this file, for example, you can specify it to/var/named, and you can also specify a port here. If this parameter is not specified, the port is 53.

*/

Directory "/var/named ";

};//

//

// A caching only nameserver config

//

Controls {

Inet 127.0.0.1 allow {localhost;} keys {rndckey ;};

};

Zone "." IN {// IN this file, the zone keyword is used to define the domain zone. A zone keyword defines a domain zone.

Type hint;

/* Here there are three types of type: master, slave, and hint. Their meanings are:

Master: indicates that the master Domain Name Server is defined

Slave: defines the secondary Domain Name Server

Hint: indicates the root domain name server in the Internet.

*/

File "named. ca"; // specifies the file that stores DNS records.

};

Zone "localhost" IN {// defines a forward region with the domain name localhost

Type master;

File "localhost. zone ";

Allow-update {none ;};

};

Zone "xuanfei.net" IN {// specifies a forward region with the domain name test.net.

Type master;

File "test.net"

Allow-update {none ;};

};

Zone "0.0.127.in-addr. arpa" IN {// defines a reverse domain with the IP address 127.0.0. *

Type master;

File "named. local ";

Allow-update {none ;};

};

Zone "63.45.10.in-addr. arpa" IN {// define an IP address as 10.45.63. * Reverse Domain

Type master;

File "10.45.63 ";

/Var/named/test.net File

@ In soa linux.test.net. root.test.net. (SOA indicates that authorization starts.
/* The IN above indicates that the subsequent data uses INTERNET standards. @ Indicates the corresponding domain name. For example, test.net indicates the beginning of a domain name record definition. Linux.test.net is the primary Domain Name Server for this domain, while webmaster.test.net is the administrator's email address. Note that this is the use of. In the mail address to replace @. In the common mail address, SOA indicates the beginning of authorization.

*/

2003012101; serial (d. adams)/* The number in front of the row indicates the version of the configuration file. The format is the number of modifications made on the day of the year, month, and day. This number should be modified each time the configuration file is modified, otherwise, your modifications will not be updated to the database of other DNS servers on the Internet, that is, your updates may not reflect your updates for clients that do not use your configured DNS server as the DNS server, it makes no sense for them to update.

*/

28800; refresh

/* Defines the refresh frequency of the unit, that is, the time required to query a master server from the Domain Name Server to ensure that the data on the slave server is up-to-date.

*/

7200; retry

/* The above value specifies the Retry Interval in seconds. That is, when the slave server attempts to query more information on the master server, the connection fails, the value specifies how long the service will take and try again.

*/

3600000; expiry

/* The above is used to specify the time after the slave server fails to update the master service to clear the corresponding records. The above values are measured in minutes.

*/

8400)

/* The above data is used to specify how long the buffer server can clear the corresponding records after it cannot contact the master service.

Recording

*/

In ns linux

In mx 10 linux

Linux in a 10.45.63.185

It in a 10.45.63.188

Www in cname linux

/* The first column above indicates the host name, saving the subsequent domain.

NS: indicates that the host is a Domain Name Server,

A: defines A record, that is, the corresponding record from the host name to the IP address.

MX defines an email record

CNAME: defines an alias for the corresponding host

/Var/named/10.45.63

@ In soa linux.xuanfei.net. root.xuanfei.net .(

1997022700; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

In ns linux.xuanfei.net.

/* The meanings of the preceding keywords are the same as those of xuanfei.net.

185 in ptr linux.xuanfei.net.

188 in ptr it.xuanfei.net.

/*

The first column above indicates the IP address of the host. The network address section is omitted. For example, 185 is complete:

10.45.63.185

PTR: Indicates Reverse Record

The last column indicates the host domain name.

Iii. Enabling and Testing

Start the service:

#/Etc/init. d/named startd

Test tool:

Linux: host dig ping

Win: ping nslookup


Customer Service Configuration:

Linux: Modify/etc/resolv. conf

Win: Double-click Local Connection ==open TCP/IP properties ==select the custom DNS server address

Iv. Summary

The DNS Service looks simple, but it is actually a great learning. It takes a lot of effort to figure out the details! Its application can also be widely used in telecom exchange technology, IPv6 Anycasting, Net to Net VPN, and other fields. There are also important security protection fields! Continue to study hard! :)


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.