fix problems with DNS

This commit is contained in:
CN_SZTL 2019-07-13 16:40:39 +08:00
parent 7d0f73dbf1
commit aaa8dc97b4
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 18 additions and 19 deletions

View File

@ -25,7 +25,7 @@ local function is_fullcone()
end
local function is_dns()
return luci.sys.call("[ `uci get flowoffload.@flow[0].dnscache_enable 2>/dev/null -ne 3` ] && pgrep dnscache >/dev/null || pgrep AdGuardHome >/dev/null") == 0
return luci.sys.call("[ `uci get flowoffload.@flow[0].dnscache_enable 2>/dev/null` -ne 3 ] && pgrep dnscache >/dev/null || pgrep AdGuardHome >/dev/null") == 0
end
local function is_ad()

View File

@ -23,26 +23,26 @@ start_pdnsd() {
cat > /var/etc/dnscache.conf <<EOF
global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid;
server_ip = ${lan_addr}; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
server_ip = 127.0.0.1; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
status_ctl = on;
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
paranoid=on; # 二次请求模式如果请求主DNS服务器返回的是垃圾地址就向备用服务器请求
query_method=udp_only;
neg_domain_pol = off;
par_queries = 400; # 最多同时请求数
min_ttl = 1h; # DNS结果最短缓存时间
max_ttl = 1w; # DNS结果最长缓存时间
timeout = 10; # DNS请求超时时间单位秒
par_queries = 400; # 最多同时请求数
min_ttl = 1h; # DNS结果最短缓存时间
max_ttl = 1w; # DNS结果最长缓存时间
timeout = 10; # DNS请求超时时间单位秒
}
server {
label = "routine";
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
ip = $DNS_SERVER; # 这里为主要上级 dns 的 ip 地址建议填写一个当地最快的DNS地址
timeout = 5; # DNS请求超时时间
reject = 74.125.127.102, # 以下是脏IP也就是DNS污染一般会返回的结果如果收到如下DNS结果会触发二次请求TCP协议一般不会碰到脏IP
74.125.155.102,
74.125.39.102,
74.125.39.113,
@ -105,9 +105,9 @@ server {
}
server {
label = "special"; # 这个随便写
ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
label = "special"; # 这个随便写
ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on;
timeout = 5;
}
@ -138,10 +138,9 @@ start_dnsforwarder() {
IPV6DNS_SERVER=$(uci get flowoffload.@flow[0].ipv6dns_server 2>/dev/null)
dnscache_enable=$(uci get flowoffload.@flow[0].dnscache_enable 2>/dev/null)
if [ $dnscache_enable = "2" ]; then
localserver=$(echo -e "${lan_addr}:5333")
localserver=$(echo -e "127.0.0.1:5333")
elif [ $dnscache_enable = "3" ]; then
localserver=$(echo -e "${lan_addr}:5383")
localserver=$(echo -e "127.0.0.1:5383")
fi
cp -a /usr/bin/dnsforwarder /usr/sbin/dnscache