• Stars
    star
    265
  • Rank 153,770 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An implementation of DDNS with Python and Aliyun API 利用Python+阿里云云解析API实现DDNS

DDNS

中文|English

Summary

Python and Aliyun SDK API have been used in this project. You can use this tool to map the local applications like NAS, DB, WEB etc to the internet.

Install

pip3 install aliyun-python-sdk-core-v3

Run

python3 src/DDNS.py      # default ipv4
python3 src/DDNS.py -6   # change to ipv6

Note

  • Based on Python3、Aliyun API.
  • To begin, you can run the main function in DDNS.py. The main function in other .py files are for the test purpose.
  • You can set this script as a timer task in your opening system. For example, running this script at 4:30am everyday or when connecting to the internet.
  • On the dev branch, this project supports binding multiple domains to the same ip address.
  • If you use iPv4, please make sure that the record type of your domain which will be used is A. If you use iPv6, the type is AAAA.
  • This script is my idea for implementing DDNS.

Restrict

This script is suitable for the broadband which has a dynamic IP. If not, you can try NAT-DDNS tools like frp.

Configuration

The config.json has some infomation you should provide. The config structure may like this:

{
    "AccessKeyId": "Your_AccessKeyId",//Your Aliyun AccessKeyId
    "AccessKeySecret": "Your_AccessKeySecret",//Your Aliyun AccessKeySecret
    "First-level-domain": "Your_First-level-domain",//First level domain, eg example.com
    "Second-level-domain": "Your_Second-level-domain"//Second level domain, eg ddns.example.com Just input ddns
}

Tip

How to determine wether your broadband service has a dynamic IP.

  • Step 1:Find your WAN IP by google or other tools.
  • Step 2:Run a web service locally. For example, starting IIS in Windows or Apache in Linux and using their default webpage.
  • Step 3: Set the map rules in your home router. The ports which you will use to access the local service over internet had better not to be 80 beacuse the 80 port may be blocked by your internet service provider.
  • Step 4: Use the IP you fond by google and the port to access your local web service. If ok, congratulations!

ScreenShots

NOTE: Because I have updated before, the script tells me the DNS record has already exists. Aliyun does not allow users to update the same IP when the IP has not been changed. The second picture shows the local service. The Third one shows accessing local service over internet under the help of DDNS.

Change Log

  • 2018/5/29 Add detecting internet access.
  • 2018/6/10 Start using configuration file.
  • 2018/9/24 Improve the error output
  • 2018/12/24 Improve the way to get IP, deleteing BS4 dependence. Thanks @Nielamu.
  • 2018/12/27 Support ipv6. Thanks @chnlkw.
  • 2020/05/05 Improve the policy of getting ipv4 address. Once failed, it will write into the log and retry with new method after 10 sec. Thanks @sunsheho.

Contribution

If you interest in this project and want to improve it, welcome to fork the project. Have any questions? you can ask in issue~

More Repositories

1

FG

基于Nonebot的QQ群机器人🤖️,特色功能是利用机器学习算法,基于每日聊天记录生成每日总结。可在酷Q/Mirai平台上运行
Python
101
star
2

CampusScoreManager

学生信息管理系统--JavaWeb课程设计作品
Java
87
star
3

Venus

一个基于Python的TCP内网穿透工具,支持向公网投射内网应用(实验,建议尝试dev分支)
Python
27
star
4

Mercury

一个简单跨平台的局域网P2P文件传输工具 A simple cross platform P2P file transfer tool over Ethernet
Python
18
star
5

FG-plugin

基于Nonebot2的QQ群机器人🤖️插件,特色功能是利用机器学习算法,基于每日聊天记录生成每日总结。
Python
15
star
6

OpenLayers3Demo

OpenLayers3的演示,主要功能是显示由GeoWebCache缓存的瓦片地图,并在地图上显示标记,于此同时在点击标记后会有一个弹出框(OpenLayers基于3.13.1)
JavaScript
15
star
7

v2rayWebSwitch

Change your v2ray Server/Client status from your web broswer.
PHP
3
star
8

SRGenius

该小程序能够在程序能够检测到的活动IP地址范围内进行批量的关机、重启,或者对特定IP地址进行关机、重启。
C#
3
star
9

ScoreHelper

获取三明学院教务系统学生在校成绩的脚本,只要学校不更新教务系统,长期有效。目前针对Windows开发,后续增进Linux支持
Python
3
star
10

aboutSpring

something relates to Spring framework
Java
2
star
11

WebStackDemo

Providing a simple way to achieve the goBack & goForward functions we used in our browser without calling webView functions like webView.goBack in Android.
Java
2
star
12

LoginDelay

A demo about interceptors mechanism in Structs2
Java
1
star
13

spring-boot-starter-thrift

Apache Thrift SpringBoot启动器
Java
1
star
14

SimpleWeatherForcast

2016厦门实训结课项目,获团队一等奖
JavaScript
1
star
15

WinInfoReader

使用Python编写的查看Windows系统CPU、安装内存大小(GB)、硬盘类型、本地硬盘大小(GB)、显卡型号以及显存(GB)的一个GUI小脚本程序。
Python
1
star