DNS服务介绍:
进程名:named
启动脚本文件:/etc/rc.d/init.d/named
使用端口:53(tcp,udp)
所需RPM包:bind-9.8.2-0.10.rc1.el6.x86_64.rpm
相关RPM包:bind-libs-9.8.2-0.10.rc1.el6.x86_64.rpm
bind-utils-9.8.2-0.10.rc1.el6.x86_64.rpm
bind-chroot-9.8.2-0.10.rc1.el6.x86_64.rpm
配置文件:/etc/named.conf
相关路径:/var/named/
先看看CentOS有没有安装bind:
[root@longshu /]
bind-libs-9.8.2-0.17.rc1.el6_4.6.x86_64
rpcbind-0.2.0-11.el6.x86_64
samba-winbind-3.6.9-151.el6_4.1.x86_64
ypbind-1.20.4-30.el6.x86_64
bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64
samba-winbind-clients-3.6.9-151.el6_4.1.x86_64
|
注意:这里可以看到系统已经安装9.8.2-0.17版本bind-libs
接着在光盘找到其余的安装程序:
[root@longshu Packages]
-rw-r--r--. 1 root root 4156804 6月 25 2012 bind-9.8.2-0.10.rc1.el6.x86_64.rpm
-rw-r--r--. 1 root root 71308 6月 25 2012 bind-chroot-9.8.2-0.10.rc1.el6.x86_64.rpm
-rw-r--r--. 1 root root 64584 6月 26 2012 bind-dyndb-ldap-1.1.0-0.9.b1.el6.x86_64.rpm
-rw-r--r--. 1 root root 902632 6月 25 2012 bind-libs-9.8.2-0.10.rc1.el6.i686.rpm
-rw-r--r--. 1 root root 891512 6月 25 2012 bind-libs-9.8.2-0.10.rc1.el6.x86_64.rpm
-rw-r--r--. 1 root root 185452 6月 25 2012 bind-utils-9.8.2-0.10.rc1.el6.x86_64.rpm
-rw-r--r--. 1 root root 97580 6月 25 2012 PackageKit-device-rebind-0.5.8-20.el6.x86_64.rpm
-rw-r--r--. 1 root root 52140 6月 25 2012 rpcbind-0.2.0-9.el6.x86_64.rpm
-rw-r--r--. 1 root root 3719020 6月 25 2012 samba-winbind-3.5.10-125.el6.x86_64.rpm
-rw-r--r--. 1 root root 1116100 6月 25 2012 samba-winbind-clients-3.5.10-125.el6.i686.rpm
-rw-r--r--. 1 root root 1120308 6月 25 2012 samba-winbind-clients-3.5.10-125.el6.x86_64.rpm
-rw-r--r--. 1 root root 52772 7月 3 2011 ypbind-1.20.4-29.el6.x86_64.rpm
|
安装bind-9.8.2-0.10.rc1.el6.x86_64.rpm
[root@longshu Packages]
error: Failed dependencies:
bind-libs = 32:9.8.2-0.10.rc1.el6 is needed by bind-32:9.8.2-0.10.rc1.el6.x86_64
|
这里提示需要9.8.2-0.10.rc1.el6版本的bind-libs,
[root@longshu Packages]
Preparing...
package bind-libs-32:9.8.2-0.17.rc1.el6_4.6.x86_64 ( which is newer than bind-libs-32:9.8.2-0.10.rc1.el6.x86_64) is already installed
|
这里提示9.8.2-0.17.rc1.el6_4.6.x86_64版本的bind-libs已安装,因为我有的相关rpm包是9.8.2-0.10.rc1.el6版本的
所以,卸载bind-libs-32:9.8.2-0.17.rc1.el6_4.6.x86_64
[root@longshu /]
[root@longshu /]
[root@longshu /]
|
[root@longshu Packages]
Preparing...
1:bind-libs
|
[root@longshu Packages]
Preparing...
1:bind
|
[root@longshu Packages]
Preparing...
1:bind-chroot
|
装成功后,在检查一遍:
[root@longshu Packages]
bind-9.8.2-0.10.rc1.el6.x86_64
bind-chroot-9.8.2-0.10.rc1.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
samba-winbind-3.6.9-151.el6_4.1.x86_64
ypbind-1.20.4-30.el6.x86_64
bind-libs-9.8.2-0.10.rc1.el6.x86_64
samba-winbind-clients-3.6.9-151.el6_4.1.x86_64
|
接着我们要进行配置bind:
RHEL 6版本中,caching-nameserver已经被整合到了bind中,所以不要安装了。
基本的配置示例文件在:/etc/named.conf 和 named.rfc1912.zones中
修改以下代码:
listen-on port 53 { any; };
//listen-on-v6 port 53 { ::1; };
allow-query { any; };
|
用下面代码替换文件代码:
------------------------------------------------------------------------
// 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 "longshu.com" IN {
type master;
file "longshu.com.zone" ;
};
zone "68.1.10.in-addr.arpa" IN {
type master;
file "68.1.10.in-addr.arpa.zone" ;
};
|
------------------------------------------------------------------------
保存退出
[root@longshu /]
[root@longshu named]
|
写入内容:
------------------------------------------------------------------------
$TTL 86400
@ IN SOA longshu.com. root.longshu.com. (
2011091200 ; serial
3H ; refresh
1H ; retry
1W ; expire
0) ; minimum
@ IN NS longshu.com.
@ IN A 10.1.68.89
www IN A 10.1.68.89
|
------------------------------------------------------------------------
保存退出。
写入内容:
------------------------------------------------------------------------
$TTL 86400
@ IN SOA longshu.com. root.longshu.com. (
2011091200 ; serial
3H ; refresh
1H ; retry
1W ; expire
0) ; minimum
@ IN NS longshu.com.
89.68.1.10. in -addr.arpa. IN PTR longshu.com.
89 IN PTR www.longshu.com.
|
------------------------------------------------------------------------
保存退出。
启动DNS服务:
[root@longshu /]
启动 named: [失败]
[root@longshu named]
[root@longshu named]
[root@longshu named]
启动 named: [确定]
|
如果启动时候遇到如下提示:
[root@longshu named]
Generating /etc/rndc .key:
|
执行下面命令解决:
[root@longshu named]
wrote key
file
"/etc/rndc.key"