Fun with Wildcard DNS, Subdomains and Twitter

tweet google“Wildcard DNS in action”

Wildcard DNS and a domain name such as tweetgoogle.com can make a mundane script wildly more powerful and in this case, that power is being focused on the tweets at twitter.com A wildcard DNS record is a record in a DNS zone that will match requests for non-existent subdomain names. And that means… ūüôā A wildcard DNS record is basically a ‘catch all’ subdomain record for the domain. Setup wilcard DNS is easy!¬†¬†Setting up wildcard dns¬†is done by using a “*” as the leftmost label (part) of a domain name, e.g. *.tweetgoogle.com. Here we clearly see that the subdomain of the domain tweetgoogle.com will be a wildcard dns entry. See the examples of wildcard dns in action below.
Setting up wildcard DNS – the zone file
tweetgoogle. 3600 A IP address of server – normal entry
www.tweetgoogle. 3600 A IP address of server – normal entry
*.tweetgoogle. 3600 A IP address of server – this is a wildcard DNS entry
*abcd.tweetgoogle. 3600 A IP address of server – this will FAIL as a wildcard DNS entry (wildcard DNS follows different wildcard rules) at tweetgoogle.com

Can you see the fun that can be had here with wildcard DNS?
By¬†setting up a wildcard DNS record I have allowed the DNS system to pass anything.tweetgoogle.com to the server. This left area before the domain name or the ‘*’ in *.tweetgoogle.com gets passed to the server,¬†analyzed and then passed to a PHP script that creates a page based on that content.
Sound weird? Check these examples of wildcard DNS in action where they have already setup the wildcard dns record
Examples:
http://larkinized.tweetgoogle.com
http://DNS.tweetgoogle.com
http://dns-server.tweetgoogle.com
http://setup-wildcard-dns.tweetgoogle.com
http://setup-wildcard-dns.tweetgoogle.com

As you can see they all will respond and they are dynamically generated pages due to the script that digests the wildcard DNS. Pretty cool use of DNS if you ask me… Don’t forget to enter your name into the search on tweetgoogle.com… It amazed me what people will and do say on a daily basis.
Anyway, Maybe I will go into the scripts behind that site one of these days since I receive so many questions about how they work.
Thank you and enjoy setting up wildcard dns!!