共计 3550 个字符,预计需要花费 9 分钟才能阅读完成。
CentOS 6.5 下配置 DNS 过程
安装 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–r–r– 2 root root 4171112 Aug 28 2013 bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-r–r–r– 2 root root 72520 Aug 28 2013 bind-chroot-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-r–r–r– 2 root root 70696 Nov 25 2013 bind-dyndb-ldap-2.3-5.el6.x86_64.rpm
-r–r–r– 2 root root 910676 Aug 28 2013 bind-libs-9.8.2-0.17.rc1.el6_4.6.i686.rpm
-r–r–r– 2 root root 899540 Aug 28 2013 bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
-r–r–r– 2 root 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
• 配置 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/named.ca”;
file “/dev/null”;
};
include “/etc/named.rfc1912.zones”;
};
• 配置 zone:named.rfc1912.zones,包括正向解析和反向解析
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// 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;};
};
正向解析文件:
# cat oracle.test.zone
$TTL 86400
@ IN SOA ns.oracle.test. root.oracle.test. (
42 ; serial
3H ; refresh
15M ; retry
1W ; 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
反向解析文件:
# 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.
配置完控制文件后还要记得生成 rndc-key,这里就不再赘述了。
都完成后便可以重启 named 服务并检查配置了:
# 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 配置指南 http://www.linuxidc.com/Linux/2015-08/122364.htm
使用 BIND 配置 DNS 服务器 — 初级篇 http://www.linuxidc.com/Linux/2013-05/84920.htm
BIND+DLZ+MySQL 智能 DNS 的正向解析和反向解析实现方法 http://www.linuxidc.com/Linux/2013-04/82527.htm
域名服务 BIND 构建与应用配置 http://www.linuxidc.com/Linux/2013-04/82111.htm
Ubuntu BIND9 泛域名解析配置 http://www.linuxidc.com/Linux/2013-03/81928.htm
CentOS 5.2 下安装 BIND9.6 http://www.linuxidc.com/Linux/2013-02/79889.htm
CentOS 6.4 安装 Bind DNS 服务器 http://www.linuxidc.com/Linux/2015-06/119371.htm
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2015-12/125861.htm