dnsmasq的配置文件由/etc/config/dhcp决定
####禁用 dnsmasq 的 DNS 功能
在该文件 config dnsmasq下添加
option port 54
如果你的 WAN 口是 PPPOE 等方式连接,而且系统日志中有
DHCP packet received on eth0.2 which has no address
就再添加
list notinterface eth0.2
可以在网页设置的启动项管理中重启 dnsmasq
运行 netstat -anp查看是否有 dnsmasq 监听54端口
####修改后 DNS 推送可能有问题
在/etc/config/dhcp文件config dhcp 'lan'的最后添加
list 'dhcp_option' '6,XXX.XXX.XXX.XXX'XXX.XXX.XXX.XXX为路由器 ip
####配置pdnsd
pdnsd 可以通过 TCP 查询(也需要 DNS 服务器支持),获得未受劫持的结果
配置文件/etc/pdnsd.conf中有多个 server 段,上面的查询失败就使用下一个,所以一般应该按照延迟排序,在这里只用一个 server 段
global 段中修改为 query_method=tcp_only和server_ip = 路由器ip
server段如下即可
server {
label= "myisp";
ip = 8.8.8.8,8.8.4.4; # Put your ISP's DNS-server address(es) here.
timeout=4; # Server timeout; this may be much shorter
# that the global timeout option.
interval=ontimeout; # Check every 10 minutes.
purge_cache=off; # Keep stale cache entries in case the ISP's
# DNS servers go offline.
edns_query=yes; # Use EDNS for outgoing queries to allow UDP messages
# larger than 512 bytes. May cause trouble with some
# legacy systems.
}
####可能会影响国内网站 CDN 后果自负
解决 CDN 问题可以参考: