<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DERP on E7Coding</title><link>https://www.e7coding.com/tags/derp/</link><description>Recent content in DERP on E7Coding</description><generator>Hugo</generator><language>zh-cn</language><managingEditor>Joy</managingEditor><webMaster>Joy</webMaster><lastBuildDate>Tue, 16 Jun 2026 12:00:00 +0800</lastBuildDate><atom:link href="https://www.e7coding.com/tags/derp/index.xml" rel="self" type="application/rss+xml"/><item><title>自建 DERP 中继：让 Headscale 打洞失败也能稳连国内 20ms</title><link>https://www.e7coding.com/posts/self-hosted-derp/</link><pubDate>Tue, 16 Jun 2026 12:00:00 +0800</pubDate><author>Joy</author><guid>https://www.e7coding.com/posts/self-hosted-derp/</guid><description>&lt;blockquote&gt;
&lt;p&gt;折腾背景：我用 Headscale 自建了一套私有组网，大部分设备能 WireGuard P2P 直连。但有几台在对称型 NAT / 运营商大内网后面的机器始终打洞失败，流量只能走中继——而 Tailscale 官方的 DERP 中继节点都在境外，延迟动辄 100ms 起步，看着就难受。于是自己在国内搭了一台 DERP，延迟直接压到 &lt;strong&gt;20ms 级&lt;/strong&gt;。这篇把全过程连同三个坑一起记下来。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="先搞清楚derp-到底在干嘛"&gt;先搞清楚：DERP 到底在干嘛&lt;/h2&gt;
&lt;p&gt;WireGuard 组网的理想状态是两台设备&lt;strong&gt;点对点直连&lt;/strong&gt;（P2P）。但现实里大量设备藏在 NAT 后面，打洞（NAT 穿透）并不总能成功。一旦直连建立不起来，流量就得找个公网中继转一道——这个中继就是 &lt;strong&gt;DERP&lt;/strong&gt;（Designated Encrypted Relay for Packets）。&lt;/p&gt;</description></item></channel></rss>