https://github.com/NewFuture/DDNS

安装

  1. pip install ddns
  1. su root
  2. mkdir ddns
  3. cd ddns
  4. vim config.json
  5. {
  6. "$schema": "https://ddns.newfuture.cc/schema/v2.8.json",
  7. "debug": false,
  8. "dns": "alidns",
  9. "id": "xxx",
  10. "index4": "public",
  11. "index6": "default",
  12. "ipv4": [
  13. "jump.itnzm.top"
  14. ],
  15. "ipv6": [
  16. ],
  17. "proxy": null,
  18. "token": "imDbtby3b5iUZIt2El1xAPpwPLvvjg",
  19. "ttl": null
  20. }

阿里云需要为创建的RAM 用户授权

自启动

  1. vim autostart.sh
  2. #!/bin/sh
  3. source /etc/profile
  4. ddns -c /root/ddns/config.json
  5. chmod +x ./autostart.sh
  1. vim /usr/lib/systemd/system/ddns.service
  2. [Unit]
  3. Description=ddns
  4. After=network.target
  5. [Service]
  6. Type=forking
  7. ExecStart=/root/ddns/autostart.sh
  8. PrivateTmp=true
  9. [Install]
  10. WantedBy=multi-user.target
  11. chmod 755 /usr/lib/systemd/system/ddns.service
  12. systemctl daemon-reload
  13. systemctl enable ddns.service

定时更新

参考:https://blog.csdn.net/weixin_41558061/article/details/80268639

  1. crontab -e
  2. */5 * * * * ddns -c "/root/ddns/config.json" >> "/root/ddns/run.log"
  3. systemctl reload crond.service