Skip to main content
  1. Posts/

Domain & DDNS

·636 words·3 mins
CoeusLabs
Author
CoeusLabs
Passionate self-hosting enthusiast sharing insights and experiences in homelab deployment and Linux. Not a professional, but always eager to learn and help others.
Table of Contents

What is a domain and why do we need it?
#

A domain is a unique name that identifies a website on the internet, such as example.com. It serves as a human-readable address, allowing users to access websites without needing to remember numerical IP addresses. Domains are essential for establishing an online presence, making it easier for people to find and remember your site. Additionally, if you want to access your server from outside your network, a domain is necessary, but we’ll discuss that in more detail later.

Registering a domain
#

First, we need a domain name. If you’re just starting out, you can get a free domain from sites like No-IP. Simply create an account and obtain a free domain. These domains function like any other but often have longer, less appealing names, such as example.ddns.net instead of example.com.

For a more professional-looking domain, you can purchase one from various providers. My favorite is Cloudflare, but other options include Namecheap, GoDaddy, and Google Domains. These domains are usually quite affordable, typically costing around $10 per year.

Setting up DDNS
#

After acquiring your domain, you’ll need to set it up to point to your server by changing its DNS records. A DNS record essentially tells the internet, “Hey, my site example.com is at this IP address.” However, many of us have dynamic IP addresses that change frequently, often daily or with each router restart.

This is where DDNS (Dynamic Domain Name System) comes in. DDNS is a service that automatically updates your domain’s DNS records to reflect your current IP address. This ensures that your domain always points to your server, regardless of any changes to your IP address.

DDNS clients come in various forms, from software you install on your server to routers with built-in DDNS support. I personally prefer using a software client like DDNS Updater. This particular client may not have a fancy interface, but it works perfectly and is very easy to use.

Setting up DDNS Updater
#

We’ll use Docker to deploy the DDNS client. You can follow the official documentation on GitHub or the steps provided here.

Using either Portainer or the terminal, create a new container with the following settings:

  • Name: ddns-updater (or any name you prefer)
  • Image: qmcgaw/ddns-updater:latest
  • Port: 9000:8000
  • Volumes: /updater/data:/home/coeus/docker_volumes/ddns/data

If you’re using the terminal, your command should look something like this:

docker run -d \
  --name ddns-updater \
  -p 9000:8000 \
  -v /updater/data:/home/coeus/docker_volumes/ddns/data \
  qmcgaw/ddns-updater:latest

In this example, I’ve mapped port 9000 to 8000, but you can use any port you prefer for the web interface. In the data folder, I’ve bound a file called config.json. In this file, you’ll add your configuration so the DDNS updater knows which domain to update and which service to use. Here is an example of the config file:

{
    "settings": [
        {
            "provider": "namecheap",
            "domain": "example.com",
            "host": "@",
            "password": "e5322165c1d74692bfa6d807100c0310"
        }
    ]
}

This is just an example, but you can find more information in the documentation on the GitHub page.

Conclusion
#

If done correctly, you should now have a domain pointing to your server, with your server’s IP address being updated automatically. You can verify this by accessing the web interface of the DDNS updater and checking if your domain is listed with the correct IP address. To find your current IP address, simply type “what is my IP” in your browser, and it will be displayed.

The End
#

Now you have successfully set up a domain and DDNS for your server, making it easier to access from anywhere in the world. The only remaining issue is that your home network currently doesn’t accept incoming connections from the internet. To resolve this, you’ll need to set up port forwarding on your router or use a VPN. More on that in the next post.