2024-03-07
瞎折腾
00
请注意,本文编写于 72 天前,最后修改于 26 天前,其中某些信息可能已经过时。

目录

1. 安装 docker
2. 使用docker-compose
3. cloudflare创建api token
4. 修改ddclient配置

记录使用ddclient配置ddns的方法

1. 安装 docker

目前很多发行版自带的ddclient包版本都太老了,而ddclient又是c语言写的安装比较麻烦,用docker是最方便的,如果机器内存很少可以试下nerdctl

2. 使用docker-compose

docker-compose.yaml

yaml
--- services: ddclient: image: lscr.io/linuxserver/ddclient:latest container_name: ddclient environment: - PUID=1000 - PGID=1000 - TZ=Asia/Hong_Kong volumes: - /root/ddclient/config:/config restart: unless-stopped

docker compose up -d启动

3. cloudflare创建api token

待补充

4. 修改ddclient配置

/root/ddclient/config/ddclient.conf

conf
daemon=120 # check every 300 seconds syslog=yes # log update msgs to syslog #mail=root # mail all msgs to root #mail-failure=root # mail failed update msgs to root pid=/var/run/ddclient/ddclient.pid # record PID in file. ssl=yes # use ssl-support. Works with # ssl-library use=web, web='https://cloudflare.com/cdn-cgi/trace', web-skip='ip=' # found after IP Address ## ## CloudFlare (www.cloudflare.com) ## protocol=cloudflare zone=your.domain ttl=1 login=token # Only needed if you are using your global API key. If you are using an API token, set it to "token" (wihtout double quotes). password=your_token # This is either your global API key, or an API token. If you are using an API token, it must have the permissions "Zone - DNS - Edit" and "Zone - Zone - Read". The Zone resources must be "Include - All zones". sub.your.domain

修改后重启服务

docker compose down
docker compose up -d

本文作者:renbear

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC 2.0 许可协议。转载请注明出处!