Wednesday, 17 December 2014

Configuring DNS Round Robin in Windows DNS for Load Balancing

Assume you have say 3 or 4 servers. Maybe Web, or even Terminal Servers. You also don’t want the headache of setting up Network Load Balancing (maybe you are on VMWare, where it doesn’t work well anyhow). Load balancing boxes are expensive, so lets leverage a neat little trick to help us out.
You can setup DNS to actually do what is called Round Robin. It is supported on Windows 2000/2003/2008+ DNS. I will assume you have DNS installed already (Domain controller usually in a Windows environment)
.
The process is pretty simple. Open DNS manager, shown below. Go to properties of your servers and verify that Round Robin is checked. By default it’s enabled, but never hurts to check.
So, the example here is that I have 5 Terminal Servers as follows in the domain CORP.LAB.COM. I will also presume you setup DNS and its related zones properly (Inside domain should have a suffix or prefix to your web presence). If not, see my best practices sections for next time :)

TS00.corp.lab.com 192.168.1.70
TS01.corp.lab.com 192.168.1.71
TS02.corp.lab.com 192.168.1.72
TS03.corp.lab.com 192.168.1.73
TS04.corp.lab.com 192.168.1.74
TS05.corp.lab.com 192.168.1.75

I want to load balance these and have a common name that I can also deploy externally.
In DNS, as pictured, open your corresponding domain that is available inside and outside. In this case, LAB.COM.
 
DNS Round Robin Example

Now, as easy as it sounds, create five records and call them all the same thing. Point each on to one of the IP’s you want in the load balanced record. This will look like this:
ClusterV2.lab.com 192.168.1.70
ClusterV2.lab.com 192.168.1.71
ClusterV2.lab.com 192.168.1.72
ClusterV2.lab.com 192.168.1.73
ClusterV2.lab.com 192.168.1.74
ClusterV2.lab.com 192.168.1.75

Now, internally I can set everyone to connect to ClusterV2.lab.com and they will hit all 5 servers. This is because each request that DNS gets, it will return, in order, the five IP’s we have configured. PC1 will be told that ClusterV2 is 192.168.1.70, PC2 will be told its 192.168.1.71, etc….

Now, onto the catches. First, this is of course a “dumb” load balance scenario. Workstations cache DNS, so while this works pretty well, if your workstation load varies a lot you can get more people on one server than another. This is just a chance/numbers game. If you gave 50 people a number, 1-5 to remember and told 10 of them to come back tomorrow, you could in fact have most of the 10 returning people that were given the number 1. Thus, 2,3,4,5 would have no load. Of course that rarely happens, if ever. But bear in mind its not smart NLB. It doesn’t care about sessions or resources. It has no problem putting someone on a very busy server and not on that is completely free, just because that was the next number.

Next, this of course will apply inside in this example. It is structured so that you can then create on your public DNS server (Web host) a clusterv2.lab.com and point it to 64.58.95.xx or whatever your external IP is. If you have few remote users or just people take laptops home, you can NAT your firewall to one of those five. If you are lucky and have a Firewall like a Watchguard that can handle its own load balancing, you set it up to load balance those same 5 ip’s. This gives you a decent enough SMB load balance configuration that kept costs down and still maintains a +-20% across 5 servers!

No comments:

Post a Comment