Cfddns: Difference between revisions

From Coolscript
Jump to navigation Jump to search
No edit summary
Line 3: Line 3:
This can be compared with http://no-ip.org or http://dyndns.com with the diffrence that you renew the ip address of your own (sub) domain.<br>
This can be compared with http://no-ip.org or http://dyndns.com with the diffrence that you renew the ip address of your own (sub) domain.<br>
CFDDNS updates IP 4 or 6 automatically depending on the query host (what is my ip?)<br>
CFDDNS updates IP 4 or 6 automatically depending on the query host (what is my ip?)<br>
The script is written in Perl and has been tested on Windows 10/2016 and Debian 10.
<br>'''Scrpts are available for Perl (5) , Powershell (5/7) or Python (3).'''<br><br>
Testet on Windows 10/2016 (cfddns.ps1, cfddns.pl, cfddns.py) and Debian 10/11 (cfddns.pl, cfddns.py).
<br><br>
<br><br>


Line 14: Line 15:
<br><br>
<br><br>


=Installation=
=Installation (Perl only)=
*Get the script and configuration (Link below) and copy / unzip to a directory of your choice
*Get the script and configuration (Link below) and copy / unzip to a directory of your choice
==Windows==
==Windows==
Line 34: Line 35:
     FQDN="my.domain.com"  
     FQDN="my.domain.com"  
     AuthMail="mail@domain.com"
     AuthMail="mail@domain.com"
     IPInfo="http://your-ip-info-url.something"
     IPInfo="https://ifconfig.io/ip"
    TTL="300"
    PROXIED="false"
   />
   />
  </CONFIG>
  </CONFIG>
Line 44: Line 47:
===Windows===
===Windows===
  c:\myPath > perl cfddns.pl
  c:\myPath > perl cfddns.pl
c:\myPath > powershell -file cfddns.ps1


===Linux===
===Linux===
  ~ # ./cfddns.pl
  ~ # ./cfddns.pl
 
~ # perl cfddns.pl
~ # ./cfddns.py
~ # python3 cfddns.py


=Notes with InfoURL=
=Notes with InfoURL=
An InfoURL is needed to get your actual IP which is then compared with the Cloudflare setup.<br>
An InfoURL is needed to get your actual IP which is then compared with the Cloudflare setup.<br>
Typical services to get IP 4 addresses are  
Th default is https://ifconfig.io/ip <br>
Alternative services to get IP 4 addresses are  
*http://ipconfig.io
*http://ipconfig.io
*http://ifconfig.me
*http://ifconfig.me
Line 68: Line 75:


==Startup with customized configuration==
==Startup with customized configuration==
Perl only<br>
Configuration file is specified with '''-c '''
Configuration file is specified with '''-c '''
  ~ # ./cfddns.pl -c /path/to/config.xml
  ~ # ./cfddns.pl -c /path/to/config.xml
Line 81: Line 89:
|style="width:10%; vertical-align: top;"|
|style="width:10%; vertical-align: top;"|
'''Download CFDDNS'''<br>
'''Download CFDDNS'''<br>
[[File:Download.png|60px|link=http://coolscript.org/download/scripts/cfddns.zip|Download]]
[[File:Download.png|60px|link=http://coolscript.org/download/cfddns.zip|Download]]
<br>
<br>
|style="width:90%; vertical-align: top;"|
|style="width:90%; vertical-align: top;"|

Revision as of 13:02, 4 March 2022

Why CFDDNS

Cloudflare DynDNS (CFDDNS) is a tiny script which allows you to update your DNS record on Cloudflare.
This can be compared with http://no-ip.org or http://dyndns.com with the diffrence that you renew the ip address of your own (sub) domain.
CFDDNS updates IP 4 or 6 automatically depending on the query host (what is my ip?)

Scrpts are available for Perl (5) , Powershell (5/7) or Python (3).

Testet on Windows 10/2016 (cfddns.ps1, cfddns.pl, cfddns.py) and Debian 10/11 (cfddns.pl, cfddns.py).

Requirements

  • Cloudflare account with an associate domain on it (The free account can do it)
  • Cloudflare API Key
  • Cloudflare registered email account
  • Owner of a registered Domain not necessarily on Cloudflare but served with Cloudflare
  • Windows Server 2016 or higher or Windows 10 or Debian/Ubuntu



Installation (Perl only)

  • Get the script and configuration (Link below) and copy / unzip to a directory of your choice

Windows

> cpan -i Net::IP

Linux

  • Debian/Ubuntu - Perl is already installed
  • Get additional modules - run:
# apt-get install libwww-perl libjson-perl libxml-simple-perl  libnet-ip-perl

Configuration

<?xml version="1.0"?>
<CONFIG>
 <Settings 
   APIKey="Your API Key goes here" 
   ZoneID="Your Zone ID goes here" 
   FQDN="my.domain.com" 
   AuthMail="mail@domain.com"
   IPInfo="https://ifconfig.io/ip"
   TTL="300"
   PROXIED="false"
 />
</CONFIG>

Startup

There are two ways to start

Startup with the default configuration

cfddns.xml is omited within the application directory

Windows

c:\myPath > perl cfddns.pl
c:\myPath > powershell -file cfddns.ps1

Linux

~ # ./cfddns.pl
~ # perl cfddns.pl
~ # ./cfddns.py
~ # python3 cfddns.py

Notes with InfoURL

An InfoURL is needed to get your actual IP which is then compared with the Cloudflare setup.
Th default is https://ifconfig.io/ip
Alternative services to get IP 4 addresses are


InfoURL together with IP 6 might be tricky because the FQDN might need to enforce this, a possible solution for IP6/4 can be:



Params

  • -c Optional path to configuration
  • -v Be verbose
  • -h Display help

Startup with customized configuration

Perl only
Configuration file is specified with -c

~ # ./cfddns.pl -c /path/to/config.xml

Crontab samples

  • Run all 5 minutes
*/5 * * * * (cd /patth/to/script/; ./cfddns.pl)

OR

*/5 * * * * /path/to/scrip/cfddns.pl -c /path/to/config/config.xml

Download

Download CFDDNS
Download