145 字
1 分钟
Setting Up a DNS Server on RPi
  • Install
  • Configure dnscrypt-proxy
  • Change the router’s default DNS to the RPi
  • Auto-restart on configuration failure

Install

sudo apt-get install dnscrypt-proxy
sudo apt-get install dnsutils #Contains commands like dig; better to install it

Configure dnscrypt-proxy

sudo nano /etc/dnscrypt-proxy/dnscrypt-proxy.toml
listen_addresses = ['127.0.0.1:53', '192.168.0.150:53'] #Change according to your own IP
server_names = ['cloudflare','cloudflare-ipv6']
dnscrypt-proxy -resolve cloudflare-dns.com

Try whether it works; if it does, proceed to install the service.

Very important, otherwise binding the port will fail when starting the service

sudo nano /lib/systemd/system/dnscrypt-proxy.service #Modify the dnscrypt-proxy service settings
#User=_dnscrypt-proxy #Comment out this line from the source file
User=root #Add this new line to run it as root (doesn't seem very safe... haha, whatever)

Start the service and try it!

sudo systemctl enable dnscrypt-proxy
sudo systemctl start dnscrypt-proxy
sudo systemctl status dnscrypt-proxy

Change the router’s default DNS to the RPi

Skip skip skip!!!

Google it yourself; only one thing to note: the place to change is the DHCP one, NOT the WAN port DNS!!!

References#

cloudflare DNScrypt-proxy

Setting Up a DNS Server on RPi
https://tski.uk/blog/en/rpi-make-dns/
作者
Tokisaki Galaxy
发布于
2019-12-26
许可协议
CC BY