5

cloudflare|一键DDNS脚本|越南老哥出品

 1 year ago
source link: https://vpsxb.net/4638/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

cloudflare|一键DDNS脚本|越南老哥出品 | VPS小白

> 实用教程 > cloudflare|一键DDNS脚本|越南老哥出品
202206191902179.png

今天刚好在跟群里的某位越南老哥聊天,说他有个家宽,定期会换IP,问我怎么搞方便些,我让他去搞个DDNS解析。便把大佬的DDNS脚本发他。

202306171720892.png

他用爽了,问我有没有一键脚本,说很方便,我倒是想写,但是小白我特么不会啊,没想到老哥效率如此之高……

202306171721719.png

顺便还加了定时任务:

202306171722937.png

我给他整理了下,使用如下

创建 Cloudflare API 令牌,请转到 https://dash.cloudflare.com/profile/api-tokens 并按照以下步骤操作:

  1. 单击创建令牌
  2. 为令牌提供一个名称,例如,cloudflare-ddns
  3. 授予令牌以下权限:
    • 区域 – 区域 – 读取
    • 区域 – 区域设置 – 读取
    • 区域 – DNS – 编辑
  4. 将区域资源设置为:
    • 包括 – 特定区域 – 选择你想设置的域名

202306171731477.png


  1. wget https://raw.githubusercontent.com/jamespan2012/myshellscripts/main/cf.sh -O cf.sh
  2. bash cf.sh
  3. #如果需要立马更新一次IP,请手动执行脚本:
  4. bash cf-v4-ddns.sh
202306171729918.png

该脚本依托的是:https://github.com/aipeach/cloudflare-api-v4-ddns 这个项目,作者将原作者的调用全局api换成了调用更为安全的区域api。

作者的脚本中存在两个CFKEY字段,sed替换时会出现问题,所以越南老哥稍微改了下:

202306171733488.png

又水完一篇博客,留下了没有技术的泪水。


VPS小白 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK