利用dnsmasq自建dns缓存服务器
1. 安装dnsmasq
apt install dnsmasq2. 删除 systemd-resolved
apt remove systemd-resolved3. 配置dnsmasq
#开启外网服务,不然只能给内网使用,这两个要同时开启才有效,不知道为什么
listen-address=0.0.0.0
bind-interfaces
#不提供dhcp服务
no-dhcp-interface=
#不读取/etc/resolv.conf的配置
no-resolv
#自定义上游dns服务器地址
server=223.5.5.5
server=223.6.6.6
#可自定义某个域名的解析服务器
server=/domain/x.x.x.x4. 启动dnsmasq
systemctl start dnsmasq5. 测试
dig @127.0.0.1 baidu.com