{"id":32,"date":"2026-06-21T12:25:52","date_gmt":"2026-06-21T04:25:52","guid":{"rendered":"https:\/\/192.168.5.31\/?p=32"},"modified":"2026-06-21T12:25:53","modified_gmt":"2026-06-21T04:25:53","slug":"ubuntu%e9%83%a8%e7%bd%b2headscaleheadplane%e8%87%aa%e5%bb%baderp","status":"publish","type":"post","link":"https:\/\/192.168.5.31\/index.php\/2026\/06\/21\/ubuntu%e9%83%a8%e7%bd%b2headscaleheadplane%e8%87%aa%e5%bb%baderp\/","title":{"rendered":"Ubuntu\u90e8\u7f72headscale+headplane+\u81ea\u5efaderp"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">\u4e4b\u524d\u7684headscale\u90e8\u7f72\u6559\u7a0b\u5df2\u7ecf\u6709\u70b9\u843d\u540e\u65f6\u4ee3\u4e86\uff0cheadscale\u4e5f\u4ece0.23\u5347\u7ea7\u52300.29\u4e86\uff0c\u521a\u597d\u56e0\u4e3a\u7f8e\u56fd\u7684\u670d\u52a1\u5668\u51fa\u4e86\u95ee\u9898(\u53ef\u6076\u7684RN\u628a\u6211\u4ecedc2\u8fc1\u79fb\u5230dc3\uff0c\u7ed9\u7684ip\u8fd8\u7a00\u70c2)\uff0c\u4e8e\u662f\u4e4e\u51c6\u5907\u5b8c\u5168\u8fc1\u79fb\u5230\u522b\u7684\u5730\u65b9\u53bb\u4e86\uff0c\u8fd9\u4e2a\u535a\u5ba2\u5c31\u662f\u8bb0\u5f55\u4e00\u4e0b\u90e8\u7f72\u8fc7\u7a0b\u4e2d\u8e29\u5230\u7684\u5751\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">\u9996\u5148\u4e00\u4e2a\u5c31\u662f\u5b89\u88c5headscale\uff0c\u6211\u8fd9\u8fb9\u4e0d\u63a8\u8350docker\u90e8\u7f72\u7684\u65b9\u5f0f\uff0c\u56e0\u4e3a\u540e\u9762\u8981\u88c5\u7684headplane\u5728\u6ce8\u518c\u673a\u5668\u7684\u65f6\u5019\u6709\u95ee\u9898\uff0c\u6240\u4ee5\u8fd8\u662f\u4f7f\u7528deb\u5b89\u88c5\u7684\u65b9\u5f0f\uff0c\u76f4\u63a5\u53bbgithub\u4e0b\u8f7d\u4e0b\u6765dpkg\u5b89\u88c5\uff0c\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\u5bf9config.yaml\u8fdb\u884c\u7f16\u8f91<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/headscale\/config.yaml\n\nserver_url: \u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u5916\u7f51\u5730\u5740 \u7aef\u53e3\u4f60\u627e\u4e2a\u4e0d\u88ab\u5c01\u7684\u5c31\u884c\nlisten_addr: 0.0.0.0:8080\nprefixes:\n  v4: 100.64.0.0\/10\n  v6: fd7a:115c:a1e0::\/48  \u8fd9\u91cc\u770b\u4f60\u4e2a\u4eba\u559c\u597d \u6211\u61d2\u5f97\u641e\u4e86 \u5982\u679c\u771f\u9700\u8981c\u6bb5\u6211\u5c31\u76f4\u63a5\u53bb\u6570\u636e\u5e93\u91cc\u4fee\u6539\nderp:\n  server:\n    enabled: false  \u5982\u679c\u4f60\u548c\u6211\u4e00\u6837\u4f7f\u7528\u522b\u7684\u670d\u52a1\u5668\u505aDerp\u5c31\u628a\u8fd9\u4e2a\u5173\u4e0a\uff0c\u4e0d\u8fc7\u6211\u4e0d\u6e05\u695a\u5185\u7f6e\u7684\u597d\u4e0d\u597d\u7528\n\n  # List of externally available DERP maps encoded in JSON\n  urls:\n    - http:\/\/xxxx.xxxx.xx\/derp.json   \u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u81ea\u5df1\u7684derp.json\u5730\u5740 \u6211\u662f\u7528nginx\u62c9\u51fa\u6765\u7684\uff0c\u603b\u4e4b\u80fd\u83b7\u53d6\u8fd9\u4e2a\u5c31\u884c\n\n  nameservers:\n    global:\n      - 1.1.1.1\n      - 8.8.8.8\n      - 114.114.114.114\n      - 2606:4700:4700::1111\n      - 2606:4700:4700::1001     \u8fd9\u91ccdns\u770b\u4f60\u81ea\u5df1\n\n\u5269\u4f59\u7684\u5c31\u6ca1\u4ec0\u4e48\u53d8\u52a8\u4e86<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u4e00\u6b65\u5c31\u662f\u90e8\u7f72headplane \u8fd9\u91cc\u76f4\u63a5docker\u62c9\u5c31\u597d\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/var\/lib\/headplane\nheadscale apikeys create -e 9999d #\u8fd9\u662f\u4f60\u7684api_key\uff0c\u4fdd\u5b58\u597d\u4e86\uff0c\u4e4b\u540e\u767b\u5f55\u4e5f\u8981\u7528\ncat << 'EOF' > \/etc\/headplane\/config.yaml\nserver:\n  host: \"0.0.0.0\"\n  port: 3000\n  base_url: \"http:\/\/xxxxxxx:11451\" #headplane\u8bbf\u95ee\u5730\u5740,\u8bb0\u5f97\u548c\u4e0b\u9762docker\u7684\u5916\u90e8\u5730\u5740\u4e00\u81f4\n  cookie_secret: \"xxxxxxxxxxxxxxxxxxxx\"   #\u968f\u4fbf\u778e\u5199\u5b57\u7b26\u4e32\n  cookie_secure: false\n  cookie_max_age: 86400\n  data_path: \"\/var\/lib\/headplane\"\n\nheadscale:\n  url: \"http:\/\/xxxxxxxxx:xxxx\" #headscale\u7684\u5730\u5740\n  config_path: \"\/etc\/headscale\/config.yaml\"\n  api_key: \"hskey-api-\" \u4f60\u81ea\u5df1\u7533\u8bf7\u7684apikey\n  config_strict: false\n\nintegration:\n  agent:\n    enabled: false\n    pre_authkey: \"\"    # <--- \u586b\u8865\u7f3a\u5931\u7684\u5b57\u7b26\u4e32\n  docker:\n    enabled: false\n  kubernetes:\n    enabled: false\n    pod_name: \"\"       # <--- \u586b\u8865\u7f3a\u5931\u7684\u5b57\u7b26\u4e32\n  proc:\n    enabled: false\nEOF\n\n\ndocker run -d \\\n  --name headplane \\\n  --restart always \\\n  -p 11451:3000 \\\n  -v \/etc\/headplane\/config.yaml:\/etc\/headplane\/config.yaml \\\n  -v \/etc\/headscale\/config.yaml:\/etc\/headscale\/config.yaml:ro \\\n  -v \/var\/lib\/headplane:\/var\/lib\/headplane \\\n  ghcr.io\/tale\/headplane:latest<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u76f4\u63a5\u8bbf\u95eehttp:\/\/ip:\u7aef\u53e3\/admin \u767b\u5f55\u7528\u4f60\u7684apikey\u586b\u5165\u5c31\u597d\u4e86<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u81f3\u4e8ederp\u6211\u8fd9\u8fb9\u662f\u76f4\u63a5go\u7f16\u8bd1\u7684derp\u6e90\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/go.dev\/dl\/go1.26.4.linux-amd64.tar.gz  #\u6709go\u5c31\u8df3\u8fc7\u8fd9\u4e00\u90e8 \u53e6\u5916\u53ef\u80fd\u9700\u8981\u6302\u68af\u5b50\nsudo tar -C \/usr\/local -xzf go1.26.4.linux-amd64.tar.gz\nexport PATH=$PATH:\/usr\/local\/go\/bin\necho 'export PATH=$PATH:\/usr\/local\/go\/bin' >> ~\/.bashrc\ngo install tailscale.com\/cmd\/derper@latest\nsudo cp ~\/go\/bin\/derper \/usr\/local\/bin\/\nmkdir -p \/var\/lib\/derper\/certs\n\n\u521b\u5efaderp.service\n\n&#91;Unit]\nDescription=Tailscale DERP Server\nAfter=network.target\nWants=network.target\n\n&#91;Service]\nType=simple\nUser=root\nRestart=always\nRestartSec=5\nExecStart=\/usr\/local\/bin\/derper \\\n  -hostname derp\u516c\u7f51IP \\\n  -certmode manual \\\n  -certdir \/var\/lib\/derper\/certs \\\n  -a :xxxx \\  #http\u5916\u90e8\u7aef\u53e3\n  -stun \\\n  -stun-port 3478 \\\n  -verify-clients=false\n\n&#91;Install]\nWantedBy=multi-user.target\n\n\u7136\u540e\u8bb0\u5f97systemctl enable derp\u548cstart derp\n\u4e0b\u9762\u662fderp\u7684json\u5927\u6982\u683c\u5f0f\uff0c\u5bf9\u7167\u6539\u5c31\u597d\n{\n  \"Regions\": {\n    \"900\": {\n      \"RegionID\": 900,\n      \"RegionCode\": \"cn-sh\",\n      \"RegionName\": \"China Shanghai\",\n      \"Nodes\": &#91;\n        {\n          \"Name\": \"900a\",\n          \"RegionID\": 900,\n          \"HostName\": \"ip\", \n          \"DERPPort\": xxxx,  #\u7aef\u53e3\n          \"STUNPort\": 3478,\n          \"InsecureForTests\": true\n        }\n      ]\n    }\n  }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u7684headscale\u90e8\u7f72\u6559\u7a0b\u5df2\u7ecf\u6709\u70b9\u843d\u540e\u65f6\u4ee3\u4e86\uff0cheadscale\u4e5f\u4ece0.23\u5347\u7ea7\u52300.29\u4e86\uff0c\u521a\u597d\u56e0\u4e3a\u7f8e\u56fd\u7684\u670d\u52a1\u5668\u51fa\u4e86\u95ee\u9898( &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":2,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/posts\/32\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/192.168.5.31\/index.php\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}