Linux Setup DNS server (ii)

Source: Internet
Author: User
Tags bind config resource versions domain name server nameserver firewall

2. Install Server Software

2.1 Get the Bind package (now the new version is 8.2.2 P5)

Get the latest stable version of three files from Bind's home page http://www.isc.org:

Bind-contrib.tar.gz

Bind-doc.tar.gz

Bind-src.tar.gz

Or get three files from the http://www.redhat.com:

bind-8.2.2-p5-9.i386.rpm

bind-devel-8.2.2-p5-9.i386.rpm

cache-nameserver-6.2-2.noarch.rpm

2.2 Installing the BIND package

Install the package in the TAR package:

Unpack the package first

Tar zxpf bind-contrib.tar.gz

Tar zxpf bind-doc.tar.gz

Tar zxpf bind-src.tar.gz

Edit Modify Makefile.set file, add or modify

' Destlib=/usr/lib/bind/lib '

' Destinc= '/usr/lib/bind/include '

Compiling and installing

Make

Make install

Install the RPM package package:

RPM-UHV bind-8.2.2-p5-9.i386.rpm

RPM-UHV bind-devel-8.2.2-p5-9.i386.rpm

RPM-UHV cache-nameserver-6.2-2.noarch.rpm

3. Let the server run up---basic article

3.1

Bind can be configured to run in several different ways, with universal bind configured as a pure parser system, a pure caching server, a primary server, and a secondary server.

A parser is a program code that queries domain information through a domain name server, and in a UNIX system it is implemented as a library routine, not as a separate client program. The pure parser system is easy to configure, just set the/etc/ resolv.conf file. This is typically used in systems where the domain name server software is not running locally because some restrictions are not available.

For example, the/etc/resolv.conf content is similar to the following:

Search test.com

NameServer 127.0.0.1

NameServer 172.16.0.1

When configuring the parser library to use the BIND name service for host lookups, you must also tell it which name server to use. There is a separate file for this, called resolv.conf. If the file is not present or empty, then the parser assumes that the name server is on your local host.

If you run a name server on your local host, you must set it individually.

The most important option in resolv.conf is nameserver, which gives the IP address of the name server to use. If you specify several name servers by giving the nameserver option several times, they will be tried in the order given. Therefore, you should first give the most reliable server. Currently, up to three name servers are supported.

If the nameserver option is not given, the parser attempts to connect to the name server on the local host.

Other two options, domain and search involve the default domain appended to the host name if Bind cannot resolve the host name with the first request. The search option specifies a trial list of domain names. List items are separated by spaces or tabs.

If the search option is not given, a search list is created by using the domain name itself from the local domain name and from the parent domain of root. The local domain name can be given using the domain statement, and if one is not given, the parser is obtained by the system call Getdomainname (2).

3.2 Other three types of configuration are used for domain name server

Pure cache Server

The pure caching server runs the domain name Server software, but does not have a domain name server database file, it records each data obtained from the remote domain name server to answer the future query for the same information.

Three basic profiles required for a pure caching server:

/etc/named.conf

/var/named/named.ca

/var/named/named.local

Create or modify/etc/named.conf:

Generated by named-bootconf.pl

Options {

Directory "/var/named";

/*

* If There is a firewall between for you and nameservers for you want

* To talk to, your might need to uncomment the Query-source

* directive below. Previous versions of BIND always asked

* Questions using port, but BIND 8.1 uses an unprivileged

* Port by default.

*/

Query-source address * port 53;

forwarders {172.16.0.1;172.16.0.11;};

};

//

A caching only nameserver config

//

Zone "." {

Type hint;

File "named.ca";

};

Zone "0.0.127.in-addr.arpa" {

Type master;

File "Named.local";

};

In the file "forwarders {172.16.0.1;172.16.0.11;};" The IP address is the IP address of the primary and secondary servers in your network.

Create or modify/var/named/named.local

@ in SOA localhost. Root.localhost. (

1997022700; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

In NS localhost.

1 in PTR localhost.

Create or modify/var/named/named.ca:

As for/var/named/named.ca, it's going to be from the Redhat Linux CD. Also obtained by command from the Internet:

Dig @.aroot-servers.net.ns >/var/named/named.ca

If the RPM package is installed, these three files will be automatically generated, we only need to modify the/etc/named.conf. Where/var/named.ca is generally not modified.

Primary server

The primary server is the authoritative source for all information for a given domain. The domain information it loads from is a disk file created by a domain administrator and maintained locally.

We use "test.com" as an example, and we need five basic configuration files:

/etc/named.conf

/var/named/named.ca

/var/named/named.local

/var/named/named.test.com

/var/named/named.172.16.0

Create or modify/etc/named.conf:

Generated by named-bootconf.pl

Options {

Directory "/var/named";

/*

* If There is a firewall between for you and nameservers for you want

* To talk to, your might need to uncomment the Query-source

* directive below. Previous versions of BIND always asked

* Questions using port, but BIND 8.1 uses an unprivileged

* Port by default.

*/

Query-source address * port 53;

};

//

A PM nameserver config

//

Zone "." {

Type hint;

File "named.ca";

};

Zone "0.0.127.in-addr.arpa" {

Type master;

File "Named.local";

};

There are our primary zone files

Zone "test.com" {

Type master;

File "named.test.com";

};

Zone "0.16.172.in-addr.arpa" {

Type master;

File "named.172.16.0";

};

The zone "test.com" section in the file is a declaration that this is the primary server for the test.com domain, and that the data for that domain is loaded from the/var/named/named.test.com file.

The zone "0.16.172.in-addr.arpa" section in the file refers to a file that maps the IP address 172.16.0.* to the host name. Data for this domain is loaded from the/var/named/named.172.16.0 file.

Create or modify/var/named/named.local

@ in SOA ns.test.com. Root.ns.test.com. (

2000051500; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

In NS ns.test.com.

1 in PTR localhost.

Note: When you modify the named.* file, be careful to increase the serial value each time you save it. If you use absolute domain name, don't forget to take the "."

The @ character in the resource record is converted to the current domain test.com,in indicates that the resource record uses the TCP/IP address, and the SOA represents the jurisdiction start record. ns.test.com. is the standard name of the primary DNS server for this domain, followed by the email address of the contact, where the @ character must be "." Replace.

Create or modify/var/named/named.test.com

@ in SOA ns.test.com. Root.ns.test.com. (

2000051500; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

In NS ns.test.com.

NS A 172.16.0.1

NS2 A 172.16.0.11

www A 172.16.0.2

FTP CNAME www.test.com.

Mail A 172.16.0.3

MX Ten mail.test.com.

Create or modify/var/named/named.172.16.0

@ in SOA ns.test.com. Root.ns.test.com. (

2000051500; Serial

28800; Refresh

14400; Retry

3600000; Expi

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.