Dynamic DNS to Start Hosting Your Own Servers Without a Static IP OR Domain
When it comes to hosting your own servers, you're probably in one of a few situations:
You have residential internet with a dynamic IP address
You have commercial internet with a static IP address
You have a virtual private server (VPS) with a static IP address
Whatever your situation is, you will also need a public domain address (e. g. example.com) if you want to secure your internet traffic with an SSL certificate (i. e. HTTPS). So what do you do from here? Do you have to pay for yet another service to acquire a public domain address?
You can. Or you can use Dynamic DNS (DDNS).
Dynamic DNS is a service that both provides you a public domain address and tracks your dynamic IP. If you have a dynamic IP address, you would install a client on a machine on your home network that continuously checks your current public IP address and reports to the DDNS service. If your client reports that your IP has changed, the DDNS service updates your IP so that all traffic to your public domain is still sent to your servers.
If you have a static IP, it's even easier. You just sign up for a public domain and update your static IP in your account-- no client install necessary.
The best part is that there are many free DDNS services out there, and many routers come pre-installed with DDNS clients. Now, if you want a nice, marketable domain without the service's domain attached (e. g. hannahtech.co vs hannahtech.ddns.net), you'll probably have to pay for that. But if you just want something that works, go with the free service.
Ok, now you can stop reading and go Google some DDNS services. Or you can keep reading for an example if you're still confused.
Here's an example with No-IP.com.
I can choose my hostname ("hannahscloud") for their selection of domains ("ddns.net") and sign up.
Then I go through sign up. You can see here some of the "enhanced" features you get for paying for their service. If you're just hosting personal servers, you probably won't need more than three hostnames. You probably won't even need more than one. And if you don't like confirming your domain every month, you can get yourself an actual domain for less than $25/year and bring it to a DDNS service.
From here, I verify my email address and login. I'll be taken to my dashboard. I can then navigate to Dynamic DNS >> No-IP Hostnames to see the hostname I signed up with. I click on it to get a pop-up window that prompts me for my server's IPV4 address (my current public IP).
I click Update Hostname and
that's it. "hannahscloud.ddns.net" will now take me to my server.
In this example, I'm hosting a Nextcloud server that has an Apache web interface. I also already had the SSL certificate loaded with Let's-Encrypt; your server will be labeled "Not secure" until you have your SSL certificate loaded on your server. I don't recommend you pay for an SSL certificate if you haven't paid anything so far, so check out Let's-Encrypt to get your free domain a free, renewable SSL certificate.
At this point, if you have a static IP (e. g. situations 2 or 3 from the beginning), you can really stop reading. You're done. Just remember to confirm your hostname monthly.
If you have residential internet with a dynamic IP, keep reading for client installation.
I then navigate to Dynamic DNS >> Dynamic Update Client. I'm going to install this on my personal Windows machine.
NOTE: You don't have to install the client on the server you intend to use this hostname with; you just need to install it on a machine on the same internet connection as your server (e. g. any machine on your home network). HOWEVER, do not install this client on a device that is mobile, like a laptop that you travel with or bring to school/work/etc. It checks for your current public IP every five minutes, and if you are connected to your work's WiFi when it checks, it will then start sending your server's traffic to your work's public IP.
Once I download and start the client, I see two windows pop up:
In the "Edit Groups/Hosts" window, I check my hostname and click Save. Then in the other window, I will see all the red X's turn into green check marks. I have successfully reported my public IP to No-IP. This service will now run in the background of my machine and report my public IP every five minutes.
And that's it. You're now ready to start hosting your own web server, mail server, cloud drive, chat server, or whatever else your heart desires. Check out my tutorial on setting up Nextcloud to start hosting your own cloud drive/chat server/document collaboration server/etc with Nextcloud.