如何避免 DNS 丢失? (curl 使用 c-ares 进行直接 DNS 查询)

作者: beelze创建于 2025年1月2日更新于 2026年4月26日

DNS 没有泄漏:

proxychains wget -q ipinfo.io/ip -O -

[proxychains] config file found: /etc/proxychains.conf [proxychains] preloading /usr/lib64/libproxychains.so.4.17 [proxychains] DLL init: proxychains-ng 4.17 在 'ipinfo.io/ip' 前面加上 http:// [proxychains] Strict chain ... xx.xx.xx.xx:yy ... ipinfo.io:80 ... OK 94.131.98.223 一切正常, DNS 查询通过了代理服务器端的系统解析器(通过 tcpdump 检查)。 但是:

proxychains curl ipinfo.io/ip

[proxychains] config file found: /etc/proxychains.conf [proxychains] preloading /usr/lib64/libproxychains.so.4.17 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] Strict chain ... xx.xx.xx.xx:yy ... 34.117.59.81:80 ... OK 94.131.98.223 泄漏了, DNS 查询通过了本地系统解析器(通过 tcpdump 检查)。 proxychains.conf: strict_chain proxy_dns_daemon 127.0.0.1:1053 remote_dns_subnet 224 tcp_read_time_out 15000 tcp_connect_time_out 8000 [ProxyList] socks5 xx.xx.xx.xx yy usr pwd 我在试图找到一个解决更通用问题的方法:完全消除"DNS 泄漏"问题。当然,在本地无法做到这一点,所以我通过运行 tun2socks 的"路由器"对所有流量进行了隧道,但解析仍然是一个问题 - 通过代理服务器隧道 DNS 查询也是一个"泄漏"。唯一的解决方案是将解析委托给一个 socks 代理,我正在尝试了解是否可以使用 proxychains 来实现这一点。

内容来源: rofl0r/proxychains-ng