{"id":2764,"date":"2026-04-24T09:22:07","date_gmt":"2026-04-24T01:22:07","guid":{"rendered":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/?p=2764"},"modified":"2026-04-24T09:47:06","modified_gmt":"2026-04-24T01:47:06","slug":"dnsmasq-stubby","status":"publish","type":"post","link":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2026\/04\/24\/dnsmasq-stubby\/","title":{"rendered":"dnsmasq + stubby"},"content":{"rendered":"\n<p>\u524d\u6bb5\u65f6\u95f4\u56e0\u4e3a DNS \u6c61\u67d3\uff08\u6216\u8005\u62e6\u622a\uff09\u7684\u539f\u56e0\uff0c\u5728\u8def\u7531\u5668\u4e2d\u6539\u6210\u914d\u7f6e DoT\uff0c\u95ee\u9898\u5f97\u5230\u4e86\u6781\u5927\u6539\u5584\uff0c\u4e0a\u7f51\u901f\u5ea6\u548c\u8d28\u91cf\u5f88\u660e\u663e\u597d\u5f88\u591a\u3002\u4f46\u662f\u8fd8\u4f9d\u7136\u5b58\u5728\u4e00\u4e9b\u8ba9\u4eba\u56f0\u60d1\u7684\u7455\u75b5\uff1a\uff081\uff09\u6709\u65f6\u5019 DNS \u67e5\u8be2\u8fc7\u7a0b\u4f1a\u7a81\u7136\u7f13\u6162\u5361\u987f\uff1b\uff082\uff09\u8def\u7531\u5668\u4e0a\u7684 DNS \u4f1a\u7f13\u5b58\u591a\u5c11\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u95ee\u9898\uff081\uff09\uff0c\u6211\u6000\u7591\u662f\u8def\u7531\u5668\u914d\u7f6e\u7684 DoT \u670d\u52a1\u5668\u53ef\u80fd\u6709\u82e5\u5e72\u4e2a\u5de5\u4f5c\u4e0d\u6b63\u5e38\u3002\u6211\u5728\u8def\u7531\u5668\u4e2d\u914d\u7f6e\u4e86\u56db\u4e2aDoT\u670d\u52a1\u5668\uff0c\u5206\u522b\u5bf9\u5e94\u963f\u91cc\u548c\u817e\u8baf\u7684\u4e3b\u5907DoT\u670d\u52a1\u5668\u3002\u8def\u7531\u5668\u6ca1\u6709\u63d0\u4f9b\u76f8\u5e94\u7684log\uff0c\u56e0\u6b64\u65e0\u4ece\u8bc1\u5b9e\u8fd9\u4e2a\u731c\u6d4b\u3002\u5bf9\u4e8e\u95ee\u9898\uff082\uff09\uff0c\u8def\u7531\u5668\u4e5f\u6ca1\u6709\u63d0\u4f9b\u914d\u7f6e\u6216\u8005log\uff0c\u540c\u6837\u4e0d\u5f97\u800c\u77e5\u3002<\/p>\n\n\n\n<p>\u4e3a\u5f7b\u5e95\u5f04\u660e\u767d\u8fd9\u4e9b\u60c5\u51b5\uff0c\u6211\u51b3\u5b9a\u8fd8\u662f\u81ea\u5df1\u642d\u4e00\u5957\u73af\u5883\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u91c7\u7528 dnsmasq + stubby\u3002\u5176\u4e2d dnsmasq \u8d1f\u8d23\u53d1\u8d77 DoU\uff08DNS over UDP\uff09 \u67e5\u8be2\u548c\u7f13\u5b58\uff0cstubby \u8d1f\u8d23 DoT\uff08DNS over TLS\uff09 \u8bf7\u6c42\uff0c\u7f51\u7edc\u62d3\u6251\u662f\u4ee5\u4e0b\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u8bbe\u5907 &lt;-- DoU --&gt; dnsmasq &lt;-- DoU --&gt; stubby &lt;-- DoT --&gt; DNS server<\/pre>\n\n\n\n<p>\u91c7\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install dnsmasq stubby<\/pre>\n\n\n\n<p>\u542f\u52a8\u6216\u8005\u67e5\u8be2\u72b6\u6001\u91c7\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart dnsmasq<br>sudo systemctl restart stubby<br>sudo systemctl status dnsmasq<br>sudo systemctl status stubby<\/pre>\n\n\n\n<p>\u4fee\u6539 \/etc\/stubby\/stubby.yml \u6587\u4ef6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">listen_addresses:<br>  - 127.0.0.1@53000<br>  - 0::1@53000<br>upstream_recursive_servers:<br># alidns dot<br>  - address_data: 223.5.5.5<br>    tls_auth_name: \"dns.alidns.com\"<br>  - address_data: 223.6.6.6<br>    tls_auth_name: \"dns.alidns.com\"<\/pre>\n\n\n\n<p>\u6587\u4ef6\u4e2d\u53ea\u914d\u7f6e\u4e86\u963f\u91ccDNS\u7684\u670d\u52a1\u5668\u5730\u5740\uff0c\u540e\u9762\u4f1a\u8be6\u8ff0\u539f\u56e0\u3002\u53e6\u5916\uff0cstubby \u8bbe\u7f6e\u4e3a\u542f\u52a8\u672c\u5730 53000 \u7aef\u53e3\u63a5\u6536 DNS\u67e5\u8be2\uff0c\u8fd9\u4e2a\u7aef\u53e3\u53ef\u4ee5\u968f\u610f\u8bbe\u7f6e\uff0c\u4f46\u8981\u4e0e\u540e\u9762 dnsmasq\u4e00\u81f4\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5728 \/etc\/dnsmasq.d \u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49conf\u6587\u4ef6\uff0c\u4f8b\u5982mydns.conf\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># stubby address and port<br>server=127.0.0.1#53000<br>no-resolv<br><br># cache configuration<br>min-cache-ttl=300<br>max-cache-ttl=3600<br>cache-size=10000<br><br># \u7eaf\u4e3b\u673a\u540d\u4e0d\u8f6c\u53d1\u5916\u7f51<br>domain-needed<br># \u62e6\u622a\u79c1\u6709\u5185\u7f51\u5730\u5740\u53cd\u5411\u89e3\u6790\uff0c\u4e0d\u53d1\u5916\u7f51<br>bogus-priv<br># \u5185\u7f51.lan\u540e\u7f00\u5b8c\u5168\u672c\u5730\u89e3\u6790<br>local=\/lan\/<\/pre>\n\n\n\n<p>server \u5bf9\u63a5 stubby\uff0c\u56e0\u6b64\u8981\u6ce8\u610f\u5bf9\u63a5\u524d\u9762\u8bbe\u7f6e\u7684 53000 \u7aef\u53e3\u3002cache \u90e8\u5206\u7684\u914d\u7f6e\u53ef\u4ee5\u5f88\u76f4\u89c2\u5730\u63a7\u5236 ttl \u548c\u5177\u4f53\u7684cache\u5bb9\u91cf\uff0c\u8fd9\u6837\u5c31\u5f88\u6e05\u695a\u5730\u89e3\u51b3\u4e86\u524d\u9762\u63d0\u5230\u7684\u95ee\u9898\uff082\uff09\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u95ee\u9898\uff081\uff09\uff0c\u4fee\u6539 stubby \u7684\u914d\u7f6e\uff0c\u5355\u72ec\u6307\u5411\u817e\u8bafDoT\u670d\u52a1\u5668\u548c\u963f\u91ccDoT\u670d\u52a1\u5668\u8fdb\u884c\u6d4b\u8bd5\uff0c\u4e5f\u641e\u6e05\u695a\u539f\u56e0\u4e86\u3002\u636e\u8bf4\u817e\u8baf\u670d\u52a1\u5668\u9650\u5b9a\u4e8620QPS\uff08\u6bcf\u79d2\u4e0d\u8d85\u8fc720\u4e2aDNS\u67e5\u8be2\uff09\uff0c\u58f0\u79f0\u8fd9\u4e2a\u503c\u8db3\u591f\u5bb6\u5ead\u7528\u6237\u4f7f\u7528\uff0c\u5176\u5b9e\u5b8c\u5168\u4e0d\u5bf9\u3002\u6253\u5f00\u817e\u8baf\u7684\u5b98\u7f51\uff08qq.com\uff09\u5e76\u7528 wireshark \u6293\u5305\uff0c\u4e00\u4e2a\u9996\u9875\u7684DNS\u67e5\u8be2\u5c31\u5df2\u7ecf\u8d85\u8fc720QPS\uff0c\u7136\u540eIP\u5c31\u88ab\u5c4f\u853d\uff0cDNS\u7ed3\u679c\u5168\u90e8\u662f\u300cserver failure\u300d\u3002\u8fd9\u8fd8\u4ec5\u4ec5\u662f\u4e00\u4e2a\u7528\u6237\u3001\u6253\u5f00\u4e00\u4e2a\u9875\u9762\u7684DNS\u67e5\u8be2\u7ed3\u679c\uff0c\u5982\u679c\u662f\u5bb6\u5ead\u591a\u4e2a\u7528\u6237\uff08\u7ecf\u7531\u540c\u4e00\u53f0\u8def\u7531\u5668\uff09\u540c\u65f6\u4e0a\u7f51\uff0c\u94c1\u5b9a\u8d85\u8fc720QPS\u3002\u817e\u8baf\u514d\u8d39\u7684 public DNS \uff08DoT\uff09\u670d\u52a1\u6d4b\u8bd5\u7ed3\u679c\u5f88\u597d\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a\u6839\u672c\u5c31\u4e0d\u9002\u5408\u5bb6\u5ead\u4f7f\u7528\u3001\u751a\u81f3\u4e5f\u4e0d\u9002\u5408\u4e2a\u4eba\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u7136\u800c\u963f\u91cc\u7684DNS\uff08DoT\uff09\u8ba9\u4eba\u5f88\u60ca\u559c\u3002\u636e\u8bf4\u4e5f\u6709 QPS \u9650\u5236\uff0c\u4f46\u662f\u660e\u663e\u6bd4\u817e\u8baf\u8981\u597d\u5f88\u591a\u3002\u5728\u8def\u7531\u5668\u4e0a\u5220\u9664\u817e\u8bafDoT\u670d\u52a1\u5668\u3001\u53ea\u4fdd\u7559\u963f\u91cc DoT \u670d\u52a1\u5668\u7684\u914d\u7f6e\u540e\u6ca1\u53d1\u73b0\u5361\u987f\u73b0\u8c61\uff0c\u7f51\u7edc\u901f\u5ea6\u5f88\u5feb\u3001\u8d28\u91cf\u5f88\u7a33\u5b9a\u3002<\/p>\n\n\n\n<p>\u6d4b\u8bd5\u7ed3\u679c\u663e\u793a\uff1a\u56fd\u5916\u77e5\u540d\u7684\u516c\u5171 DoT \u670d\u52a1\u5668<strong>\u5168\u90e8<\/strong>\u4e0d\u53ef\u7528\uff0c\u6240\u6709DNS\u67e5\u8be2\u7ed3\u679c\u90fd\u662f\u300cserver failure\u300d\u3002\u4e0d\u77e5\u9053\u662fDoT\u670d\u52a1\u5668\u9650\u5236\u4e86\u4e2d\u56fdIP\u5730\u5740\u7684\u8bbf\u95ee\uff0c\u8fd8\u662f\u67d0\u795e\u79d8\u529b\u91cf\u5c4f\u853d\u4e86\u5bf9\u8fd9\u4e9bDoT\u670d\u52a1\u5668\u7684\u8bbf\u95ee\uff0c\u597d\u96be\u731c\u3002<\/p>\n\n\n\n<p>\u8089\u8eab\u8dd1\u5230\u9694\u58c1\u7684\u9999\u6e2f\u6d4b\u8bd5\u4e86 Google \u548c Cloudflare \u7684 DoT \u670d\u52a1\u5668\u3002\u65e0\u8bba\u662f IPv4 \u8fd8\u662f IPv6\uff0c\u901f\u5ea6\u90fd\u6781\u5feb\u3001\u8d28\u91cf\u6781\u7a33\u5b9a\uff0c\u597d\u7fa1\u6155\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e86\uff0c\u963f\u91cc\u7684\u955c\u50cf\u670d\u52a1\u4e5f\u6bd4\u817e\u8baf\u597d\u5f88\u591a\uff0c\u901f\u5ea6\u53c8\u5feb\u53c8\u7a33\uff0c\u6211\u4eec\u5728\u56fd\u5185\u7684\u6240\u6709 Debian \u8282\u70b9\u90fd\u662f\u91c7\u7528\u963f\u91cc\u7684\u955c\u50cf\u670d\u52a1\u3002\u6211\u89c9\u5f97\u6211\u4eec\u5e94\u8be5\u5bf9\u6dd8\u5b9d\u597d\u4e00\u70b9\uff08\u867d\u7136\u6dd8\u5b9d\u7684app\u548c\u670d\u52a1\u90fd\u5f88\u70c2\uff09\uff0c\u652f\u6301\u8fd9\u4e9b\u597d\u7684 public services \u7ee7\u7eed\u652f\u6491\u4e0b\u53bb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u6bb5\u65f6\u95f4\u56e0\u4e3a DNS \u6c61\u67d3\uff08\u6216\u8005\u62e6\u622a\uff09\u7684\u539f\u56e0\uff0c\u5728\u8def\u7531\u5668\u4e2d\u6539\u6210\u914d\u7f6e DoT\uff0c\u95ee\u9898\u5f97\u5230\u4e86\u6781\u5927\u6539\u5584\uff0c\u4e0a\u7f51\u901f\u5ea6\u548c\u8d28\u91cf\u5f88\u660e\u663e\u597d\u5f88\u591a\u3002\u4f46\u662f\u8fd8\u4f9d\u7136\u5b58\u5728\u4e00\u4e9b\u8ba9\u4eba\u56f0\u60d1\u7684\u7455\u75b5\uff1a\uff081&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.myvoipapp.com\/blogs\/yxh\/2026\/04\/24\/dnsmasq-stubby\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[942,395,940,943,939,941,796],"class_list":["post-2764","post","type-post","status-publish","format-standard","hentry","category-53","tag-alidns","tag-dns","tag-dnsmasq","tag-dnspod","tag-dot","tag-stubby","tag-tencent"],"_links":{"self":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/2764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/comments?post=2764"}],"version-history":[{"count":6,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/2764\/revisions"}],"predecessor-version":[{"id":2770,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/posts\/2764\/revisions\/2770"}],"wp:attachment":[{"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/media?parent=2764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/categories?post=2764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myvoipapp.com\/blogs\/yxh\/wp-json\/wp\/v2\/tags?post=2764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}