How to set up Dynamic DNS

One can take a common example of a DNS setup. Here the domain name is supposed as example.com. And suppose if you are having a record for server1 and server2. Suppose the server1 is being hosted on HostingRaja but the server2 is being hosted on a local network, like inside the business or a development machine in the home.

Here these types of local environments have the public IP address are dynamically assigned from the internet service provider. And this could change unexpectedly. Hence it would result in the server2 suddenly pointing to the wrong IP address which can severely affect. Here you will be shown on how to set up the dynamic DNS service, which will run on local machine and can update the record for server2 in HostingRaja DNS automatically after the public IP is changed.


Accessing to the HostingRaja account for setting up the DNS and managing the access keys.

One must have the ability to connect to the local machine which is having a dynamic IP address.


Setting up the domain to use HostingRaja DNS service

If you are not using HostingRaja DNS service for the domain name on your cloud server, this article will assist you in modifying the nameservers that need to be used in HostingRaja.

After the HostingRaja DNS has been the setup you need to go to the DNS management page which is under "Servers -> DNS -> [your domain name]".

Here you will be able to find all the records for setting up for your domain on the cloud hosting account. You need to write down which record needs to be changed as it would be required at a later part.

Here you should remember that only “A” records are supported by this utility. If you are having multiple “A” records that you would like to update to the same IP address, then you need to change them to “CNAME” records and the point them to one “A” record. Hence it will simplify the things for an individual in a long run and is considered the proper way of configuring the DNS.

 

Installation of the required tools

You need to connect to the local server. This can be done directly or through SSH.

Here the tool requires Python. Most of the distributions of Linux cloud include the Python pre-installed.

This process would also require Git.


Always use Git to clone the repository which is containing the python DDNS client. You should be performing this in a safe directory for which you are having the full access. The home folder should be sufficient for performing this action.


For generating the personal access token you need to use under "Account -> API -> Personal Access Token". Here on the same page, you will have to go under "Access Control" and then click the "Allow All IPv4" button. Since you will not be knowing the IP of the local server every time hence the point of dynamic DNS.

You can read through the config.json.example file for an example of what the configuration file will be looking like.

You need to open the config.json file by using a text editor and then you need to fill up the values based on a specific server setup.

{
"api_key": "",
"domain": "",
"dynamic_records": [
""
]

Now you need to enter the access token into the field api_key.
Now the base domain should be entered in the domain field. Like the example.com.

Now you need to input the “A” records which you would like to change the dynamic_records field. By using the previous example you would be entering the server2 for changing the server2’s IP address. You will be able to enter the multiple subdomains. If you are looking to change the base “A” record for the domain.

In the config file where you would like to dynamically change the IP for example.com and server2.example.com.


{
"api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"domain": "example.com",
"dynamic_records": [
"",
"server2"
]
}

After doing this step you will be able to save the changes and the files should be good to go.