Setting up the Domain Name with a Dynamic IP Address
This post is about hosting yourself. This means that you bought a domain name from a registrar and you want it to point to the web server we set up in the first three posts.
The Domain Name System (DNS)
The DNS is a system for translating web addresses such as vagabundosdelmundo.com to IP addresses. Why is it necessary to resolve IP addresses? Well, because computers only really understand IP addresses when trying to communicate with each other. Without going into much details, there are several big bad-ass root DNS servers around the world that control the resolution of IP addresses. However, these servers cannot spontaneously know that vagabundosdelmundo.com is hosted in xx.xx.xx.xx IP address. This is why we need registrars. They register records in these servers that enable the resolution.
A fully qualified domain name (FQDM) is the complete domain name for a specific computer, or host, on the Internet. It is read from right to left as illustrated below. On the far right is the dot or root, then comes the top level domain (TLD) .com, then the domain name that was registered at the TLD via the registrar, and last the subdomain www. Domain names have the authority to assign subdomains within it.
There are a bunch of domain names registrars out there. Just to name a few: Namecheap, Bluehost, HostGator, GoDaddy, Hover, Gandi, Dreamhost, Name.com. In our case we went for GoDaddy. We were mainly looking for a domain name only package without any hosting options. Our first option was HostGator, but somehow they did not want to take our money.
There was a problem with the transaction and the payment did not go through. So we went to GoDaddy and there it worked like a charm. Until now we are satisfied with them.
A dynamic DNS is a method of automatically updating a name server in the Domain Name System when the host IP address changes. This is very important because general public internet service providers (ISPs) such as AT&T, Telmex, or Telekom Austria, assign IP addresses dynamically via DHCP. When your internet modem at home restarts, it may be assigned a new IP address, so it is impossible to bind it to a normal DNS server. normal DNS servers require an static IP address.
Fortunately we own an Asus router. Asus router include a DynDNS service where you can assign a domain name to your router. This service updates the DynDNS server each time your router changes IP address. In our case, we have the DynDNS domain name peons.asuscomm.com that always points to our IP address.
There is a big list of DNS records that help configure a domain name, but for us, only two of them are relevant:
- A: an A record points to an IP address or another FQDM
- CNAME: a CNAME record stands for canonical name and it is just an alias to another domain name.
Putting Everything Together
Because we are hosting our own web page, our DNS constellation is a bit unorthodox. We have:
- An A record that points vagabundosdelmundo.com to our subdomain www.vagabundosdelmundo.com, and
- a CNAME records that aliases www.vagabundosdelmundo.com as peons.asuscomm.com
So when you type vagabundosdelmundo.com, it automatically redirects to www.vagabundosdelmundo.com which is just another name for peons.asuscomm.com, and finally peons.asuscomm.com resolves to the up-to-date IP address. This was made to go around the fact that we do not own an static IP address. The normal way of setting up the DNS records would be to set the A record to point to an IP address, and the CNAME www subdomain as an alias of the A record.
Since we did not mention it anywhere else, the DNS records are managed directly with your registrar. In our case we set up our DNS records in the GoDaddy configuration portal.