前两天给AX86U刷了ks的merlin改,merlin修改了官方固件的DDNS功能,使其支持DDNS脚本。用起来很简单。
1. ks的merlin改是默认打开jffs和自定义脚本支持的,如果没开,就到系统设置里打开
2. 新建文件 /jfss/scripts/ddns-start ,给执行权限,至少755,写入你DDNS服务商的脚本,下面是我用的DNSimple的脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#!/bin/sh TOKEN="youroauth2token" # The API v2 OAuth token ACCOUNT_ID="123456789" # Replace with your account ID ZONE_ID="yourzoneid.com" # The zone ID is the name of the zone (or domain) RECORD_ID="123456789" # Replace with the Record ID IP=${1} curl --silent \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X "PATCH" \ -i "https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/$ZONE_ID/records/$RECORD_ID" \ -d "{\"content\":\"$IP\"}" > /dev/null if [ $? -eq 0 ]; then /sbin/ddns_custom_updated 1 else /sbin/ddns_custom_updated 0 fi |
更多的脚本例子:
https://github.com/RMerl/asuswrt-merlin.ng/wiki/DDNS-Sample-Scripts
3. WAN设置→DDNS,按照下图填,然后应用:
4. 显示注册成功的话就OK了