Skip to content

Commit 6f8242c

Browse files
committed
✨ 使用多个dns服务器以提高可用性
1 parent e9686ee commit 6f8242c

File tree

4 files changed

+63
-14
lines changed

4 files changed

+63
-14
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dig @127.0.0.1 edns-client-sub.net TXT +short
1717

1818
### other
1919
更新:增加docker-compose,支持使用nginx部署doh和dot
20+
todo:由于国内tls查询会有概率被阻断,等待overture正式版支持https查询后,上游dns改为https。
2021

2122
#### 配置文件
2223
config: overture 配置文件,用于分流查询dns

config/config.json

+55-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"BindAddress": ":8053",
2+
"BindAddress": "0.0.0.0:5353",
33
"PrimaryDNS": [
44
{
5-
"Name": "shannxi china mobile",
6-
"Address": "114.114.114.114:53",
5+
"Name": "alidns",
6+
"Address": "223.5.5.5:53",
77
"Protocol": "udp",
88
"SOCKS5Address": "",
99
"Timeout": 6,
@@ -12,6 +12,30 @@
1212
"ExternalIP": "111.18.102.19",
1313
"NoCookie": false
1414
}
15+
},
16+
{
17+
"Name": "alidns2",
18+
"Address": "223.6.6.6:53",
19+
"Protocol": "udp",
20+
"SOCKS5Address": "",
21+
"Timeout": 6,
22+
"EDNSClientSubnet": {
23+
"Policy": "manual",
24+
"ExternalIP": "111.18.102.19",
25+
"NoCookie": false
26+
}
27+
},
28+
{
29+
"Name": "tecent",
30+
"Address": "119.29.29.29:53",
31+
"Protocol": "udp",
32+
"SOCKS5Address": "",
33+
"Timeout": 6,
34+
"EDNSClientSubnet": {
35+
"Policy": "manual",
36+
"ExternalIP": "111.18.102.19",
37+
"NoCookie": false
38+
}
1539
}
1640
],
1741
"AlternativeDNS": [
@@ -20,15 +44,39 @@
2044
"Address": "one.one.one.one:[email protected]",
2145
"Protocol": "tcp-tls",
2246
"SOCKS5Address": "",
23-
"Timeout": 6,
47+
"Timeout": 10,
48+
"EDNSClientSubnet": {
49+
"Policy": "manual",
50+
"ExternalIP": "111.18.102.19",
51+
"NoCookie": false
52+
}
53+
},
54+
{
55+
"Name": "cloudflare+tcp",
56+
"Address": "1.1.1.1:53",
57+
"Protocol": "tcp",
58+
"SOCKS5Address": "",
59+
"Timeout": 10,
60+
"EDNSClientSubnet": {
61+
"Policy": "manual",
62+
"ExternalIP": "111.18.102.19",
63+
"NoCookie": false
64+
}
65+
},
66+
{
67+
"Name": "opendns",
68+
"Address": "208.67.222.222:5353",
69+
"Protocol": "tcp",
70+
"SOCKS5Address": "",
71+
"Timeout": 10,
2472
"EDNSClientSubnet": {
2573
"Policy": "manual",
2674
"ExternalIP": "111.18.102.19",
2775
"NoCookie": false
2876
}
2977
}
3078
],
31-
"OnlyPrimaryDNS": true,
79+
"OnlyPrimaryDNS": false,
3280
"IPv6UseAlternativeDNS": false,
3381
"IPNetworkFile": {
3482
"Primary": "/overture/ip_network_primary_sample",
@@ -39,7 +87,7 @@
3987
"Alternative": "/overture/domain_alternative_sample"
4088
},
4189
"HostsFile": "/overture/hosts_sample",
42-
"MinimumTTL": 0,
43-
"CacheSize" : 0,
90+
"MinimumTTL": 300,
91+
"CacheSize" : 4096,
4492
"RejectQtype": [255]
4593
}

doh-server.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ path = "/dns-query"
3232
# For "tcp", only TCP will be used.
3333
# For "tcp-tls", DNS-over-TLS (RFC 7858) will be used to secure the upstream connection.
3434
upstream = [
35-
"udp:overture:8053",
35+
"udp:overture:5353",
3636
]
3737

3838
# Upstream timeout
39-
timeout = 10
39+
timeout = 60
4040

4141
# Number of tries if upstream DNS fails
42-
tries = 3
42+
tries = 10
4343

4444
# Enable logging
4545
verbose = false

nginx.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ user nginx;
22
worker_processes auto;
33

44

5-
error_log /var/log/nginx/error.log notice;
5+
#error_log /var/log/nginx/error.log notice;
66
pid /var/run/nginx.pid;
77

88
events {
@@ -15,7 +15,7 @@ stream {
1515
# DNS upstream pool.
1616
upstream dns {
1717
zone dns 64k;
18-
server overture:8053;
18+
server overture:5353;
1919
}
2020

2121
# DNS(TCP) and DNS over TLS (DoT) Server
@@ -31,11 +31,11 @@ stream {
3131

3232
http {
3333

34-
34+
access_log off;
3535
server{
3636
# Listen on standard HTTPS port, and accept HTTP2, with SSL termination
3737
listen 443 ssl http2;
38-
server_name dns.coolrc.me;
38+
server_name dns.coolrc.top;
3939
ssl_certificate /ssl/fullchain.pem;
4040
ssl_certificate_key /ssl/privkey.pem;
4141
ssl_session_cache shared:ssl_cache:10m;

0 commit comments

Comments
 (0)