全部博文(356)
分类: 服务器与存储
2020-03-19 17:58:40
原文地址:搭建dns服务器成功解析定制的域名 作者:阳光天空201307
//下面黄色部分来源于/usr/local/bind9.9.2/etc/rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "mmADqER3LVd/Fd+N6Q/mBA==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
//下面蓝色部分未后面所有文件的大目录
directory "/usr/local/bind9.9.2/var/named";
dump-file "data/cache_dump.db";
statistics-file "data/named_stats.txt";
memstatistics-file "data/named_mem_stats.txt";
#allow-query {any;};
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
};
logging {
channel default_debug {
file "data/named.run"; //此文件会自动生成 ,但是还需要在启动named前在/usr/local/bind9.9.2/var/named目录下创建data目录
severity dynamic;
};
};
//下面绿色部分所在目录为/usr/local/bind9.9.2/var/named/named.ca
zone "." IN {
type hint;
file "named.ca";
};
//下面紫色部分为自己定制的域名信息,域名为my.test.com,域名文件的配置为named.my.test.com,此文件在/usr/local/bind9.9.2/var/named下
zone "my.test.com" IN{
type master;
file "named.my.test.com";
allow-update{none;};
};
====================
3. 创建域名配置文件/usr/local/bind9.9.2/var/named/named.my.test.com,内容为:
$TTL 86400
@ IN SOA ns1.test.com. webmaster.ewcache.com.(
1997022700 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ) ; minimun
@ IN NS ns1.test.com.
ns1 A 192.168.x.x //需要设置
my.test.com. A 192.168.x.x //指定my.test.com的域名通过咱们刚才设置的dns服务器解析,解析结果为ip:192.168.x.x