Install and configure the DNS server in Linux

Source: Internet
Author: User
System: RedHat6 1. install necessary software: 2. Global configuration file :(/etc/named. conf) [root@www.linuxidc.cometc] # vinamed. confoptions {listen-onport53 {210. *. 241.115 ;}; & n

System: RedHat6

1. install necessary software:

Ii. Global configuration file: (/etc/named. conf)
[Root @ www.linuxidc.com etc] # vi named. conf

Options {
Listen-on port 53 {210. *. 241.115 ;};
Directory "/var/named ";
Dump-file "/var/named/data/cache_dump.db ";
Statistics-file "/var/named/data/named_stats.txt ";
Memstatistics-file "/var/named/data/named_mem_stats.txt ";
Allow-query {any ;}; // allow all users to query
// Match-clients {any ;}; // allow any client
// Match-destinations {any ;}; // allow any target
Recursion yes;

Dnssec-enable yes;
Dnssec-validation yes;
Dnssec-lookaside auto;

/* Path to isc dlv key */
Bindkeys-file "/etc/named. iscdlv. key ";
};

Logging {
Channel default_debug {
File "data/named. run ";
Severity dynamic;
};
};
View example_resolver {
Match-clients {any ;}; // specify the source IP address range for submitting the DNS Client
Match-destinations {any ;}; // specify the target IP address range for submitting the DNS Client
Recursion yes; // specifies whether recursive queries are allowed only
Include "/etc/named. zones"; // specifies the master configuration file

};


3. Master configuration file (/etc/named. zones)

[Root @ www.linuxidc.com etc] # vi named. zones

// Named. rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// Isc bind named zone configuration for zones recommended
// RFC 1912 section 4.1: localhost TLDs and address zones
// And http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (C) 2007 r w Franks
//
// See/usr/share/doc/bind */sample/

Zone "example.com" IN {// specifies a forward query Area
Type master; // specify the region type as the main region
File "example.com. zero"; // the configuration file name of the specified region is "example.com. zero". The path is the "directory" Path of the global configuration file by default.
Allow-update {none ;};
};

Zone "241. *. 210. in-addr.arpa" IN {// specifies a reverse query Area
Type master; // specify the region type as the main region
File "241. *. 210. local"; // The name of the configuration file in the specified region is "241.38.210.local". The path defaults to "directory" of the global configuration file"
Allow-update {none ;};
};

Iv. region configuration file: (under/var/named)

Forward: example.com. zero

[Root @ www.linuxidc.com named] # vi example.com. zero
; Specify the default TTL value
$ TTL 1D
; Region Name Record type SOA Primary Domain Name Server (FQDN) Administrator email address (@ replaced)
@ In soa example.com. root.example.com .(
1; serial number
1D; refresh Interval
1 H; retry Interval
1 W; expire expiration Interval
3 H); minimum TTL

; # (1) NS record: Region name IN NS FQDN
In ns example.com.
; # (2) A record: fqdn in a ip Address
In aaaa: 1
In a 210. *. 241.115
Www in a 210. *. 241.115
Mail in a 210. *. 241.115

The above Configuration Analysis:
; As a comment
@ Indicates the current domain


Reverse: 241. *. 210. local

[Root @ www.linuxidc.com named] # vi 241. *. 210. local

$ TTL 1D
@ In soa localhost. root. localhost .(
1997022700; serial
1D; refresh
1 H; retry
1 W; expire

3 H); minimum
; # (1) NS record: Region name IN NS FQDN
In ns localhost.
; # (2) PTR Resource Record: IP address IN PTR FQDN
115 in ptr www.example.com.
1 in ptr mail.example.com.


5. Start the service
Service named restart


Vi. test:
[Root @ www.linuxidc.com email] # nslookup
> Server 210. *. 241.115
Default server: 210. *. 241.115
Address: 210. *. 241.115 #53
> Www.example.com
Server: 210. *. 241.115
Address: 210. *. 241.115 #53

Name: www.example.com
Address: 210. *. 241.115
> 210. *. 241.115
Server: 210. *. 241.115
Address: 210. *. 241.115 #53

115. 241. *. 210. in-addr.arpa name = www.example.com.
> 210. *. 241.1
Server: 210. *. 241.115
Address: 210. *. 241.115 #53

1. 241. *. 210. in-addr.arpa name = mail.example.com.
> Mail.example.com
Server: 210. *. 241.115
Address: 210. *. 241.115 #53

Name: mail.example.com
Address: 210. *. 241.115
>

OK

If there are any errors in the above process, please correct me.

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.