SuperAPI AI Directory

ipv6-ddns-aliyun

Deployment & operations

View repository

Updated 10-16 09:40

About this skill

Capability Overview

This Skill implements a complete IPv6 DDNS (Dynamic Domain Name Resolution) solution, automatically syncing the public IPv6 address obtained by the local machine to Alibaba Cloud DNS.

Workflow

┌─────────────────────────────────────────────────────────────┐
│ 1. 检测本机公网 IPv6 地址                                    │
│    - 过滤 fe80::/10 (链路本地)                               │
│    - 过滤 ::1/128 (回环地址)                                 │
│    - 筛选出公网可路由的 IPv6 地址                             │
│    - 验证公网可达性:                                         │
│      * 通过 curl 6.ipw.cn 获取出口 IPv6 地址                 │
│      * 与本机网卡 IPv6 地址比对                               │
│      * 如匹配成功,确认为公网地址                             │
│    - 如无公网 IPv6,报错退出                                 │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│ 2. 检查 aliyun-domain-skill 依赖                             │
│    - 检查本地是否存在 domain/SKILL.md                       │
│    - 如不存在,执行安装命令:                                 │
│      npx skills add shigzz/aliyun-skills --skill aliyun-domain-skill
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│ 3. 读取或询问 DDNS 配置                                       │
│    - 检查当前目录 .aliyun-config.json                       │
│    - 如有配置且用户确认,直接使用                            │
│    - 如无配置,交互式询问:                                   │
│      * 根域名 (如 example.com)                               │
│      * 主机记录 (如 ddns 或 @)                                │
│      * TTL (默认 60 秒)                                      │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│ 4. 验证域名归属                                               │
│    - 通过 aliyun-domain-skill 查询账号域名列表                │
│    - 确认用户指定的根域名在列表中                             │
│    - 如不存在,提示用户先去阿里云注册域名                      │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│ 5. 查询现有 AAAA 记录                                         │
│    - 通过 aliyun-domain-skill 查询域名解析记录                │
│    - 筛选 Type=AAAA, RR=主机记录 的记录                       │
│    - 获取记录 ID 和当前 IP 值                                 │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│ 6. 更新或新增解析记录                                         │
│    - 如现有记录 IP == 本机 IPv6:提示无需更新,退出           │
│    - 如存在记录但 IP 不同:更新记录                           │
│    - 如不存在记录:新增 AAAA 记录                             │
│    - 更新成功后保存配置到 .aliyun-config.json                │
└─────────────────────────────────────────────────────────────┘

Dependency Description

This Skill depends on the domain management capabilities provided by aliyun-domain-skill :

  • Query the account's domain list
  • Manage DNS resolution records (query, add, modify AAAA records)

If not installed, run:

npx skills add shigzz/aliyun-skills --skill aliyun-domain-skill

Configuration Storage

The DDNS configuration is saved inthe current working directory's .aliyun-config.json, supporting two formats:

Single-project configuration (object format)

{
  "version": 1,
  "ddns": {
    "domain_name": "example.com",
    "rr": "ddns",
    "ttl": 60,
    "record_id": "12345678901234567",
    "last_ip": "2408:4002:1c2f:8d00::1",
    "last_update": "2026-03-28T15:30:00+08:00"
  }
}

Multi-project configuration (array format)

Supports managing multiple DDNS configurations in the same repository (such as multiple domains or multiple hosts):

[
  {
    "project": "nas-home",
    "version": 1,
    "ddns": {
      "domain_name": "example.com",
      "rr": "nas",
      "ttl": 60,
      "record_id": "12345678901234567",
      "last_ip": "2408:4002:1c2f:8d00::1",
      "last_update": "2026-03-28T15:30:00+08:00"
    }
  },
  {
    "project": "router-office",
    "version": 1,
    "ddns": {
      "domain_name": "company.com",
      "rr": "router",
      "ttl": 60,
      "record_id": "98765432109876543",
      "last_ip": "2408:4002:1c2f:8e00::1",
      "last_update": "2026-03-28T10:00:00+08:00"
    }
  }
]

Field Description:

Field Type Required Description
project string Required for multi-project Project identifier name, used to distinguish different configurations
version int Yes Configuration format version, currently 1
ddns.domain_name string Yes Root domain, used for DNS resolution
ddns.rr string Yes Host record, such as ddns or @
ddns.ttl int No DNS record TTL, default 60 seconds
ddns.record_id string No Alibaba Cloud DNS record ID
ddns.last_ip string No The IP address of the last update
ddns.last_update string No Last update time in ISO 8601 format

Configuration Reuse

  • Object format: If the configuration exists and the fields are complete, it can be reused directly this time without asking again
  • Array format: Prompt the user to select the project to use (distinguished by the project field), and after selection only update that project's configuration

If the user requests to change the domain or host record, or add a new project configuration, re-confirm through interaction.

Pre-checks

1. Alibaba Cloud Credentials

An Alibaba Cloud AccessKey is required. For configuration methods, see aliyun-domain-skill:

Environment variable method (recommended):

export ALIBABA_CLOUD_ACCESS_KEY_ID="your-access-key-id"
export ALIBABA_CLOUD_ACCESS_KEY_SECRET="your-access-key-secret"

.env file method:

cp .env.example .env
# 编辑 .env 填入凭证

Usage

Invoke as a Claude Code Skill

设置本机的 IPv6 DDNS
更新我的 DDNS 记录

Error Handling

Error Scenario Handling Method
No public IPv6 Exit and prompt the user to check the network configuration
aliyun-domain-skill not installed Prompt the user to install the dependency skill
Domain does not exist in the account Prompt the user to register a domain with Alibaba Cloud
Insufficient DNS operation permissions Prompt the user to configure RAM permissions and retry

Notes

  1. IPv6 Requirement: The local machine must have a publicly routable IPv6 address (not a link-local address starting with fe80::)
  2. Public Network Verification: Obtained via curl 6.ipw.cn the egress IPv6, compared with the local network interface address, to confirm the address is publicly reachable
  3. TTL Settings: It is recommended to set it to 60 seconds so that changes take effect quickly when the IP changes
  4. Domain Ownership: The domain must be under the current Alibaba Cloud account and use Alibaba Cloud DNS
  5. First-time Configuration: The first run requires interactive input of the domain and host record; subsequently it can be read from .aliyun-config.json Read
  6. Multiple IPv6 Addresses: If the local machine has multiple public IPv6 addresses, the first one is used by default