Overture自建DNS

天锦 发表于 女票的新建与保养 分类,标签:

下载Overture

wget https://github.com/shawn1m/overture/releases/download/v1.5/overture-linux-amd64.zip

安装Overture

unzip -d /usr/local/overture overture-linux-amd64.zip

创建IP/域名的名单

cd /usr/local/overture
wget https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt
curl https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt | base64 -d | sort -u | sed '/^$\|@@/d'| sed 's#!.\+##; s#|##g; s#@##g; s#http:\/\/##; s#https:\/\/##;' | sed '/\*/d; /apple\.com/d; /sina\.cn/d; /sina\.com\.cn/d; /baidu\.com/d; /qq\.com/d' | sed '/^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$/d' | grep '^[0-9a-zA-Z\.-]\+$' | grep '\.' | sed 's#^\.\+##' | sort -u > /tmp/temp_gfwlist.txt
curl https://raw.githubusercontent.com/hq450/fancyss/master/rules/gfwlist.conf | sed 's/ipset=\/\.//g; s/\/gfwlist//g; /^server/d' > /tmp/temp_koolshare.txt
cat /tmp/temp_gfwlist.txt /tmp/temp_koolshare.txt | sort -u > gfw_all_domain.txt

创建配置文件

mv config.json /usr/local/overture/config.json.bak
vi config.json

并输入以下内容:

{
 "BindAddress": ":53",
 "DebugHTTPAddress": "127.0.0.1:5555",
 "PrimaryDNS": [
   {
     "Name": "DNSPod",
     "Address": "119.29.29.29:53",
     "Protocol": "udp",
     "SOCKS5Address": "",
     "Timeout": 6,
     "EDNSClientSubnet": {
       "Policy": "auto",
       "ExternalIP": "",
       "NoCookie": true
     }
   }
 ],
 "AlternativeDNS": [
   {
     "Name": "OpenDNS",
     "Address": "208.67.222.222:443",
     "Protocol": "tcp",
     "SOCKS5Address": "",
     "Timeout": 6,
     "EDNSClientSubnet": {
       "Policy": "disable",
       "ExternalIP": "",
       "NoCookie": true
     }
   }
 ],
 "OnlyPrimaryDNS": false,
 "IPv6UseAlternativeDNS": false,
 "WhenPrimaryDNSAnswerNoneUse": "PrimaryDNS",
 "IPNetworkFile": {
   "Primary": "/usr/local/overture/china_ip_list.txt",
   "Alternative": "/usr/local/overture/ip_network_alternative_sample"
 },
 "DomainFile": {
   "Primary": "/usr/local/overture/domain_primary_sample",
   "Alternative": "/usr/local/overture/gfw_all_domain.txt"
 },
 "HostsFile": "/usr/local/overture/hosts_sample",
 "MinimumTTL": 0,
 "DomainTTLFile" : "/usr/local/overture/domain_ttl_sample",
 "CacheSize" : 0,
 "RejectQType": [255]
}

开启防火墙端口

firewall-cmd --permanent --add-port=53/udp
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --reload

配置开机启动 vi /etc/systemd/system/overture.service 并输入内容如下:

[Unit]
Description=overture
After=network.target
[Service]
ExecStart=/usr/local/overture/overture-linux-amd64 -c /usr/local/overture/config.json
Restart=on-abort
[Install]
WantedBy=multi-user.target

启动 overture 服务

systemctl enable overture
systemctl start overture


0 篇评论

发表我的评论