Website Hosting on Your Home Internet with Dynanic IP Address
This post is to address a recent question I received from someone who is on a Google WiFi Router and wants to host a website or an application which can ve accessed online using a host address that is on a domain booked with GoDaddy. Here is what I know besides the objective as mentioned above.
1. The Internet Connectivity is available using Google WiFi Router through Comcast which assigns Dynamic IP
2. The server is running VirtualMin
3. No Purchases – No additional subscriptions to any service
The correct way to host a website is to have A record pointing to the IP address for example A record for www.instanorth.com at the time of writing this article points to 22.214.171.124 which is hosted by AWS. Another alternative to A record is CNAME record which is an alias record and does not require an IP address. This record requires an alias of the original address.
Now comes the free Dynamic DNS Services. These require that your primary router or atleast one of the routers installed on the same internet has Dynamic DNS client. As far as I could Google, the router mentioned does not have any Dynamic DNS Client so we need to be running a Dynamic DNS Service on one of the computers on the network. Since the server with VirtualMin has to remain powered on and connected to be able to serve the application, it is best to install a Linux based Free Dynamic DNS client like https://www.duckdns.org/install.jsp on the server hosting the application.
I signed up quickly using my Google account and my address is http://instanorth.duckdns.org/ which I have pointed to the same IP address. Setting up DuckDNS is real simple and this is just a simple shell script that can be called say every 3 minutes to keep the dynamic host updated with the correct IP address in case of a reboot.
Final Step on GoDaddy Account
Finally, the A record for naked domain @ and www host need to be deleted and replaced with CNAME records which point to the aliases created with DuckDNS service as mentioned above.
With this any request coming to www.yourdomain.com or yourdomain.com will be aliases to your-handle.duckdns.org which in turn is forwarded to your Dynamic IP that is your home router. Make sure you have forwarded port 80 to the correct server so that you script/website/application can be served when someone requests yourdomain.com in their browser.
Please feel free to drop me a message to let me know if this worked for you or any other better alternatives are available.