目的:国内域名通过国内的DNS服务器(119.29.29.29)查询,国外域名通过 dnscrypt-proxy 查询
系统: Alma Linux 8
步骤:
1. 安装dnscrypt-proxy
yum install -y dnscrypt-proxy
2. 配置dnscrypt-proxy
vim /etc/dnscrypt-proxy/dnscrypt-proxy.toml
修改项:
server_names = ['scaleway-fr', 'google', 'yandex', 'cloudflare']
listen_addresses = ['[::]:35353']
3. 安装dnsmasq
yum install -y dnsmasq dnsmasq-utils
4. 配置dnsmasq
vim /etc/dnsmasq.conf
修改项:
port=53
server=127.0.0.1#35353
conf-dir=/etc/dnsmasq.d
5. 安装dnsmasq-china-list
安装后清理 /etc/dnsmasq.d/,仅保留一种即可
例如,仅保留使用DNS 119.29.29.29的配置文件:
accelerated-domains.china.119.29.29.29.conf
apple.china.119.29.29.29.conf
google.china.119.29.29.29.conf
ogus-nxdomain.china.conf
附官网的安装方法:
-
- Automatic Installation (recommended)
Fetch the installer from github (or a mirror): wget https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/install.sh
(Optional) Edit it to use your favorite DNS server and/or another mirror to download the list.
Run it as root: sudo ./install.sh
You can save the installer and run it again to update the list regularly.
-
- Manual Installation
Place accelerated-domains.china.conf, bogus-nxdomain.china.conf (and optionally google.china.conf, apple.china.conf) under /etc/dnsmasq.d/ (Create the folder if it does not exist).
Uncomment "conf-dir=/etc/dnsmasq.d" in /etc/dnsmasq.conf
(Optional) Place dnsmasq-update-china-list into /usr/bin/
(Optional) Make custom DNS server configuration and/or other services' configuration.