曦远 (DealiAxy)一份私人的文字刊物

StarBlog
返回文章列表折页手记阅读全文
个人数据保全计划

Personal Data Preservation Plan: Installing a Local DNS

SmartDNS SmartDNS is a local DNS server that accepts DNS query requests from local clients, then obtains DNS query results from multiple upstream DNS servers, and returns the result with the fastest access speed to the client, thereby improving network access speed. SmartDNS also supports specifying IP addresses for particular domain names, with high-speed matching, which can achieve an ad-blocking effect. Unlike DNSmasq's all-servers, SmartDNS returns the access

曦远 (DealiAxy)约 8 分钟
目录5 个章节

SmartDNS

SmartDNS is a local DNS server that accepts DNS query requests from local clients, then obtains DNS query results from multiple upstream DNS servers, and returns the result with the fastest access speed to the client, thereby improving network access speed. SmartDNS also supports specifying IP addresses for particular domain names, with high-speed matching, which can achieve an ad-blocking effect.

Unlike DNSmasq's all-servers, SmartDNS returns the resolution result with the fastest access speed.

It supports Raspberry Pi, OpenWrt, ASUS router stock firmware, Windows, and more.

Project URL: https://github.com/pymumu/smartdns

Installing with Entware

It's available in the Entware package manager, so just install it directly

sudo opkg install smartdns

After installation, edit the config file at /opt/etc/smartdns/smartdns.conf

I copied the config file directly to my home directory and then created a symlink

This makes it convenient to open and edit it with an editor on my computer

mkdir /share/home/用户名/config/smartdns/
cd /opt/etc/smartdns/
cp smartdns.conf /share/home/用户名/config/smartdns/smartdns.conf
mv smartdns.conf smartdns.conf.bak
ln -s /share/home/用户名/config/smartdns/smartdns.conf smartdns.conf

Installing with Docker

The Docker method is recommended, as it's more convenient for management and auto-start

As usual, create a docker-compose.yml file under /share/Coutainer/softwares/smartdns with the following content

version: '3.1'
services:
  smartdns:
    image: ghostry/smartdns
    container_name: smartdns
    restart: always
    volumes:
      - ./smartdns:/smartdns
    ports:
      - 53:53/udp

Then start it with docker-compose up -d, done

The first time I deployed it, it reported that port 53 was in use. I checked with the command sudo lsof -i:53 and found that the system's built-in dnsmasq service was occupying it

I searched for a long time but couldn't find how to turn this thing off. It seems to be related to QNAP's default DHCP service

This thing's config file is at /etc/dnsmasq.conf. You can change the port to something else in there, but as everyone knows, modifying QNAP's /etc/ directory is useless—it reverts on reboot

So I had no choice but to killall -9 dnsmasq to kill the process.

Then I started the Docker version of smartdns again, done

After starting, a config file is generated under smartdns in the current directory. The default config file is already sufficient; if you want to add custom mappings, configure them according to the official documentation.

Configuration

A simple configuration

# 上游DNS配置
server 192.168.1.1
server 8.8.8.8
server 8.8.4.4
server 114.114.114.114
server 223.5.5.5
server 223.6.6.6
server 119.29.29.29
server-tcp 8.8.8.8
server-tls 8.8.8.8
server-https https://cloudflare-dns.com/dns-query

References

_EOF_

Personal Data Preservation Plan: Installing a Local DNS

本文作者:
程序设计实验室
版权声明:
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

相关文章

个人数据保全计划:(1)NAS开箱

前言 从几年前第一个硬盘故障导致参赛的文件丢失之后,我就开始意识到数据安全的重要性,开始用各种云盘做备份,当时还不是百度云一家独大,我们也都没意识到网盘备份是极其不靠谱的行为,直到因为某些不可抗力因素,一夜之间所有网盘都宣布停服,这时才意识到,数据始终是掌握在自己手中才安全可控。 随着数据量增大,我又购入一个2T硬盘,但因为不懂 + 被无良奸商坑了,买到手发现是叠瓦盘,用了一年多就频繁卡顿和丢数据

2022-11-13 · 个人数据保全计划 · 约 1 分钟

讨论

共 0 条

良言一句三冬暖,恶语伤人六月寒。

加载评论中…