Yesterday, I learned something about DNS I hadn’t thought of before.

One can have multiple A records for load balancing. e.g.,

A @ 123.123.123.123
A @ 123.123.123.124

So, your domain will then resolve to either of these IPs.

What I didn’t think of was that you can also do this:

A @ 123.123.123.123
A alt 123.123.123.124

The difference here is that alt.mydomain.com will always resolve to .124, whereas mydomain.com will always resolve to .123.

This is rather key, at least for me, because I have a plethora of servers/services on a pair of IP addresses. The way I used to do this was:

A @ 123.123.123.123
CNAME srv4 mydomain.com
A srv1 123.123.123.124
A srv2 123.123.123.124
A srv3 123.123.123.124
CNAME srv5 mydomain.com

This can get pretty unwieldy when talking about dozens of various sub-domains, as is the case with me. Every time home IP address changes (doesn’t happen often, but I got a new cable modem over the weekend and the IP changed), I had to edit every one of those .124 records to point to whatever the new IP address was.

Instead, you can do this:

A @ 123.123.123.123
A alt 123.123.123.124
CNAME srv4 mydomain.com
CNAME srv1 alt
CNAME srv2 alt
CNAME srv3 alt
CNAME srv5 mydomain.com

Thus, having to edit only one entry when an IP might change. I was a chump all those years, editing all those A records. Again, didn’t happen to often…but, boy, when it did…