Fix flowoffload and SFE disable DNS acceleration without deleting DNS forwarding errors (#6086)

This commit is contained in:
Mattraks 2020-12-23 12:31:24 +08:00 committed by GitHub
parent f0da89a98b
commit af6a5cc7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 323 additions and 318 deletions

View File

@ -20,28 +20,29 @@ pdnsd_genconfig() {
chown -R nobody.nogroup /var/dnscache
fi
cat > /var/etc/dnscache.conf <<EOF
cat <<-EOF >/var/etc/dnscache.conf
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 = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
run_as="nobody";
server_ip = 0.0.0.0; # 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,
@ -104,9 +105,9 @@ server {
}
server {
label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
label = "special"; # 这个随便写
ip = 208.67.222.222,208.67.220.220; # 这里为备用DNS服务器的 ip 地址
port = 5353; # 推荐使用53以外的端口DNS服务器必须支持
proxy_only = on;
timeout = 5;
}
@ -127,7 +128,7 @@ rr {
EOF
[ -d /var/sbin ] || mkdir -p /var/sbin
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache
[ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
echo "Start DNS Cache"
}
@ -162,6 +163,8 @@ start_service(){
procd_set_param stderr 1
procd_close_instance
change_dns
else
revert_dns
fi
if [ $bbr -eq 1 ]; then
sysctl -w net.ipv4.tcp_congestion_control=bbr
@ -196,4 +199,3 @@ restart(){
/etc/init.d/dnsmasq restart && echo "DNSMASQ restart"
/etc/init.d/firewall restart >/dev/null 2>&1
}

View File

@ -20,11 +20,12 @@ pdnsd_genconfig() {
chown -R nobody.nogroup /var/dnscache
fi
cat > /var/etc/dnscache.conf <<EOF
cat <<-EOF >/var/etc/dnscache.conf
global {
perm_cache=1024; # dns缓存大小单位KB建议不要写的太大
cache_dir="/var/dnscache"; # 缓存文件的位置
pid_file = /var/run/dnscache.pid;
pid_file="/var/run/dnscache.pid";
run_as="nobody";
server_ip = 0.0.0.0; # pdnsd监听的网卡0.0.0.0是全部网卡
server_port=5333; # pdnsd监听的端口不要和别的服务冲突即可
status_ctl = on;
@ -127,7 +128,7 @@ rr {
EOF
[ -d /var/sbin ] || mkdir -p /var/sbin
[ -f /var/sbin/dnscache ] || cp -a /usr/sbin/pdnsd /var/sbin/dnscache
[ -f /var/sbin/dnscache ] || ln -s /usr/sbin/pdnsd /var/sbin/dnscache
}
change_dns() {
@ -177,6 +178,8 @@ start_service() {
procd_set_param stderr 1
procd_close_instance
change_dns
else
revert_dns
fi
if [ $bbr -eq 1 ]; then