ITPub博客

首页 > Linux操作系统 > Linux操作系统 > el5下配置DNS

el5下配置DNS

原创 Linux操作系统 作者:was_zhang 时间:2009-06-23 14:49:35 0 删除 编辑

1.打开upd53端口

2.vi /etc/hosts
127.0.0.1               ns1.518sudi.com ns1 localhost.localdomain localhost

3.vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ns1.518sudi.com
GATEWAY=192.168.1.1

4.vi /etc/resolv.conf
domain  518sudi.com
nameserver 192.168.1.90             #(内网IP)
nameserver 124.193.202.26           #(外网ip)

5.检查是否安装了bind:

# rpm -qa |grep -i bind
bind-9.3.4-10.P1.el5
kdebindings-3.5.4-6.el5
ypbind-1.19-11.el5
bind-chroot-9.3.4-10.P1.el5
bind-libs-9.3.4-10.P1.el5
bind-utils-9.3.4-10.P1.el5
# rpm -qa |grep -i caching
caching-nameserver-9.3.4-10.P1.el5

6. vi /var/named/chroot/etc/
localtim         med.caching-nameserver.conf       named.rfc1912.zones        rndc.key

通过拷贝named.rfc1912.zones 作为named.conf文件,并在此文件中添加自己的区域。
# cp named.rfc1912.zones  named.conf
# chown -R root:named named.conf
# vi named.conf
如下内容:(我设置了两个域,microtrend.cn及xinry.com)
# more named.conf
options {
directory     "/var/named";
};
controls {
        inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
        type hint;
        file "named.ca";
};
zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};
zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};
zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};
zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};
zone "518sudi.com" IN {
        type master;
        file "518sudi.com.zone";
        allow-update { none; };
};
//zone "xinry.com" IN {
//        type master;
//        file "xinry.com";
//        allow-update { none; };
//};
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "1.168.192.zone";
        allow-update { none; };
};
include "/etc/rndc.key";

7.在/var/named/chroot/var/named/下,多出了系统常见的区域数据文件。我们可以copy这些文件作为我们自定义的区域数据文件。
# cp localhost.zone  518sudi.com.zone
# cp named.local  1.168.192.zone
分别对它们进行编辑

正向解析
vi /var/named/chroot/var/named/518sudi.com.zone  (chown -R root:named ...)
$TTL    86400
@               IN SOA  518sudi.com.    root.518sudi.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           ns1.518sudi.com.
ns1             IN A            192.168.1.90
                IN AAAA         ::1

反向解析
vi /var/named/chroot/var/named/1.168.192.zone  (chown -R root:named ...)
$TTL    86400
@       IN      SOA    518sudi.com.   root.518sudi.com. (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      ns1.518sudi.com.
90      IN      PTR     ns1.518sudi.com.

8、测试:
[root@email named]# nslookup
> ns1.518sudi.com
Server:         192.168.1.90
Address:        192.168.1.90#53
Name:   ns1.518sudi.com
Address: 192.168.1.90
> 192.168.1.90
Server:         192.168.1.90
Address:        192.168.1.90#53
90.1.168.192.in-addr.arpa      name = ns1.518sudi.com.

9、故障排查:
每次修改完named.conf 或区域数据文件后,都需要重新启动named服务。
当出现任何错误时,无论是启动named还是查询不正确,都需要查看日志文件中的记录
tail  /var/log/message

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21070542/viewspace-607272/,如需转载,请注明出处,否则将追究法律责任。

下一篇: Oracle 管理实例
请登录后发表评论 登录
全部评论

注册时间:2009-06-17

  • 博文量
    20
  • 访问量
    54680