centOS6.5搭建DNS服务器


1.打开终端 
# yum install bind

2.修改/etc/named.conf配置文件(对照修改)
        listen-on port 53 { any; };
        allow-query     { any; };
        dnssec-enable no;
        dnssec-validation no;

3.修改区域配置文件/etc/named.rfc1912.zones
添加自己的要解析的域名:

zone "pinba.co" IN {
        type master;
        file "pinba.co";
};

4. 新建解析库文件 /var/named/pinba.co.zone
$TTL 1D
@ IN SOA  @ youjob.co. (
          0 ; serial
          1D  ; refresh
          1H  ; retry
          1W  ; expire
          3H )  ; minimum
        NS  @
    A 127.0.0.1
  AAAA  ::1
test IN  A       192.168.0.22
meet IN A 192.168.0.22
api IN  A 192.168.0.128


5.修改解析库文件权限(很重要)
# chgrp named /var/named/pinba.co.zone 

6.检查配置文件语法
# named-checkconf

7.检查域配置文件语法
# named-checkzone pinba.co  /var/named/pinba.co.zone

8.永久修改DNS地址 vi  /etc/resolv.conf 
加入  nameserver 192.168.1.17

9.重启服务  service named restart

10.如果在启动named 服务的时候报错需要查看日志则如下操作

# touch /var/named/chroot/var/named/named.log 
# chown named.named /var/named/chroot/var/named/named.log 
# chmod 755 /var/named/chroot/var/named/named.log 
# service named restart 

你可能感兴趣的:(Linux)