kkkgo / UE-DDNS

Universal Embedded DDNS Shell Script
https://blog.03k.org/post/ue-ddns.html
GNU General Public License v3.0
185 stars 17 forks source link
cloudflare cloudflare-ddns ddns dnspod dnspod-ddns godaddy godaddy-ddns shell-script

UE-DDNS

中文说明

Universal Embedded DDNS Shell Script

UE-DDNS is an embedded POSIX shell DDNS script that is designed with a modular and minimalist approach to dependencies and guided design.

Currently supported DNS service providers:

How to use

You can download the script from the following two url:
https://ddns.03k.org
https://raw.githubusercontent.com/kkkgo/UE-DDNS/main/ue-ddns.sh
You can run the following command to start :

curl -skLo ue-ddns.sh ddns.03k.org  
sh ue-ddns.sh

If curl not found, you can run:

wget --no-check-certificate https://ddns.03k.org -O ue-ddns.sh
sh ue-ddns.sh

After the script runs, a wizard will prompt you to choose your DNS service provider and choose IPV4/IPV6:

=========================================
# Universal embedded DDNS Shell Script #
# https://github.com/kkkgo/UE-DDNS
# https://blog.03k.org/post/ue-ddns.html
=========================================
[1] cloudflare
[2] dnspod
[3] godaddy
Select your DNS provider[1]:1
cloudflare DDNS:
[1] IPV4 DDNS
[2] IPV6 DDNS
IPV4/IPV6 DDNS?[1]:1

Next, according to the DNS service provider you choose, you need to provide the corresponding API Tokens, and the wizard will give a url help to apply for API Tokens. If you have more than one domain name, you will see the main domain name selection list after entering the API Tokens, followed by the sub-domain name selection list. The display effect depends on the API of the DNS service provider.

[help] https://dash.cloudflare.com/profile/api-tokens
Your cloudflare API TOKEN:***************************
[1] 03k.org
[2] example.com
Select your domain name[1]:1
Domain: 03k.org
IPV4 sub domain list:
[0] Add a new subdomain name
[1] 03k.org A 1.2.3.4
[2] office.03k.org A 5.6.7.8
[3] myhome.03k.org A 6.7.8.9
[4] www.03k.org A 1.2.3.4
Select your IPV4 subdomain name[0]:

You can directly select your subdomain name on the list to generate the DDNS script, and you can choose to use the URL to get the dynamic IP:

How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:1
DDNS script generation completed!
/root/myhome.03k.org@cloudflare_IPV4_URL.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:36 myhome.03k.org@cloudflare_IPV4_URL.sh

Or you can directly choose to specify the IP of a interface:

How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:2
[1] eth0 111.20.3.1
[2] eth1 112.30.1.4
[3] Enter the network interface manually
Please select your interface [1]
DDNS script generation completed!
/root/myhome.03k.org@cloudflare_IPV4_eth0.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:40 myhome.03k.org@cloudflare_IPV4_eth0.sh

If you choose Cloudflare, the script will also ask you if you want to enable the CDN proxy for this domain:

Turn on Cloudflare CDN proxied for myhome.03k.org?
[1]Disable
[2]Enable

In the subdomain list menu, you can also select [0] to create your new subdomain:

Select your IPV4 subdomain name[0]:0
Create New: Enter sub domain [ Like ddns ]:myhomeddns
Turn on Cloudflare CDN proxied for myhomeddns.03k.org?
[1]Disable
[2]Enable
Your choice [1]:1
How to get your new IP ?
[1]From IP-Check URL
[2]From Interface
Your choice [1]:1
DDNS script generation completed!
/root/myhomeddns.03k.org@cloudflare_IPV4_URL.sh:
-rwxrwxrwx 1 root root 12K Mar  8 18:57 myhomeddns.03k.org@cloudflare_IPV4_URL.sh

Finally, you'll get a custom DDNS script in the current directory that you can try to sh xxxx@xxx.sh to test it.
After the script is generated, you can rm ue-ddns.sh.
Depending on what DNS service provider you choose and what options you customize, the script looks like this:

2023-03-08 23:20:58 CST
URL IP : 218.56.43.21
DNS IP : 116.78.34.11
API IP : 116.78.34.11
Trying to update: myhomeddns.mytestdomain2023.com -> 218.56.43.21
Update OK: "type":"A","content":"218.56.43.21","proxiable":true,"proxied":false

How to deploy the script

Custom Options and Message Notifications

After the script is generated, you can also adjust some custom options within the generated script.(Region from # Customizable option area to # Customizable option end).
Custom options:

Message notification options:

About

License:GPLv3
Blog: https://blog.03k.org/post/ue-ddns.html