id: 9d35fc067d6d47b787220e92271563c0
parent_id: 
item_type: 1
item_id: d4dd5bbf8b2e4a1ab1fbfa11f8cca8c1
item_updated_time: 1764345507069
title_diff: "[{\"diffs\":[[1,\"IPv6实现外网访问家中设备\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":14}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>IPv6实现外网访问家中设备</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"content-class\\\" content=\\\"yinxiang.peso.superNote\\\"/>\\\r\\\n  <meta name=\\\"application-data:yinxiang.noteLayout\\\" content=\\\"{\\\"lineSpace\\\":\\\"recommend\\\",\\\"paragraphSpace\\\":\\\"recommend\\\"}\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"38684\\\"></a>\\\r\\\n<h1>IPv6实现外网访问家中设备</h1>\\\r\\\n\\\r\\\n<div><span><div><br/></div><p><br/></p><div style=\\\"--en-blockquote:true;box-sizing: border-box; padding-left: 19px; padding-top: 6px; padding-bottom: 6px; border-left: 3px solid #b4c0cc; background-position: initial initial; background-repeat: initial initial; margin-top: 6px\\\"><div>原文链接: <a href=\\\"http://mp.weixin.qq.com/s?__biz=Mzg3Nzg3MjIyNw==&amp;mid=2247484531&amp;idx=1&amp;sn=a7f01604d855e7e1c308beb715e34c39&amp;chksm=cedb2cdeacbbc620bba45a897f221a26a8c5ac1c707b86124e5c6c2707de3593569afadac139&amp;mpshare=1&amp;scene=1&amp;srcid=0321skZ3S6CbdHvxX4gwXFFz&amp;sharer_shareinfo=caf3503c1749c7dd624d11e6fb9e4c38&amp;sharer_shareinfo_first=caf3503c1749c7dd624d11e6fb9e4c38#rd\\\" rev=\\\"en_rl_none\\\">http://mp.weixin.qq.com/s?__biz=Mzg3Nzg3MjIyNw==&amp;mid=2247484...</a></div></div><p><br/></p><div><br/></div><h1 style=\\\"other-props:eyJibG9ja0lkIjoiQ3NiclFLVEgzemoifQ==;\\\"> IPv6实现外网访问家中设备 </h1><div>原创 个人  程序语言栈 </div><div>新买的矿渣盒子黑豹X2正式在家中服役了。盒子上运行着HomeAssistant，作为家中的智能中枢。出门在外的时候，有访问HomeAssistant的需求。文章《<a href=\\\"https://mp.weixin.qq.com/s?__biz=Mzg3Nzg3MjIyNw==&amp;mid=2247484298&amp;idx=1&amp;sn=3488cddb4476627008152d772deb93c3&amp;scene=21#wechat_redirect\\\" rev=\\\"en_rl_none\\\" target=\\\"_blank\\\">基于IPv6的内网穿透</a>》介绍了通过IPv6地址访问家庭设备的方法。本文记录详细设置过程。</div><div><a href=\\\":/4cef18ebf61544249cf8afcf6d78db1d\\\">不同的ipv6地址的用途_临时 ipv6 地址-CSDN博客</a></div><div><span style=\\\"font-weight: bold;\\\">查看设备IPv6地址</span></div><div>使用ip a命令，查看网卡eth0对应的IP地址。</div><div style=\\\"--en-codeblock:true;--en-blockId:Rj5gT-n_das;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">ip a</div><img src=\\\":/c4a68997c4bb48d9ba2a50b2aed87371\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>可以看到，设备一共获得了4个IPv6地址。每个地址的含义参考下面这篇文章。这里截图展示会用到的一些介绍。</div><p>不同的ipv6地址的用途</p><div>https://blog.csdn.net/qq_38641599/article/details/142428074</div><div><span style=\\\"background-color: #fffb00;\\\">公网地址</span></div><img src=\\\":/76774708ea954ae585ce731f5290c6f8\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div><span style=\\\"background-color: #fffb00;\\\">随机公网地址</span></div><img src=\\\":/2d835b95f77a43838d05eb76c6aa7787\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><img src=\\\":/96a6421d059f432e88de41204ea17e49\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>博主推荐使用scope global dynamic mngtmpaddr noprefixroute地址作为外网访问地址。也就是系统展示的第3个 IPv6地址。</div><div>本人安装的Armbian bullseye一开始没有临时IPv6的地址。参考下面的文章进行设置后获得。</div><p>linux ipv6临时地址</p><div>https://www.cnblogs.com/makefile/p/5040615.html</div><div>a. 修改/etc/sysctl.conf文件</div><div style=\\\"--en-codeblock:true;--en-blockId:TowJQehBn1g;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">vim /etc/sysctl.conf</div><div>b. 增加下面的内容</div><img src=\\\":/08272b91baf240e293c1289b65b7b632\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>c. 读取sysctl.conf使设置生效。然后重启即可获得临时IPv6地址。</div><div style=\\\"--en-codeblock:true;--en-blockId:KKAgT2ki3Cm;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">systcl --systemreboot</div><div><span style=\\\"font-weight: bold;\\\">设置域名解析</span></div><div>由于使用的是临时IPv6地址，会不断发生变化，需要使用域名解析服务。通过将域名与设备的临时IPv6地址绑定，就可以通过域名访问设备。这里使用的是DDNS-GO加Cloudflare方案。详细设置可参考下面的文章。</div><p>一套免费且实用的内网穿透方案！DDNS+Cloudflare给你全新体验</p><div>https://blog.csdn.net/luo_fengyuan/article/details/135940120</div><div>大致步骤如下：</div><div>a. 申请域名</div><div>在Namesilo上注册了一个域名。通过网上搜推广码，最便宜可以1美元/年（首年），支持支付宝支付。</div><div style=\\\"--en-codeblock:true;--en-blockId:IvwbSK7Rqxi;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">www.namesilo.com</div><div>b. 将域名添加到Cloudflare。在DNS设置中，为域名配置两条记录。内容为IPv6临时地址。注意代理状态设置成仅DNS。</div><img src=\\\":/d525e296c80e4898b640d6b5dd324bab\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>c. 在Namesilo中设置网址的域名解析服务器为Cloudflare提供的名称服务器。如上图所示。</div><img src=\\\":/586bc38645c041d285aca9780da996ab\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>使用下面的命令查看域名解析是否成功。</div><div style=\\\"--en-codeblock:true;--en-blockId:gIP8RqDWT8m;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"># windows cmd，向谷歌域名服务器查询解析结果nslookup www.**.mom 8.8.8.8# linux，查询IPv6解析结果dig AAAA www.**.mom</div><img src=\\\":/b4d0044aa4674de3b5a561eca2c3b4fa\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>这个时候，就可以通过域名访问家庭服务器了。</div><div>d. 部署DDNS-GO</div><div>DDNS-GO的作用是定时获取本地IPv6地址，然后向Cloundflare更新域名对应的IPv6地址。这里采用Docker Compose方式部署。dock-compose.yml文件内容如下。</div><div style=\\\"--en-codeblock:true;--en-blockId:2zUsSOksyQK;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">services:  ddns-go:    image: jeessy/ddns-go:v6.6.1-arm64    container_name: ddns-go    restart: unless-stopped    network_mode: host    volumes:      - /etc/ddns-go:/root</div><div>使用docker compose命令启动后，浏览器访问主机IP:9876即可进入管理界面。第一次登录需要设置管理员账号和密码。</div><div style=\\\"--en-codeblock:true;--en-blockId:uvldSyy-l87;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\">docker compose up -d</div><div>设置DDNS-GO。Token为Cloudflare中创建的令牌。</div><img src=\\\":/93d5732604b14e05b88b13face299b0e\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><img src=\\\":/0572fc819ab4421f8fd01d12fcc45b8a\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>不启用IPv4，启用IPv6。通过匹配正则表达式指定要更新的IPv6地址。这里本机的第3个地址是临时IPv6地址。</div><img src=\\\":/886bc40738054b7eb2cd3c23ca16c72a\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;--en-uploadstate:uploaded;\\\"/><div>完成后保存。查看DDNS-GO中的日志记录，可以看到IP是否成功更新。</div><div style=\\\"color:rgba(0, 0, 0, 0.3);\\\"><span style=\\\"color: rgba(0,0,0,.3);\\\">修改于</span></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":10710}]"
metadata_diff: {"new":{"id":"d4dd5bbf8b2e4a1ab1fbfa11f8cca8c1","parent_id":"061de1401cfc4cfaadf6e74e015970e9","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764345730055,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T16:12:44.770Z
created_time: 2025-11-28T16:12:44.770Z
type_: 13