我有一台正在使用的笔记本电脑、一个基于 FreshTomato 的路由器和一个运行 NixOS 的 Raspberry Pi,我在其上安装了Blocky以尝试将其用作我的 DNS 服务器。
但是,我的笔记本电脑发出的请求无法解决:
$ curl https://0xerr0r.github.io/blocky
curl: (6) Could not resolve host: 0xerr0r.github.io
Firefox 中的请求似乎永远都无法完成。
这是从我的笔记本电脑上获取的,据我所知,它已获取 DNS 服务器的正确 IP:
这也是来自我的笔记本电脑:
$ dig @192.168.1.4 https://0xerr0r.github.io
;; communications error to 192.168.1.4#53: timed out
;; communications error to 192.168.1.4#53: timed out
;; communications error to 192.168.1.4#53: timed out
; <<>> DiG 9.18.30 <<>> @192.168.1.4 https://0xerr0r.github.io
; (1 server found)
;; global options: +cmd
;; no servers could be reached
但是,从 Pi 本身运行相同程序(通过 SSH):
$ nix-shell --packages dig --run "dig @192.168.1.4 https://0xerr0r.github.io"
; <<>> DiG 9.18.28 <<>> @192.168.1.4 https://0xerr0r.github.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31507
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;https://0xerr0r.github.io. IN A
;; ANSWER SECTION:
https://0xerr0r.github.io. 3600 IN A 185.199.109.153
https://0xerr0r.github.io. 3600 IN A 185.199.108.153
https://0xerr0r.github.io. 3600 IN A 185.199.111.153
https://0xerr0r.github.io. 3600 IN A 185.199.110.153
;; Query time: 335 msec
;; SERVER: 192.168.1.4#53(192.168.1.4) (UDP)
;; WHEN: Sun Feb 16 13:44:31 CET 2025
;; MSG SIZE rcvd: 118
这些是我的 Blocky 设置:
settings = {
ports.dns = 53; # Port for incoming DNS Queries.
ports.http = 4000;
upstreams.groups.default = [
"https://one.one.one.one/dns-query" # Using Cloudflare's DNS over HTTPS server for resolving queries.
];
# For initially solving DoH/DoT Requests when no system Resolver is available.
bootstrapDns = {
upstream = "https://one.one.one.one/dns-query";
ips = [ "1.1.1.1" "1.0.0.1" ];
};
#Enable Blocking of certain domains.
blocking = {
denylists = {
#Adblocking
ads = ["https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"];
#Another filter for blocking adult sites
adult = ["https://blocklistproject.github.io/Lists/porn.txt"];
#You can add additional categories
};
#Configure what block categories are used
clientGroupsBlock = {
default = [ "ads" ];
kids-ipad = ["ads" "adult"];
};
};
};
它似乎运行良好:
$ blocky blocking status
[2025-02-16 13:55:27] INFO blocking enabled
以下是我的路由器的一些可能相关的设置。
将 DNS 服务器设置为该 IP 地址:
我认为这已经足够了,但我还必须为我的笔记本电脑添加这个 dnsmasq 配置才能真正获取 DNS 服务器:
有人知道哪里出了问题吗?提前谢谢!