搭建DNS服务器

首先安装dnsmasq

1
sudo apt-get install dnsmasq

修改dnsmasq.conf配置文件

1
2
sudo nano -K /etc/dnsmasq.conf

设置IGNORE_RESOLVCONF

1
2
sudo nano -K /etc/default/dnsmasq
IGNORE_RESOLVCONF=yes

修改resolv.conf,添加上游DNS服务器

1
2
sudo nano -K /etc/resolv.dnsmasq.conf

开启dnsmasq服务

1
2
sudo systemctl restart dnsmasq
sudo systemctl enable dnsmasq

测试dnsmasq服务

1
2
3
4
sudo apt-get install  dnsutils

dig www.sina.cn A @127.0.0.1 grep Query

可以看到第二次请求的时间极大地缩短了


搭建DNS服务器
https://b.limour.top/541.html
Author
Limour
Posted on
February 22, 2021
Licensed under