Use AliDDNS to deploy fixed domain names for dynamic IP VPS/NAT VPS

888u

Last update at :2024-06-03,Edit by888u

The AliDDNS tool is a DDNS domain name update tool based on Alibaba Cloud Cloud Resolution API. By executing the script, the domain name record on Alibaba Cloud Cloud Resolution can be quickly updated to achieve the effect of a dynamic domain name. In addition, it is introduced: Using CloudFlare API to deploy fixed domain names for dynamic IP VPS/NAT VPS, CF is recommended, it is easier!

The following is the installation and usage instructions. 1. First, install the dependencies: For CentOS:

yum install -y wget curl cronie

For Debian 8+:

apt install -y wget curl cron

For Ubuntu/Debian 7:

apt-get install -y wget curl cron

2. Download the script, execute and install:

wget -O /usr/sbin/AliDDNS.sh https://we.com/wp-content/uploads/2018/07/AliDDNS-v2.0.sh chmod +x /usr/sbin/AliDDNS-v2.0.sh /usr/sbin/AliDDNS-v2.0.sh

Pop up the boot menu:

AliDDNS tool (Alibaba Cloud analysis and modification tool) Usage: AliDDNS.sh run configures and runs the tool (if configured, it will be run directly) AliDDNS.sh config configuration tool only AliDDNS.sh clean cleans configuration files and operating environment AliDDNS.sh version displays version information [Info] Select the function you want to use: Configure and run AliDDNS Configure AliDDNS only Clean up the environment quit Enter numbers to select: _

Here, we enter 1 (number 1) and press Enter to start entering the AliDDNS configuration wizard:

[Info] Please enter the first-level domain name (such as example.com) (This item must be filled in, please enter "h" to view help):

If you need to set the domain name of AliDDNS to ddns.example.com, please enter example.com here

The decomposition is [ddns] . [example.com]

At the same time, log in to Alibaba Cloud Cloud Resolution https://dns.console.aliyun.com/, and add a record to the domain name that requires DDNS:

Record type: A Host record: [please fill in your second-level domain name] Parse lines: default Record value: 127.0.0.1 (or fill in any IP address) TTL: [Please choose the appropriate TTL according to actual needs] Sync default line: Yes (checked)

When finished, press Enter and continue filling in the second-level domain name:

[Info] Please enter the second-level domain name (such as ddns) (This item must be filled in, please enter "h" to view help):

Same as the above example, we enter ddns and then press Enter to continue:

[Info] Please enter the TTL (Time-To-Live) value of the record: (The default is 600, please enter "h" to view help):

If you are using the free version of Alibaba Cloud Cloud Analytics, the value range that can be filled in here is: 600~86400; if you are using the paid version (enterprise version) of Alibaba Cloud Cloud Analytics, the value range that can be filled in here is The range is: 1~86400 (depending on the type of product you purchase).

After filling in, press Enter to continue:

[Info] Please enter Alibaba Cloud AccessKey ID (This item must be filled in, please enter "h" to view help):

AccessKey ID and AccessKey Secret are recommended to use the permissions assigned by the sub-user AccessKey (access console RAM)! This is the safest!

To use the sub-user AccessKey, please assign the two permissions AliyunDNSReadOnlyAccess (read-only access to cloud resolution (DNS)) and AliyunDNSFullAccess (authority to manage cloud resolution (DNS))! It is recommended that users with hands-on skills use the sub-user AccessKey!

If you don’t know how to operate or want to save trouble, please use global AccessKey! But you must pay attention at this time! Never disclose your global AccessKey or publish your global AccessKey on the public Internet! This is equivalent to giving away your account to others, and you can also legitimately use your Alibaba Cloud account for free! If a leak occurs, please delete the leaked AccessKey immediately!

After filling in, press Enter to continue:

[Info] Please enter Alibaba Cloud Access Key Secret (This item must be filled in, please enter "h" to view help):

Same as above, fill in the AccessKey Secret corresponding to your AccessKey ID. Obtaining your AccessKey Secret is a high-risk account operation. Please prepare your mobile phone to receive the Alibaba Cloud verification code!

After completing the filling, the new version of AliDDNS 2.0 will directly enter the execution process if the expert mode is not activated; if the expert mode is activated, please fill in the following parameters based on your understanding! Otherwise, please leave it blank!

[Info] Please enter the command to obtain the local IP (Please enter "h" to view help):

Enter the command used to obtain the IP address of this machine. If you don’t understand or don’t need to configure it, please leave it blank and press enter!

[Info] Please enter the DNS server used for resolution (This item must be filled in, please enter "h" to view help):

Enter the nslookup command to resolve the DNS server used. If you don’t understand or don’t need to configure it, please leave it blank and press enter!

After that, the DDNS (test) running process will automatically start:

[Info] Detect existing configuration and automatically read the existing configuration. If you don’t need it, please clear it through the clean environment option in the menu

[Info] Writing configuration file... [Info] Obtaining local IP... [Info] Local IP:... [Info] Obtaining the IP of ddns.example.com... [Info] Parsing result: ddns.example.com -> 127.0.0.1 [Info] Generating timestamp... [Info] Obtained RecordID: * [Info] Updating parsing records... {"RecordId":"","RequestId":"----"} [Info] RecordID has been updated: * [Success] The DDNS record is updated successfully, the new IP is:...

The last DDNS record update successful prompt appears, which means the DDNS record synchronization is successful. Wait for the DNS resolution to take effect later to complete the DDNS domain name change!

  • Crontab (scheduled task) deployment tutorial First, execute the command on the command line:
  • crontab -e

    A prompt will pop up asking which editor to choose. Please choose a text editor according to your preference:

    Select an editor. To change later, run 'select-editor'. /bin/nano /dev/null 2>&1 &

    After adding, save and exit.

    When prompted with crontab: installing new crontab, it means that the crontab was written successfully. Execute the command to restart the cron process:

    For CentOS:

    servicecrond restart

    For Ubuntu/Debian:

    service cron restart

    And add Cron to the startup items:

    For CentOS:

    chkconfig crond on

    For Ubuntu/Debian:

    systemctl enable cron

    The deployment of scheduled tasks can be completed.

    The full text of this article is reproduced from: https://blog.ilemonrain.com/linux/aliddns-v2.html Original code: https://github.com/kyriosli/koolshare-aliddns/tree/master/aliddns

    Recommended site searches: virtual host application, domain name check, server purchase, domain name registration, monthly payment space, latest free proxy IP, telecom host rental, free server website, registered domain name, mainland China virtual host,

    Use AliDDNS to deploy fixed domain names for dynamic IP VPS/NAT VPS

    All copyrights belong to 888u unless special state
    取消
    微信二维码
    微信二维码
    支付宝二维码