yum -y install bind-utils bind bind-devel bind-libs
配置文件
vim /etc/named.conf
···
options {
listen-on port 53 { any; };
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";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
pid-file "/run/named/named.pid";
session-keyfile "/run/named/session.key";
forwarders { 114.114.114.114; };#dns转发
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
···
追加域名解析入口配置
vim /etc/named.rfc1912.zones
新增
···
zone "a.com" IN { # 测试用的域是 a.com
type master;
file "a.com.zone"; # 配置文件为 a.com.zone,该文件目录为 /var/named/ 下
};
···
新增解析文件
/var/named/
cp named.localhost a.com.zone
chown named.named a.com.zone
···
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
a IN A 47.111.97.147
···
systemctl start named
dig @127.0.0.1 a.com查看结果