Loading 0
Share

My Blog

Scroll Down

Free dyndns (dynamic dns) with cloudflare and ddclient on ubuntu

Free dyndns (dynamic dns) with cloudflare and ddclient on ubuntu

Ok, the phase has come when you want to set up your own personal server.

You start, you proceed, you set it up, everything works and suddenly you realize that you have a DYNAMIC ip.

Don't worry, we've all been there.

What is dynamic ip?

A computer has a local address to identify it on the home/work network. This local address is of type "192.168.*.*" eg "192.168.0.7".

Another computer in the same house or a network printer or a smart tv or your mobile phone, they also have a local address, for example the mobile 192.168.0.6, the smart tv 192.168.0.9 etc.

All these devices are connected to a router which gives access to the local network inside the building and access to the global network (the internet) outside the building. The router as a device also has a local ip, usually 192.168.0.1 or 192.168.1.1 or 192.168.2.1 etc

So for the local network (inside the building) everything is fine, each device has its own IP.

But what about the global Internet network?

There only one device is allowed to have a global IP address and that is the Router (in a more understandable way), which receives the internet and forwards it to your devices. In fact the information received from the outside (to your devices) or from the inside to the outside (from your devices) is transmitted through the router.

So this public IP is one and if you want to see yours, you can visit it https://whatismyipaddress.com

What happens now if you made a local web server? (I think you know how)

The local web servers should be properly configured so that the website with the domain name (eg nikos.com) can be connected, but someone without a name could see the site simply by visiting your public IP. So instead of typing the address www.nikos.com in the address bar of the browser, type the address e.g. 5.55.43.56

But because it is not nice, for this reason in the DNS service you use, for A record nikos.com you have defined the ip of your server. And so when someone types in nikos.com it's basically like typing in ip 5.55.43.56 (more: https://el.wikipedia.org/wiki/Όνομα_τομέα)

As you understand, a necessary condition for everything to work correctly is that the public IP that your Internet provider gives you never changes. That is, it should be Static and not Dynamic (when you restart the router it changes). If it is dynamic, the name nikos.com will stop working because it will point to the old IP.

 

What if your IP is finally dynamic???

Don't worry, there is a solution.

1st) Connect your domain with the cloudflare.com service for free (from there you can also manage your domain's dns records. It also gives you free ssl)

2nd) If it has a server in Windows, e.g. Xampp etc, you can use the following program for Windows which detects every change of your public IP and automatically updates cloudflare: https://github.com/drittich/DnsTube (not I'm still working on it, I'll upload an article about it sometime)

3rd) If you have set up ubuntu server (it also applies to other Linux distributions) give the following commands and you are ready:

apt update

apt install ddclient libdata-validate-ip-perl

Dynamic DNS service provider: choose “other”.
Dynamic DNS server: Empty.
Dynamic DNS update protocol: select “dyndns2”.
Username for dynamic DNS service: Empty.
Password for dynamic DNS service: Empty.
Re-enter password to verify: Empty.
Network interface used for dynamic DNS service: Empty.
DynDNS fully qualified domain names: Empty

dpkg-reconfigure ddclient

Choose the same again and when the following comes up, this time choose:

Run ddclient on PPP connect?: “No”.
Run ddclient as a daemon: select “Yes”.
Interval between ddclient runs: “300”.

 

wget https://sourceforge.net/projects/ddclient/files/ddclient/ddclient-3.9.1/ddclient-3.9.1.tar.gz

 

 

 

tar -xvf ddclient-3.9.1.tar.gz

 

 

cp -f ddclient-3.9.0/ddclient /usr/sbin/ddclient

 

 

mkdir /etc/ddclient

 

 

mv /etc/ddclient.conf /etc/ddclient

 

 

rm ddclient-3.9.0.tar.gz

 

 

 

rm -R ddclient-3.9.0

 

 

Finally ddclient settings:

 

nano /etc/ddclient/ddclient.conf

 

delete everything inside and put:

daemon=300
ssl=yes
protocol=cloudflare
use=web
login=<span style="color: rgb(255, 0, 0);" data-mce-style="color: #ff0000;">YOUR-CLOUDFLARE-EMAIL</span>
password=<span style="color: rgb(255, 0, 0);" data-mce-style="color: #ff0000;">YOUR-CLOUDFLARE-API-KEY</span>
zone=nikos.com<span style="color: rgb(255, 0, 0);" data-mce-style="color: #ff0000;">(it's the main domain, it doesn't change here)</span>
nikos.com<span style="color: rgb(255, 0, 0);" data-mce-style="color: #ff0000;">(here it changes, you could put a subdomain, so that the main one doesn't change)</span>

When you're done, press CTRL+X and Y and Enter to save it.

Finally do a refresh test by running the following command: ddclient -daemon=0 -verbose -noquiet

 

For more help write below and I will reply 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

01.

Here you can see all the services I provide

Registration and management of domain names (website address such as www.nicolaslagios.com)

Also management of dns records (e.g. connecting the domain to a specific server, fixing email spam problems, etc.)

Also ssl renewals etc

Installation and management of web & mail server in ubuntu vps with virtualmin, plesk, cpanel

Also studying and fixing server problems.

Necessary condition, the target server meets the conditions

At the moment for new wordpress websites you can choose from ready-made themes and we change the content (no custom changes). You can buy with a fixed price by clicking here!

My team and I undertake any data bridging implementation for Wordpress, Prestashop, Opencart, Joomla platforms.

We can connect data from any source, as long as the structure is stable and there is proper documentation and briefing.

We undertake the creation, regulation and enrichment of pages for social networks: Facebook, Linkedin, Instagram (profile), Twitter (profile), Tiktok (profile).

We also undertake the first boost of your pages for quick results in followers.

We undertake the repair and maintenance of your existing wordpress website.

For more information about the services, you can read the following and return here to schedule a meeting with me: https://maxservices.gr/en/internet-services/website-services-blank/additional-website-services/