简介
SmartDNS是一个运行在本地的DNS服务器,SmartDNS接受本地客户端的DNS查询请求,从多个上游DNS服务器获取DNS查询结果,并将访问速度最快的结果返回给客户端,提高网络访问速度。 同时支持指定特定域名IP地址,并高性匹配,达到过滤广告的效果。
与dnsmasq的all-servers不同,smartdns返回的是访问速度最快的解析结果。 (详细差异请看FAQ)
支持树莓派,openwrt,华硕路由器,windows等设备。
具体方法
因为作者用的是Arch系统, 直接用如下命令安装
yay -S smartdns
其他系统可以参考官方文档
或者直接使用docker
docker pull ghostry/smartdns
docker container stop gsmartdns
docker container rm gsmartdns
docker run -d -p 53:53/udp --restart=always --name gsmartdns ghostry/smartdns
查看一下53号端口是否已经被占用,比如说dnsmasq,如果有就先kill掉相关进程
sudo lsof -i:53
配置文件
sudo vim /etc/smartdns/smartdns.conf
# dns server name, defaut is host name
# server-name,
# example:
# server-name smartdns
#
# Include another configuration options
# conf-file [file]
# conf-file blacklist-ip.conf
# dns server bind ip and port, default dns server port is 53, support binding multi ip and port
# bind udp server
# bind [IP]:[port] [-group [group]] [-no-rule-addr] [-no-rule-nameserver] [-no-rule-ipset] [-no-speed-check] [-no-cache] [-no-rule-soa] [-no-dualstack-selection]
# bind tcp server
# bind-tcp [IP]:[port] [-group [group]] [-no-rule-addr] [-no-rule-nameserver] [-no-rule-ipset] [-no-speed-check] [-no-cache] [-no-rule-soa] [-no-dualstack-selection]
# option:
# -group: set domain request to use the appropriate s