Sunday, September 8, 2024
HomeTECHNOLOGY TIPSHow to install DDNS on Raspberry Pi with Cloudflare API?

How to install DDNS on Raspberry Pi with Cloudflare API?

* Requires utensils to perform:
  • 1 Computer running Linux and capable of being maintained 24/24 and connected to your home network. It is recommended to use Raspberry Pi because its hardware is capable of running 24/7
  • 1 domain name that is not a Free domain name (domain name ending in .tk, .ml, .ga, .cf, .gq)
  • 1 CloudFlare account.

1. Instructions for making a DDNS client on Raspberry Pi?

Step 1: After you have finished pointing DNS, go to terminal and write the following command:

git clone https://github.com/K0p1-Git/cloudflare-ddns-updater.git

Step 2: Go to that directory using the command

cd cloudflare-ddns-updater

Step 3: You rename the file by

mv cloudflare-template.sh cloudflare.sh

From this point forward, the file I will use will be under the file name I just set. If you set it differently, remember to change the name back in the command!

Step 4: Edit the Cloudflare.sh file

sudo nano Cloudflare.sh

Step 5: Replace the following information in the file

Note: replace it between quotation marks

  • auth_email: enter the email you registered with Cloudflare
  • Auth_key: Enter API token (See how to get API token and Zone ID below)
  • Zone_identifier: Enter the Zone Identifier (In the How to get API token and Zone ID section below)
  • Record_name: enter your record name. it will be of the form record name.yourdomainname

Step 6: Press Ctrl + x > press y > press enter to save the file

2. Get API and Token Zone

Step 1: Go to https://dash.cloudflare.com/

Step 2: Choose your domain name

Step 3: Scroll down and you will see Zone ID in the API section. Take it and copy it to your SH file

Step 4: Go to Get Your API token

Step 5: In the Global API key section, click view. After completing the captcha, take that key and copy it to step 5 of the basic setup section

3. Set up time to run script

Step 1: Go to Terminal and type

Crontab -e

Step 2: You choose your editor. Whichever one you choose, just write down its number!

Step 3: Write the following command

* * * * * /bin/bash [Cloudflare.sh file location]

The stars are equivalent to 1 date and time unit and you just need to change the stars to numbers. Their order is: minute > hour > day > month > day of the week (from Monday to Sunday)

Step 4: Press Ctrl + x > press y > press enter to save the file.

Step 5: Run the following command to boot

systemctl restart cron

0/5 (0 Reviews)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Advertisingspot_img

Popular posts

My favorites

I'm social

0FansLike
0FollowersFollow
0FollowersFollow
0SubscribersSubscribe