燊燊龙门阵 發表於 2024-9-12 18:46:00

Openwrt安装ddns-go

<h2 id="必备条件">1. 必备条件</h2>
<ol>
<li>已刷好OpenWRT的路由</li>
<li>Openwrt已配置好网络</li>
</ol>
<h2 id="根据cpu架构下载ddns-go">2. 根据CPU架构下载DDNS-go</h2>
<p>我用的是迅雷赚钱宝1代,其CPU是arm7,所以要下载对应的arm7版本</p>
<p>https://github.com/jeessy2/ddns-go/releases</p>
<h2 id="解压文件将文件复制到openwrt">3. 解压文件,将文件复制到openwrt</h2>
<p>用WinSCP连接OpenWRT,复制ddns-go进去</p>
<p>WinSCP下载</p>
<p>如果不知道放到哪里,就用df -h查看空间使用情况:</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                   75.7M      3.7M   72.0M   5% /
/dev/ubi0_0            75.7M      3.7M   72.0M   5% /
devtmpfs                512.0K         0    512.0K   0% /dev
tmpfs                   113.8M    256.0K    113.6M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev</code></pre>
</div>
<p>SSH client, 终端客户端</p>
<p>FinalShell下载&nbsp;或者&nbsp;PUtty下载</p>
<h2 id="安装">4. 安装</h2>
<p>命令行进入ddns-go所在文件夹,执行以下命令。</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>Mac/Linux:./ddns-go -s install</code></pre>
</div>
<p>安装后自启动都是配置好的。 [可选] 服务卸载</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>Mac/Linux: ./ddns-go -s uninstall</code></pre>
</div>
<p>[可选] 支持安装带参数</p>
<p>-l 监听地址<br>-f 同步间隔时间(秒)<br>-cacheTimes 间隔N次与服务商比对<br>-c 自定义配置文件路径<br>-noweb 不启动web服务<br>-skipVerify 跳过证书验证<br>-dns 自定义 DNS 服务器<br>-resetPassword 重置密码</p>
<h2 id="问题解决">5. 问题解决</h2>
<p>openwrt ddns-go 查询域名信息发生异常! tls: failed to verify certificate: x509: certificate signed by unknown authority</p>
<p><strong>原因</strong>:在路由器下运行ddns-go 因为缺少证书报错,由于/etc/ssl 路径被挂载为只读,无法导入证书。</p>
<p><strong>解决办法</strong>:1. 安装:ca-certificates,安装后相应证书文件都有了。</p>
<h2 id="申请cloudflare的api-key">6. 申请Cloudflare的API KEY</h2>
<p>Cloudfalre 个人资料 -&gt; 创建令牌 -&gt; 编辑区域 DNS (使用模板)</p>
<h2 id="配置ddns-go">7. 配置ddns-go</h2>
<p>配置cloudflare的API Key</p>
<p>&nbsp;<img src="https://www.500599.xyz/posts/webdav/openwrt-ddns-cloudflare/ddns-go-config.webp">&nbsp;</p>
<p><strong>配置域名</strong>&nbsp;输入的二级域名记录如果不存在,ddns-go会自动创建。但在删除ddns-go配置时,并不会删除。</p>
<p>IPv6地址选直接从网卡获取,因为IPv6每个设备都有公网IPv6地址。如果主路由想为子网其他设备更新ddns ipv6, 可以使用命令根据MAC地址获取。</p>
<p>例如:</p>
<p>在Linux系统中获取网卡eth1的IPv6地址</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>ip -6 addr show eth1</code></pre>
</div>
<p>获取局域网中的其它设备IPv6地址 其它设备需要支持EUI-64(IPv6后半部分包含ff:fe)</p>
<p>Linux</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>ip -6 route | awk '{print $1}' | awk '/240:?/' | awk -F::/ '{print $1 ":suffix of other mac"}'</code></pre>
</div>
<p>Windows</p>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>Get-NetRoute -AddressFamily IPv6 | Where-Object { $_.DestinationPrefix.StartsWith("240") -and $_.DestinationPrefix.endsWith("/64") } | ForEach-Object { ($_.DestinationPrefix -split '::/') + ":suffix of other mac" }</code></pre>
</div>
<p>IPv4地址如果设备获取的地址是192.168.*.*这种私有地址,就选择通过接口获取,大多都是这种情况。</p>
<h2 id="验证效果">8. 验证效果</h2>
<div class="highlight">
<pre class="highlighter-hljs" tabindex="0"><code>ping xl2.500599.xyz</code></pre>
<h2>9. 相关链接</h2>
<p>Openwrt安装ddns-go</p>
<h3 id="1-openwrt安装配置caddy提供webdav协议的nas服务postswebdavopenwrt-caddy-webdav">OpenWRT安装配置Caddy提供WebDAV协议的NAS服务</h3>
<h3 id="3-windiws-iis开启webdav协议的nas安装配置方法及疑难问题解决postswebdavwindows-iis-webdav">Windiws IIS开启WebDAV协议的NAS,安装配置方法及疑难问题解决</h3>
</div><br><br>
来源:https://www.cnblogs.com/jopny/p/18410825/ddns-go_on_openwrt
頁: [1]
查看完整版本: Openwrt安装ddns-go