环境信息

system:CentOS7
ipaddr:10.86.29.230
netmask:255.255.255.192
gateway:10.86.29.254

操作

下载unbound

yum install -y unbound*

启动服务并设置开机自启

systemctl restart unbound
systemctl enable unbound

编辑配置文件

vim /etc/unbound/unbound.conf
------------------------------
...
#interface:0.0.0.0
...
#access-control:0.0.0.0/0 refuse 
...
------------------------------

#改成:
------------------------------
...
interface:0.0.0.0
...
access-control:0.0.0.0/0 allow
...
------------------------------

vim /etc/resolv.conf
------------------------------
nameserver 10.86.29.230
------------------------------

创建并编写配置文件

vim /etc/unbound/local.d/xdns.conf

------------------------------
local-zone: "vincentcassano.com." static
local-data: "www.vincentcassano.com. IN A 10.86.29.230"
local-data-ptr: "10.86.29.230 www.vincentcassano.com."
------------------------------

重启服务并测试

systemctl restart unbound
ping www.vincentcassano.com

windows中测试

在网卡设置中添加DNS服务器地址

win + R 打开cmd输入nslookup www.vincentcassano.com 看有没有显示DNS服务器IP地址