关于DNS的部署,今早刚完成,简单做下笔录,与君共勉。
系统:centos 6.4 32位 IP:192.168.1.12
1、查看并安装bind
[root@ph7 ~]#yum install bind
2、确认包
[root@ph7 ~]# rpm -qa |grep bind
rpcbind-0.2.0-11.el6.i686
bind-libs-9.8.2-0.23.rc1.el6_5.1.i686
samba-winbind-clients-3.6.9-164.el6.i686
PackageKit-device-rebind-0.5.8-21.el6.i686
bind-utils-9.8.2-0.23.rc1.el6_5.1.i686
bind-chroot-9.8.2-0.23.rc1.el6_5.1.i686
samba-winbind-3.6.9-164.el6.i686
ypbind-1.20.4-30.el6.i686
bind-9.8.2-0.23.rc1.el6_5.1.i686
3、更改配置文件
涉及到的配置文件有三个:/etc/named.conf是主配置文件,需要在这里增加相应的zone;另外两个是位于/var/named下面的正向解析和反向解析文件,这两个文件的需要新建而且文件名必须和主配置文件里定义的一样才行
以下是我的配置文件,主机名是ph7.com
[root@ph7 ~]# less /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { any; };//这里将127.0.0.1改为any.监听所有.
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; };//此处修改为any
recursion yes;
allow-transfer {none;};
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "ph7.com" IN { //此处设置正向解析zone
type master;
file "named.ph7.com";//正向解析文件名
};
zone "1.168.192.in-addr.arpa" IN { //此处设置反向解析zone
type master;
file "named.192.168.1"; //反向解析文件名
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
[root@ph7 ~]# less /var/named/named.ph7.com //正向解析文件
$TTL 1D
@ IN SOA dns.ph7.com. root(
20140321; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS dns.ph7.com.
@ IN MX 5 mail.ph7.com.
dns IN A 192.168.1.12
@ IN A 192.168.1.12
mail IN A 192.168.1.12
www IN A 192.168.1.12
[root@ph7 ~]# less /var/named/named.192.168.1 //反向解析文件
$TTL 1D
@ IN SOA dns.ph7.com. root(
20140321; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS dns.ph7.com.
12 IN PTR dns.ph7.com.
12 IN PTR mail.ph7.com.
12 IN PTR www.ph7.com.
4、启动服务
[root@ph7 ~]#/etc/init.d/named start
关于各个参数的意思及主从dns,caching-only等模式就不详细叙述了,有机会自己研究