DNS stuff

DNS
To get your internet data back and forth over the internet, you'll need the IP address of the other system. Since we humans are not so good with numbers (apart from a few idiot savants maybe), we use host-names, such as www.google.com. DNS services connect host names to IP addresses and vice versa (this is not a one-on-one relationship! One IP address can serve many websites, but the reverse is also possible, having multiple IP's for a single website can be an important fail-safe).

Google Apps / Sites / App Engine
The other day I reserved a domain name and wanted to connect it to Google Apps / Sites / App Engine. This requires CNAME records in the DNS, while the webhost I chose sadly only allowed the A-records to be changed. Ehh, what?

Well, it's rather complicated, but let's have a try.

CNAME and A records
The default case: a DNS lookup (to translate blah.example.com) will start at your DNS provider, the A-record is retrieved (there's only 1 A record for example.com). This yields an IP4 address which leads to the computer that is actually serving your website.

However when a CNAME (canonical name, the host name where this entry is an alias for) is found, the DNS lookup will start over from there. Yes, this can be another host name.

So, with a CNAME record for blah.example.com that contains 'ghs.google.com', a query for blah.example.com will lead to another query for ghs.google.com. This yields an A-record IP address (or yet another CNAME of course). The final IP address will be used to make the actual web request. In this web request, the original host name will also be mentioned. This way the webserver (which obviously serves many sites) knows what page to serve you.

The Trick
But if you know this IP-address, you might just as well use this as your A-record. This can easily be done using ping:

> ping ghs.google.com
PING ghs.l.google.com (74.125.77.121) 56(84) bytes of data.
..

There you go. Put this as the A-record and you can use Google Apps and/or Google App Engine for your entire domain. Note that you can not have CNAME's for your domain-without-subdomain (ie example.com), but this hard-coded A-record IP address does point *.example.com AND example.com to Google.

Drawback
The drawback of course, comes when Google changes the IP of ghs.google.com, in which case the A record trick will fail. Furthermore, you can only do this for your entire domain, not just a single subdomain.

Irrelevant
In the end, I found out that Google Apps -> Google Sites has a footer that you can not remove and for now I only wanted to host a simple page. Since App Engine has some delay for the first request (after a period without any requests from any visitors) I moved away from google to 000webhost. For this I only had to change the A record.

Note that changing DNS stuff, due to it's decentralized nature, can take up to 24 hours...so be patient!

Geen opmerkingen:

Een reactie posten