DNS CentOS 6

环境:

IP: static - 192.168.0.235

DNS: /etc/resolv.conf

nameserver 192.168.0.235

1、bind dns

yum -y install bind bind-libs bind-utils

2、bind service

chkconfig named on

3、start bind service

service named start

注意:

1、创建key

rndc-confgen -r /dev/urandom -a

2、更改权限

chown root:named /etc/rndc.key

chmod 644 /etc/rndc.key

3、重启named服务

service named restart

rndc status

rndc reload

4、named.conf

/etc/named.conf

include "/etc/rndc.key";
options {
listen-on port 53 { 192.168.0.235; };
listen-on-v6 port 53 { ::1; };
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; };
recursion yes;

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;

bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";

rrset-order {

class IN type A name "*.slave.mysql" order cyclic;

};

};

logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};

zone "." IN {
type hint;
file "named.ca";
};

zone "mysql.com" IN {
type master;
file "mysql.com.zone";
};

zone "0.168.192.in-addr.arpa" IN {
type master;
file "mysql.com.reverse";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

5、zone

/var/named/mysql.com.zone

$ORIGIN mysql.com.

$TTL 3D
@ IN SOA dns.mysql.com. root.mysql.com. (0 1D 1h 1w 3h)
@ IN NS dns.mysql.com.
dns.mysql.com. IN A 192.168.0.235
slave IN A 192.168.0.235

/var/named/mysql.com.reverse

$ORIGIN 0.168.192.in-addr.arpa.
$TTL 3D
@ IN SOA dns.mysql.com. root.mysql.com. (0 1D 1h 1w 3h)
@ IN NS dns.mysql.com.
235 IN PTR dns.mysql.com.
235 IN PTR slave.mysql.com.

6、restart bind service

service named restart

7、dns

/etc/resolve.conf

nameserver 192.168.0.235

8、test dns server

nslookup dns.mysql.com

nslookup 192.168.0.235

9、security

yum install bind-chroot

service named restart

你可能感兴趣的:(centos,dns)