Accelerate Local Domain Resolution with SmartDNS

This page is also available in: 中文

Unlike dnsmasq's "simple resolution and caching of DNS records," SmartDNS is a local DNS server that can retrieve DNS query results from multiple upstream DNS servers and return the fastest result to the client, thereby improving network access speed. It supports DOT (DNS over TLS) and DOH (DNS over HTTPS) for better privacy protection.

First, create a configuration file /etc/smartdns/smartdns.conf and add the following configuration:

# Listen on port 53
bind [::]:53
# Configure upstream servers
server 8.8.8.8
server 114.114.114.114
server 202.96.128.166:53
server-tls 1.1.1.1

Taking deployment with Docker on a local server as an example, the Docker Compose configuration file is as follows:

services:
  smartdns:
    image: pymumu/smartdns:latest
    container_name: smartdns
    restart: always
    ports:
      - "53:53/udp"
    volumes:
      - /etc/smartdns:/etc/smartdns

Deploy the container:

sudo docker compose up -d

Pay special attention to the usage of port 53. For Linux systems, the systemd-resolved service may occupy port 53. You can refer to the solution provided in "Deploy a dnsmasq in LAN with Docker to Accelerate Network Access".

Once the SmartDNS container is successfully started, you can set the DNS in the router to the internal server address, and all subsequent network access will be optimized by SmartDNS.

The following websites list commonly used public DNS servers in China and abroad.

This article was published on 2024-08-17 and last updated on 2024-09-23.

This article is copyrighted by torchtree.com and unauthorized reproduction is prohibited.