Configure DNS in CentOS 6.5
Configure DNS in CentOS 6.5
Install bind
# Mount-o loop/root/Downloads/CentOS-6.5-x86_64-bin-DVD1.iso/mnt/DVD
# Cd/mnt/DVD
# Cd Packages
# Ll | grep bind
-R -- 2 root 4171112 Aug 28 2013 bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-R -- 2 root 72520 Aug 28 2013 bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-R -- 2 root 70696 Nov 25 2013 bind-dyndb-ldap-2.3-5.el6.x86_64.rpm
-R -- 2 root 910676 Aug 28 2013 bind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpm
-R -- 2 root 899540 Aug 28 2013 bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-R -- 2 root 186584 Aug 28 2013 bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
# Rpm-ivh bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
# Rpm-ivh bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
• Configure named. conf
Key "rndc-key "{
Algorithm hmac-md5;
Secret "4Re7AAqoTeAWNLyZUyD1sQ = ";
};
Controls {
Inet 127.0.0.1 port 953
Allow {127.0.0.1;} keys {"rndc-key ";};
};
Options
{
// Put files that named is allowed to write in the data/directory:
Directory "/var/named"; // "Working" directory
Dump-file "data/cache_dump.db ";
Statistics-file "data/named_stats.txt ";
Memstatistics-file "data/named_mem_stats.txt ";
// Listen-on port 53 {any ;};
Listen-on port 53 {any ;};
// Listen-on-v6 port 53 {any ;};
Listen-on-v6 port 53 {: 1 ;};
Allow-query {any ;};
Allow-query-cache {any ;};
// Enable/disable recursion-recursion yes/no;
Recursion yes;
Dnssec-enable yes;
Dnssec-validation yes;
Dnssec-lookaside auto;
Bindkeys-file "/etc/named. iscdlv. key ";
Managed-keys-directory "/var/named/dynamic ";
};
Logging
{
Channel default_debug {
File "data/named. run ";
Severity dynamic;
};
};
View "localhost_resolver"
{
Match-clients {any ;};
Match-destinations {any ;};
Recursion yes;
# All views must contain the root hints zone:
Zone "." IN {
Type hint;
// File "/var/named. ca ";
File "/dev/null ";
};
Include "/etc/named. rfc1912.zones ";
};
• Configure zone: named. rfc1912.zones, including forward and reverse resolution
// 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/for example named configuration files.
//
Zone "Oracle. test" IN {
Type master;
File "oracle. test. zone ";
Allow-update {none ;};
};
Zone "17.168.192.in-addr. arpa" IN {
Type master;
File "17.168.192.zone ";
Allow-update {none ;};
};
Forward parsing file:
# Cat oracle. test. zone
$ TTL 86400
@ In soa ns. oracle. test. root. oracle. test .(
42; serial
3 H; refresh
15 M; retry
1 W; expire
1D); minimum
In ns ns. oracle. test.
Ns in a 192.168.17.240
Node1 in a 192.168.17.235
Node2 in a 192.168.17.236
Node1-vip in a 192.168.17.237
Node2-vip in a 192.168.17.238
Node-scan in a 192.168.17.239
Reverse parsing file:
# Cat 17.168.192.zone
$ TTL 86400
@ In soa ns. oracle. test. root. oracle. test .(
1997022700; serial
28800; refresh
14400; retry
3600000; expire
86400); minimum
In ns ns. oracle. test.
240 in ptr ns. oracle. test.
235 in ptr node1.oracle. test.
236 in ptr node2.oracle. test.
237 in ptr node1-vip.oracle.test.
238 in ptr node2-vip.oracle.test.
239 in ptr node-scan.oracle.test.
After configuring the control file, remember to generate the rndc-key, which will not be described here.
After the configuration is complete, you can restart the named service and check the Configuration:
# Service named restart
# Service named status
# Nslookup node1
Server: 192.168.17.240
Address: 192.168.17.240 #53
Name: node1.oracle. test
Address: 192.168.17.235
RedHat Linux DNS Configuration Guide
Use BIND to configure the DNS server
BIND + DLZ + MySQL smart DNS implementation of forward and reverse resolution
Domain Name Service BIND construction and application configuration
Ubuntu BIND9 wildcard domain name resolution Configuration
Install BIND9.6 in CentOS 5.2
Install the Bind DNS server in CentOS 6.4
This article permanently updates the link address: