当前位置:   article > 正文

使用dnscrypt-proxy搭建dns代理服务器(doh)

dnscrypt-proxy

使用dnscrypt-proxy搭建dns代理服务器(doh)

系统环境
centos7.9
# 更改yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all

# 把dnscrypt-proxy源码包上传到服务器
tar zxf dnscrypt-proxy-linux_x86_64-2.1.1.tar.gz 
cd linux-x86_64/
cp example-dnscrypt-proxy.toml dnscrypt-proxy.toml 
vi dnscrypt-proxy.toml

# 修改监听地址、服务器名称'dnspod-doh','alidns-doh'分别是腾讯和阿里的doh
listen_addresses = [0.0.0.0:53]
server_names = ['dnspod-doh','alidns-doh']

# 安装、启动dnscrypt-proxy服务
./dnscrypt-proxy -service install
./dnscrypt-proxy -service start

# 查看状态及开启自启
systemctl status dnscrypt-proxy
systemctl enable dnscrypt-proxy

# 查看dns服务是否正常
yum install bind-utils -y
nslookup www.baidu.com

./dnscrypt-proxy -resolve github.com

# 防火墙设置
firewall-cmd --zone=public --add-port=53/tcp --permanent 
firewall-cmd --zone=public --add-port=53/udp --permanent 
firewall-cmd --reload
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
# 自定义资源设置 https://dnscrypt.info/stamps/
# 修改 dnscrypt-proxy.toml文件,添加360-doh

server_names = ['dnspod-doh','alidns-doh','360-doh']

[static]

  # [static.myserver]
  #   stamp = 'sdns://AQcAAAAAAAAAAAAQMi5kbnNjcnlwdC1jZXJ0Lg'
  # https://dnscrypt.info/stamps/
  [static.360-doh]
  stamp = 'sdns://AgAAAAAAAAAADDExMi42NS42OS4xNQAKZG9oLjM2MC5jbgovZG5zLXF1ZXJ5'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
企业内使用按需修改,如果有域控服务器,可以把转发器设置到代理服务器
max_clients = 250


###########################
#        DNS cache        #
###########################

## Enable a DNS cache to reduce latency and outgoing traffic

cache = true


## Cache size

cache_size = 4096


## Minimum TTL for cached entries

cache_min_ttl = 2400


## Maximum TTL for cached entries

cache_max_ttl = 86400


## Minimum TTL for negatively cached entries

cache_neg_min_ttl = 60


## Maximum TTL for negatively cached entries

cache_neg_max_ttl = 600


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/740241
推荐阅读
相关标签
  

闽ICP备14008679号