2020-04-10 10:12:32 +08:00
|
|
|
Cloudflare API v4 Dynamic DNS Update in Bash, without unnecessary requests
|
2021-10-21 18:44:45 +08:00
|
|
|
Now the script also supports v6(AAAA DDNS Recoards)
|
|
|
|
|
2021-11-13 14:06:50 +08:00
|
|
|
----
|
|
|
|
|
|
|
|
创建 Cloudflare API 令牌,请转到 https://dash.cloudflare.com/profile/api-tokens 并按照以下步骤操作:
|
|
|
|
|
|
|
|
1. 单击创建令牌
|
|
|
|
2. 为令牌提供一个名称,例如,`cloudflare-ddns`
|
|
|
|
3. 授予令牌以下权限:
|
|
|
|
* 区域 - 区域 - 读取
|
|
|
|
* 区域 - 区域设置 - 读取
|
|
|
|
* 区域 - DNS - 编辑
|
|
|
|
4. 将区域资源设置为:
|
|
|
|
* 包括 - 特定区域 - 选择你想设置的域名
|
|
|
|
|
|
|
|
----
|
|
|
|
![image.png](https://i.loli.net/2021/11/13/OMpjhUyubrwN6Lk.png)
|
|
|
|
|
2021-10-21 18:44:45 +08:00
|
|
|
```
|
|
|
|
bash <(curl -Ls https://git.io/cloudflare-ddns) -k cloudflare-api-key \
|
|
|
|
-h host.example.com \ # fqdn of the record you want to update
|
|
|
|
-z example.com \ # will show you all zones if forgot, but you need this
|
|
|
|
-t A|AAAA # specify ipv4/ipv6, default: ipv4
|
|
|
|
```
|