1. 安装环境
2. 安装配置unbound
2.1 安装unbound
yum install unbound -y
2.2 修改主配置文件
将:# interface: 0.0.0.0
改为:interface: 0.0.0.0
将:# access-control: 0.0.0.0/0 refuse
改为:access-control: 0.0.0.0/0 allow
将:username: "unbound"
改为:username: ""
将:
改为:logfile: "/var/log/unbound.log"
2.3 修改数据文件
2.3.1 修改主DNS数据文件
#在第一行添加以下内容,表示不对newcloud.top这个域进行安全检查,表明是安全域
domain-insecure:"newcloud.top."
systemctl restart unbound
2.3.2 修改从DNS数据文件
touch /etc/unbound/conf.d/newcloud.top.conf
forward-zone:
name:"."
forward-addr:"192.168.211.101"
unbound-checkconf
3. 启动unbound
systemctl start unbound
systemctl enable unbound
4. 查看缓存
unbound-control dump_cache
清除缓存:
unbound-control flush_zone .
5. 测试
cat /etc/resolv.conf
ping域名,以下域名在主DNS上已经配置:
ping -c 2 dnsserver.newcloud.top
ping -c 2 www.newcloud.top
6. 查看从DNS缓存
unbound-control dump_cache | grep newcloud.top
原创文章,作者:速盾高防cdn,如若转载,请注明出处:https://www.sudun.com/ask/14673.html