Installing nscrypt-proxy is a commonly used method. The specific installation steps are as follows (using a Mac computer as an example):
# Installation
brew install dnscrypt-proxy
# Change configuration and set log path
vim /opt/homebrew/etc/dnscrypt-proxy.toml
# Find the following four items and change them to
listen_addresses = ['[::]:53']
log_level = 0
log_file = '/usr/local/log/dnscrypt-proxy.log'
ignore_system_dns = true
# Add or remove according to your needs
server_names = ['google', 'google-ipv6']
# Start
sudo brew services run dnscrypt-proxy
Find your computer's network and change the DNS settings to 127.0.0.1
because this setting will encrypt DNS requests when accessing DNS.