I typically use Amazon’s AWS EC2 cloud services which include Route53 for DNS however I have certain clients that prefer RackSpace and therefore require RackSpace Cloud DNS services. One of the primary reasons for not just using an external DNS service such as Amazon’s Route53 DNS service is because when you setup large cloud deployments you typically are going to need internal DNS entries for communication between cloud instances and DNS services such as Route53 will not respond externally to RFC1918 or private IP space for those DNS entries. Anyhow one thing that is well documented or easy to accomplish on Route53 is creating A records with multiple IP’s for round robin DNS which provides a cheap easy to configure load balancing of sorts for different services such as MySQL. I could not find any documentation or mention of round robin DNS setup on RackSpace Cloud DNS so I wanted to explain how I was able to accomplish this.
RackSpace Cloud Control Panel: Cloud DNS
Above you can see the RackSpace CloudDNS Control Panel where domains can be added to Cloud DNS for management through the RackSpace Cloud. The interface is clean and easy to operate even though it does lack certain functionality such as an easier way to enter multiple IP’s for single A records for easier management of round robin DNS.
Round Robin DNS On RackSpace Cloud DNS:
Once you have opened the RackSpace Cloud DNS control panel either add a new domain or enter the domain you want to manage. Once you are within a specific domains management page click the Add Record button located above the list of DNS entries for that domain and fill in the information for the first IP you want the A record to respond to as shown in the below example image. In the example below we are going to point round-robin.qd-test.com to both of Google’s public DNS servers which are located at 126.96.36.199 and 188.8.131.52. Once we have round robin DNS setup it will load balance traffic to both servers through DNS.
Round Robin DNS On RackSpace Cloud DNS: First DNS A Record Entry
Click the Add Record button to save the DNS A record. In this example we have added an A record for round-robin.qd-test.com to point to 184.108.40.206. Now lets add a second A record with the same configuration but this time we will add 220.127.116.11 as the IP address as shown below.
Round Robin DNS On RackSpace Cloud DNS: Second DNS A Record Entry
Click the Add Record button again to save the new A record which is round-robin.qd-test.com pointed to 18.104.22.168. Now we have two DNS A records pointing to the same hostname as shown in the below example image of the RackSpace Cloud Control Panel drilled down into Cloud DNS management for a specific domain.
Round Robin DNS Configured Via RackSpace Cloud Control Panel:
So you might be wondering well that doesn’t make any sense… how can you have two A records pointing to the same host? Well the answer is that the system will hand out a single IP upon a DNS reqeust for the host and while it might not be exactly 50/50 it will alternate between the two IP’s address and thus provide you the poor mans DNS. In some scenarios though round robin DNS is a better solution that certain load balancers that are available such as some Cloud providers load balancers. This could be because they handle sessions incorrectly or constantly ping the port to make sure its up and eventually lock the remote service up. A great example of a service that can have issues with virtual load balancers would be MySQL as sometimes the connections do not close properly and depending on how many connections you have configured in my.cnf it could fill up all of your connections quickly depending on how the virtual load balancer does its health check monitoring. Below we show examples of running dig against round-robin.qd-test.com, nslookup against round-robin.qd-test.com, and ping from different servers against round-robin.qd-test.com.
Running dig Against Round Robin DNS Entry On RackSpace Cloud DNS:
- [root@centos1 ~]# dig @22.214.171.124 round-robin.qd-test.com
- ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.1 <<>> @126.96.36.199 round-robin.qd-test.com
- ; (1 server found)
- ;; global options: printcmd
- ;; Got answer:
- ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57396
- ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
- ;; QUESTION SECTION:
- ;round-robin.qd-test.com. IN A
- ;; ANSWER SECTION:
- round-robin.qd-test.com. 300 IN A 188.8.131.52
- round-robin.qd-test.com. 300 IN A 184.108.40.206
- ;; Query time: 205 msec
- ;; SERVER: 220.127.116.11#53(18.104.22.168)
- ;; WHEN: Fri Jan 11 00:23:04 2013
- ;; MSG SIZE rcvd: 73
- root@centos1 ~]#
Notice two A records are returned just as entered in the RackSpace Cloud DNS control panel!
Running nslookup Against Round Robin DNS Entry On RackSpace Cloud DNS:
- [root@centos1 ~]# nslookup round-robin.qd-test.com
- Server: 192.168.1.1
- Address: 192.168.1.1#53
- Non-authoritative answer:
- Name: round-robin.qd-test.com
- Address: 22.214.171.124
- Name: round-robin.qd-test.com
- Address: 126.96.36.199
- [root@centos1 ~]#
Again… notice two records are returned. Now below we show the purpose of the two A records which is to load balance a single DNS entry across multiple hosts.
Running ping Against Round Robin DNS A Record: Server One
- root@bt ~# ping round-robin.qd-test.com
- PING round-robin.qd-test.com (188.8.131.52) 56(84) bytes of data.
- 64 bytes from google-public-dns-b.google.com (184.108.40.206): icmp_req=1 ttl=45 time=40.1 ms
Running ping Against Round Robin DNS A Record: Server Two
- [root@centos1 ~]# ping round-robin.qd-test.com
- PING round-robin.qd-test.com (220.127.116.11) 56(84) bytes of data.
- 64 bytes from google-public-dns-a.google.com (18.104.22.168): icmp_seq=1 ttl=45 time=37.6 ms
So there are lots of downsides to round robin DNS such as even if one of the servers happens to go down traffic will still be sent to that server so unlike a normal load balancer that would mark that server down and stop sending traffic to it. However in a controlled environment where the round robin DNS records are being used internally between servers it can be very useful! So while it was different configuring round robin DNS using RackSpace’s Cloud DNS it works exactly the same as Amazon’s Route53 DNS services.