NOTE on DNS A Names with Round Robin (multiple A names)
################################################

If you have DNS items like so: Multiple A names point to different IPs. This will give you round robin IPs per connection (not high availability). Its a way to load balance the requests. If one of these servers crashes, that request still goes out, it will just fail. So with 4 Ips tied to the A name kossboss.com, if 1 of the IPs fail, then 3 out 4 requests are good, but 1 request will fail.

SIDENOTE ABOUT ANAME AND @ HOST MEANING NAKED DOMAIN: since im talking about “kossboss.com” and not “something.kossboss.com”, thus its not prefixed with www (or any subdomain, the “something.” part). The A name has 3 items to configure: the host, the target which is the IP it points to – where as Cname points to an Aname or a full on Domain Name, and the TTL (Time to live in the DNS cache). Now The IP and the TTL make sense. The Host though in an Aname has to be either the @ symbol (which means the naked domain – and this is what I had to pick so that I didnt have to select the “something.” part), or it has to be a subdomain of choosing (for example the host: “ram”, points to IP 192.249.61.185, thus “ram.kossboss.com” points to that 192.249.61.185). So how do I just get an Aname to point at a naked domain, without the subdomain part? So that just “kossboss.com” is told to go to some IP. Well I just answered it in the Parenthesis, you use the @ symbol. So you would configure, Host: “@”, points to IP 216.239.32.21.

From a client doing an nslookup or a host command you can see this behaviour (the roundrobin configuration):

To test the round robin property do this:

FROM WINDOWS:
=============

Step1) ping kossboss.com
Step2) And cancel it
Step3) Repeat step 1 thru 2

You will see that it picks a different IP each time.

FROM LINUX:
===========

Repeat the following command:

Notice that its picking different IPs

Or you can run this mini script (find the IP address in the ping output, it spits it out twice, so just select the top one with head):

Or Generic:

SIDENOTE: interesting way to select out the IPs in a piece of text or command output:

text:

or:

command output:

Now you can repeat it like so:

1 ping per 10th of second:

1 ping as fast as it can (just remove the sleep)

You can now sort this output (sort for the purpose of uniq squishing the similar stuff together, and giving you a count with -c):

# cat pingys1 | sort | uniq -c

OUTPUT:

So we see that every IP got used about 35 to 37 times equally round robin balanced!

NOTE: if one or more of those IPs would fail, then the Ping would of failed for that IP

SCRIPT:

SCRIPT AND STATS:

First do this:

Then do this:

IF WINDOWS OR LINUX ARE REPORTING THE SAME IP EVERYTIME?==================================================

This could be due to your DNS server caching the IP address. So it saved the entry for example to kossboss.com as 216.239.32.21 (For 1 Hour). So maybe next hour it will be different.
You could counter this by using the 8.8.8.8 or 4.2.2.2 (or any other DNS server). If that doesnt work, then maybe the problem is in your PC (The client) storing the value in cache. You can always flush the DNS cache.

How to flush DNS cache in windows:

How to flush DNS cache in Linux:

You will need to research whats holding the DNS in your system.

 

Leave a Reply

Your email address will not be published. Required fields are marked *