linux 配置阿里云ddns


阅读量9

通过github进行下载:https://github.com/NewFuture/DDNS

步骤

  1. 去阿里云控制台增加accesskey配置:https://help.aliyun.com/document_detail/28637.html

  2. 上传文件到服务器

  3. 修改文件执行权限

    $ chmod 777 create-task.sh $ chmod 777 ddns
  4. 初次运行

    $ ./ddns -c config.json ddns.czbiao.com(A) ==> 219.137.66.60 [via DIRECT]
  5. 执行命令创建定时任务

    $ bash create-task.sh [ ok ] Reloading configuration files for periodic command scheduler: cron.

配置

config.json 的配置,ipv4是要设置解析的域名。

{ "$schema": "https://ddns.newfuture.cc/schema/v2.8.json", "debug": false, "dns": "alidns", "id": "阿里云RAM的AccessKey", "index4": "url:http://ip.sb", "index6": "default", "ipv4": [ "要进行解析的完整域名" ], "ipv6": [], "proxy": null, "token": "阿里云RAM的AccessKeySecret", "ttl": null }

create-task.sh

#!/usr/bin/env bash RUN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; CMD="\"$RUN_DIR/ddns\" -c \"$RUN_DIR/config.json\" >> \"$RUN_DIR/run.log\""; echo "*/5 * * * * root $CMD" > /etc/cron.d/ddns; /etc/init.d/cron reload;

czbiao 2021年5月19日 20:31 收藏文档
本站总访问量11413
本站访客数10330人次