安装bind(以CentOS为例)

yum install -y bind bind-chroot bind-utils

bind 配置

修改主配置文件 /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; }; //允许访问的IP地址段,这里设置为所有
	recursion yes;
	dnssec-enable yes;
	dnssec-validation yes;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.root.key";

	managed-keys-directory "/var/named/dynamic";

	pid-file "/run/named/named.pid";
	session-keyfile "/run/named/session.key";
};

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

zone "." IN {
	type master;
	file "wangmou.zone";
};

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

编辑数据配置文件 /var/named/wangmou.zone

$TTL 1D
@	IN	SOA	@	kefu.wangmou.com. (0 3600 120 600 10 )
	IN	NS	@
	IN	A	1.2.3.4
*	IN	A	1.2.3.4

启动(重启)服务

启动named服务

systemctl start named

将服务添加到开机启动

systemctl enable named

重启服务

systemctl restart named

注:防火墙需要放行 53 端口(tcp/udp)