ipv6 远程控制 -Windows10 使用 dynv6 + ddns-go 实现 IPv6 固定域名远程访问指南 - actor{stroke:hsl(259
这里写目录标题
一、解决方案架构解析各组件作用IPv4 与 IPv6 方案对比
二、环境准备清单部署资源汇总:
三、dynv6 域名注册获取API令牌
四、ddns-go 安装配置1. 下载Windows版2. 首次运行配置3. 配置dynv6服务4. 设置开机自启5.域名激活检查
五、防火墙配置(以远程桌面为例)1. 开放远程桌面端口2. 开启远程桌面服务
六、远程访问测试1. 域名解析验证2. 远程桌面连接3. 端口服务测试
七、高级应用场景1. 私有云服务访问2. NAS文件共享3. 游戏服务器搭建
八、故障排除指南九、安全加固措施1. 限制访问IP范围2. 启用双因素认证3. 动态端口隐藏
一、解决方案架构解析
#mermaid-svg-w0If8LKxvxUtBslU {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-w0If8LKxvxUtBslU .error-icon{fill:#552222;}#mermaid-svg-w0If8LKxvxUtBslU .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-w0If8LKxvxUtBslU .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-w0If8LKxvxUtBslU .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-w0If8LKxvxUtBslU .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-w0If8LKxvxUtBslU .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-w0If8LKxvxUtBslU .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-w0If8LKxvxUtBslU .marker{fill:#333333;stroke:#333333;}#mermaid-svg-w0If8LKxvxUtBslU .marker.cross{stroke:#333333;}#mermaid-svg-w0If8LKxvxUtBslU svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-w0If8LKxvxUtBslU .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-w0If8LKxvxUtBslU .cluster-label text{fill:#333;}#mermaid-svg-w0If8LKxvxUtBslU .cluster-label span{color:#333;}#mermaid-svg-w0If8LKxvxUtBslU .label text,#mermaid-svg-w0If8LKxvxUtBslU span{fill:#333;color:#333;}#mermaid-svg-w0If8LKxvxUtBslU .node rect,#mermaid-svg-w0If8LKxvxUtBslU .node circle,#mermaid-svg-w0If8LKxvxUtBslU .node ellipse,#mermaid-svg-w0If8LKxvxUtBslU .node polygon,#mermaid-svg-w0If8LKxvxUtBslU .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-w0If8LKxvxUtBslU .node .label{text-align:center;}#mermaid-svg-w0If8LKxvxUtBslU .node.clickable{cursor:pointer;}#mermaid-svg-w0If8LKxvxUtBslU .arrowheadPath{fill:#333333;}#mermaid-svg-w0If8LKxvxUtBslU .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-w0If8LKxvxUtBslU .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-w0If8LKxvxUtBslU .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-w0If8LKxvxUtBslU .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-w0If8LKxvxUtBslU .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-w0If8LKxvxUtBslU .cluster text{fill:#333;}#mermaid-svg-w0If8LKxvxUtBslU .cluster span{color:#333;}#mermaid-svg-w0If8LKxvxUtBslU div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-w0If8LKxvxUtBslU :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}
1. 获取公网IPv6地址
2. 动态IP上报
3. 更新DNS记录
4. 域名绑定IP
5. 输入您的域名
6. 解析到当前IP
7. 路由到设备
您的Win10笔记本
家庭/公司网络
DDNS-GO客户端
dynv6域名服务
全球DNS系统
异地访问者
核心组件:
dynv6:免费IPv6动态域名服务(支持https://dynv6.com)ddns-go:轻量级动态DNS更新工具(支持Windows)Windows10:内置IPv6支持的操作系统
各组件作用
IPv6地址暴露
您的Win10笔记本从运营商网络获取动态公网IPv6地址(通常以 240e:、2408:、2409: 等开头)此地址是全球唯一的公网地址,可直接被互联网访问 DDNS-GO客户端作用:
软件持续监测您的IPv6地址变化当地址变更时,自动向dynv6发送更新请求 dynv6域名解析
dynv6将您的域名(如 yourhost.dns.army)指向当前IPv6地址DNS记录类型为 AAAA(IPv6地址记录) 异地访问流程
访问者在浏览器/客户端输入:http://[yourhost.dns.army]:端口 (注意:IPv6地址必须用方括号 [] 包裹)全球DNS系统返回您的当前IPv6地址流量通过IPv6网络直达您的Win10笔记本
IPv4 与 IPv6 方案对比
特性IPv4 方案IPv6 方案需要公网 IP必需不需要(移动宽带已分配 IPv6 公网地址)网络穿透能力需路由器端口映射直连设备延迟较高(NAT 转换)极低(端到端直连)移动网络支持部分运营商限制完全支持安全性需防范端口扫描地址空间巨大更安全配置复杂度中等(需端口转发)简单(直接访问)
结论:优先使用 IPv6 方案,当访问端不支持 IPv6 时再使用 IPv4 方案作为备用。
二、环境准备清单
项目要求检测方法宽带网络支持IPv6ipconfig 查看 IPv6 地址Windows10版本1903及以上winver 查看版本号管理员权限必需右键菜单“以管理员身份运行”防火墙配置开放目标端口控制面板->系统和安全->防火墙
IPv6连通性测试:
# 检查IPv6地址
ipconfig | findstr "IPv6"
# 测试IPv6连通性
ping -6 ipv6.baidu.com
注意:若无法获取240开头的公网IPv6地址,需联系宽带运营商开通IPv6服务
部署资源汇总:
工具下载地址ddns-gohttps://github.com/jeessy2/ddns-go/releasesdynv6https://dynv6.com远程桌面客户端https://aka.ms/rdclient
三、dynv6 域名注册
访问站点,可能需要梯子 访问 https://dynv6.com → Sign Up → 邮箱验证
https://dynv6.com
#mermaid-svg-ytePjVpHLnpTIVq2 {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 .error-icon{fill:#552222;}#mermaid-svg-ytePjVpHLnpTIVq2 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-ytePjVpHLnpTIVq2 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-ytePjVpHLnpTIVq2 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-ytePjVpHLnpTIVq2 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-ytePjVpHLnpTIVq2 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-ytePjVpHLnpTIVq2 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-ytePjVpHLnpTIVq2 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-ytePjVpHLnpTIVq2 .marker.cross{stroke:#333333;}#mermaid-svg-ytePjVpHLnpTIVq2 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-ytePjVpHLnpTIVq2 .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-ytePjVpHLnpTIVq2 text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-ytePjVpHLnpTIVq2 .actor-line{stroke:grey;}#mermaid-svg-ytePjVpHLnpTIVq2 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 .sequenceNumber{fill:white;}#mermaid-svg-ytePjVpHLnpTIVq2 #sequencenumber{fill:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 .messageText{fill:#333;stroke:#333;}#mermaid-svg-ytePjVpHLnpTIVq2 .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-ytePjVpHLnpTIVq2 .labelText,#mermaid-svg-ytePjVpHLnpTIVq2 .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-ytePjVpHLnpTIVq2 .loopText,#mermaid-svg-ytePjVpHLnpTIVq2 .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-ytePjVpHLnpTIVq2 .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-ytePjVpHLnpTIVq2 .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-ytePjVpHLnpTIVq2 .noteText,#mermaid-svg-ytePjVpHLnpTIVq2 .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-ytePjVpHLnpTIVq2 .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-ytePjVpHLnpTIVq2 .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-ytePjVpHLnpTIVq2 .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-ytePjVpHLnpTIVq2 .actorPopupMenu{position:absolute;}#mermaid-svg-ytePjVpHLnpTIVq2 .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-ytePjVpHLnpTIVq2 .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-ytePjVpHLnpTIVq2 .actor-man circle,#mermaid-svg-ytePjVpHLnpTIVq2 line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-ytePjVpHLnpTIVq2 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}
用户
dynv6
登录控制面板
Zones → Add new zone
输入域名前缀 (如: mywin10)
分配域名 mywin10.dns.army
用户
dynv6
获取API令牌
点击右上角用户名 → 你的邮箱在 Tokens 区域点击 Create token复制生成的API密钥(格式如:cCk_3XzLdP4eR9iQbN7vM)
四、ddns-go 安装配置
1. 下载Windows版
使用Powershell 管理员权限执行
# 创建安装目录
mkdir C:\DDNS
cd C:\DDNS
# 下载最新版 (v6.0.0)
Invoke-WebRequest -Uri "https://github.com/jeessy2/ddns-go/releases/download/v6.0.0/ddns-go_6.0.0_Windows_x86_64.zip" -OutFile "ddns-go.zip"
# 解压文件
Expand-Archive -Path ddns-go.zip -DestinationPath .
2. 首次运行配置
# 启动配置向导 (管理员权限)
Start-Process -FilePath ".\ddns-go.exe" -Verb RunAs
浏览器自动打开 http://127.0.0.1:9876
3. 配置dynv6服务
DNS服务商选:Callback
# 回调方式配置
回调地址URL (用于IPv6): 拼多多帮助力入口
https://dynv6.com/api/update?zone=#{domain}&token=YOUR_TOKEN&ipv6=#{ip}
# 参数配置:
YOUR_TOKEN: your_api_token # 替换为dynv6 API令牌
其他变量不用调整
IPV4:不启用
IPV6获取IP方式:通过网卡获取 (选择实际连接的网络适配器)
Domains:dynv6申请的域名
禁止公网访问本页面
设置用户名和密码
查看日志是否调用成功
# 成功判断:
成功内容包含: updated
4. 设置开机自启
# 创建Windows服务
New-Service -Name "DDNS-Go" `
-BinaryPathName "C:\DDNS\ddns-go.exe" `
-DisplayName "DDNS-Go Service" `
-StartupType Automatic
# 启动服务
Start-Service -Name "DDNS-Go"
5.域名激活检查
# 域名解析测试(创建后需等待1-10分钟)
Resolve-DnsName yourhost.dns.army -Type SOA
# 正常返回:
Name Type TTL Section NameAdministrator
---- ---- --- ------- -----------------
yourhost.dns.army SOA 3600 Answer hostmaster.dns.army
五、防火墙配置(以远程桌面为例)
1. 开放远程桌面端口
# 允许IPv6远程桌面
New-NetFirewallRule `
-DisplayName "RDP over IPv6" `
-Protocol TCP `
-LocalPort 3389 `
-Direction Inbound `
-Action Allow `
-InterfaceType Any `
-LocalAddress Any `
-RemoteAddress Any `
-Enabled True
2. 开启远程桌面服务
# 启用远程桌面
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
# 允许网络级别认证
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Value 1
六、远程访问测试
访问方式示例 | 服务类型 | 访问格式 | 必备条件 | |-------------|----------------------------------|--------------------| | 远程桌面(RDP) | mstsc.exe /v:[yourhost.dns.army] | 开放3389端口+启用远程桌面 | | 文件共享(SMB) | \[yourhost.dns.army]\Share | 开放445端口+启用文件共享 | | Web服务(HTTP) | http://[yourhost.dns.army]:8080 | 开放目标端口+运行服务 | | SSH服务 | ssh username@yourhost.dns.army | 开放22端口+安装OpenSSH服务 |
1. 域名解析验证
# 查看域名解析的IPv6地址
Resolve-DnsName mywin10.dns.army -Type AAAA | Format-List
2. 远程桌面连接
在其他设备打开远程桌面客户端地址栏输入:[mywin10.dns.army](注意包含方括号)使用Windows账户登录
3. 端口服务测试
# 测试远程桌面端口
Test-NetConnection -ComputerName mywin10.dns.army -Port 3389 -InformationLevel Detailed
七、高级应用场景
1. 私有云服务访问
# 部署轻量Web服务
docker run -d -p 8080:80 --name webserver nginx
# 开放防火墙端口
New-NetFirewallRule -DisplayName "WebService" -Protocol TCP -LocalPort 8080 -Action Allow
2. NAS文件共享
# 创建共享文件夹
New-Item -Path "C:\MyNAS" -ItemType Directory
Grant-SmbShareAccess -Name "MyNAS" -AccountName "Everyone" -AccessRight Full -Force
# 跨网络访问
\\mywin10.dns.army\MyNAS
3. 游戏服务器搭建
# 开放Minecraft端口
New-NetFirewallRule -DisplayName "Minecraft" -Protocol TCP -LocalPort 25565 -Action Allow
连接地址:mywin10.dns.army:25565
八、故障排除指南
故障现象排查命令解决方案域名解析失败Resolve-DnsName mywin10.dns.army -Type AAAA检查ddns-go日志是否更新成功无法连接服务Test-NetConnection -Port 3389 -ComputerName ::1确认防火墙已开放目标端口IPv6地址变化未更新查看 C:\DDNS\ddns-go.log重启ddns-go服务远程桌面认证失败Get-ItemProperty “HKLM:\System\CurrentControlSet\Control\Terminal Server”确认已启用网络级别认证外部无法访问tracert -6 mywin10.dns.army检查路由器是否禁用IPv6转发
关键日志位置:
ddns-go运行日志:C:\DDNS\ddns-go.logWindows系统日志:事件查看器 → Windows日志 → 系统
九、安全加固措施
1. 限制访问IP范围
# 只允许特定IPv6前缀访问
New-NetFirewallRule `
-DisplayName "RDP Restricted" `
-RemoteAddress 240e:3b4:2023::/48 # 替换为你的办公网络前缀
2. 启用双因素认证
# 安装Google身份验证器
Install-Module -Name GoogleAuthenticator
# 绑定远程桌面
Set-RDMTFA -Enable $true -Provider "GoogleAuthenticator"
3. 动态端口隐藏
# 修改远程桌面端口
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "PortNumber" -Value 53389
# 更新防火墙规则
Set-NetFirewallRule -DisplayName "RDP over IPv6" -LocalPort 53389