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