If you’re into Linux and like to experiment new things, there will be a time where you’ll want to host a website on your machine. Having a dynamic IP means that there will be additional steps that you’ll have to do in order for your website to remain accessible externally with little downtime as possible. Mauritian citizens and others also will have this problem as whenever their modems are restarted or during a power cut, their IPs will change. A free fix to this problem is described below.
https://freedns.afraid.org offer free Dynamic DNS Update. They also offer lots of subdomains for you to use free of charge. If you don’t want to use their subdomains you can also get a free domain from https://freenom.com. Their service includes free .ml .ga .tk and others. I don’t recommend Freenom as their business model is shady. They killed my domain once for inactivity(which btw is not true, the server was up 99.9%) and wasn’t able to re-register it on the same account. I had to create another account or pay for it to be able to register it again.
I’ll cover both methods here. Both methods will require an afraid account.
If you choose to use a subdomain from afraid, Create an account there and log in. https://freedns.afraid.org/
- Go to Subdomains which is on the left side of the screen
2. click on add
The type will be an A domain as we want to point subdomain.domain.com to a hard coded IP Address. In the subdomain field, choose whatever name you want for your site. For the domain you have lots of options, choose whatever you want. In the destination field, input your IP. Just google “what is my IP” to get it. Then click on save.
Then on the left corner, click on Dynamic DNS, there are lots of ways to announce your IP to afraid, one of the ways is to use a cron job. Read the crontab examples.
copy the direct URL.
go into your terminal and input:
go to the bottom of the file,
add a new line, here’s how to use crontab to automate the announce, if you want it to be updated in intervals of 15 minutes, make the line like this:
*/15 * * * * curl https://freedns.afraid.org/dynamic/update.php?yourID
Replace the link with your own announce URL (Direct Link). Save and exit. I recommend reading the cron example as there are other ways to do this.
Now that you have a subdomain, you can use it for your site.
Method 2 -> Freenom method
Create an account on freenom
Hover over domain and click on register a new domain
Enter the name of the site you want then select whatever domain extension you want then check out.
click on USE DNS
then click on USE YOUR OWN DNS
in the nameservers field enter:
Choose the time period you want your domain to be valid for & continue
enter your info then complete order
Hover over Domain(top left corner) then click on My domains
Click on Manage Domain for your newly created domain
Click on Management tools, then Nameservers
In the Nameserver 3 & Nameserver 4 fields enter
then click on change nameservers.
Now head over to https://freedns.afraid.org/
In the left top corner, click on Domains.
Then click on Add Domain
In the Domain field, enter your newly created domain.
In the Shared state field, put it as private if you don’t want other users to get a subdomain from your site.
If your domain is broken, click on Check for broken domains in the domain page for it to be verified.
then go to Dynamic DNS.
copy the link then use curl & cron as shown above to announce your IP.
That’s it, you can have your own domain linked to your machine. Have fun creating your websites and hosting them.