Network Load Balance - Web Farm

in

With the release of Windows Server 2003 Network Load Balancing has become a much more visible tool as a part of the operating system, providing a very usable and relatively easy to configure interface that makes it easy to build a Web Farm. The Network Load Balancing Service has been around in one incarnation or another since Windows NT SP4, but Windows Server 2003 is the first operating system that brings this service into the forefront as a main component of the OS. A new Network Load Balancing Manager application is now directly available from the Adminstrative Tasks menu and it's powerful enough to allow to configure the entire cluster from a single console. The service is now available for all products in the Windows Server family including the lower end Web Edition which means that you now have a much more affordable solution to create Web Farms at your disposal. Just add servers please. 

 

Setting up NLB

In order to utilize the Windows Server Network Load Balancing features you will need two machines running Windows Server 2003. Each machine needs to have at least one network card and at least one fixed IP address. Although running with one adapter works well, for best performance it's recommended that you have two adapters in each machine one mapped to the real IP Address (Microsoft calls this the Dedicated IP) and one mapped to the virtual' IP Address (Microsoft calls this the Cluster IP). Be aware that NLB uses some advanced networking features of network adapters, so it's possible that some low end adapters (especially those for non-server machines) may not support the required NDIS protocols.

 In addition you will also need one more machine for testing (3 machines total). The test machine should be external as you can't use a machine from the pool to test it will only fire request on the local machine since the IP requests are not traveling over the network when you hit the virtual IP address it goes to the local machine.

 I'm going to use two 'servers' here to demonstrate how to set up and run NLB. Assume the IP addresses for these machines are 111.111.111.1 and 111.111.111.2. To create a virtual IP address (Cluster IP) you need to pick an available IP Address on the same Class C network segment. In my example here I'll use 111.111.111.10.

 

Unlike previous versions of NLB the new version has a central manager application that you can use to create a cluster from a single machine. Gone are the hassles of having to manually configure each machine manually you can do it all from a single machine over the network which is a welcome change.

Figure 1

To set up a new NLB cluster bring up the Network Load Balancing Manager and right click to create a new cluster

 

 Figure 1 To set up a new NLB cluster bring up the Network Load Balancing Manager and right click to create a new cluster.

  Right-click on the root node to add a new cluster. Next configure the basic cluster configuration, which will consist of assigning the Cluster or virtual IP address. Figure 2 shows what this dialog looks like filled out for our test network.

Figure 2

Configuring the Cluster IP. This is the virtual IP address

Figure 2 Configuring the Cluster IP. This is the virtual IP address
that will service all servers in the cluster. Note that you should set the

operation mode to Multicast if you are using a single adapter. 

The IP Address is the virtual IP address for the cluster that will be used to address this cluster. NLB will actually create a new IP address on each machine in the cluster and bind it to the specified network adapter (in the next step). Choose a subnet mask make sure you use the same one for all servers in the cluster. The Full Internet name is only for reference and is used here primarily for displaying the name of the server. But if you have a domain configured for the server you should use that domain name.

 Cluster operation mode is very important. Unicast mode means that NLB takes over the network card it is bound to and doesn't allow any additional network traffic through it. This is the reason why two adapters are a good idea one that NLB can take over and one that can still handle all other network traffic directed at the dedicated IP address of the server. If you're using a single adapter you should probably select Multicast which allows both the NLB traffic and the native IP traffic to move through the same network adapter. Multicast is slower than Unicast as both kinds of traffic need to be handled by the network adapter but it's the only way to remotely configure all machines centrally. You can run a single adapter in Unicast mode, but the cluster manager will not be able to communicate with the server after it's configured. As a general rule use Unicast for two adapters, Multicast for a single adapter. With my network cards I had to use IGMP mode in order to get the cards to converge properly you may have to experiment with both modes to see what works best for you.

 Leave the Allow Remote Control option unchecked. This allows you to reconfigure the nodes and port rules remotely, although I found little need to do so. Any changes made to the cluster are automatically propagated down to the nodes anyway, so there's little need to do this with the exception of changing the processing priority. If you do want this functionality I suggest you enable it after you have the cluster up and running.

 The next dialog called Cluster IP Addresses allows you to add additional virtual IP addresses. This might be useful if you have a Web server that is hosting multiple Web sites each of which is tied to a specific IP address. For our example here, we don't need any and can just click next as shown in Figure 3.

Figure 3

If you need to add additional IP addresses to be load balanced

 

 Figure 3 If you need to add additional IP addresses to be load balanced

you can add them here. This is needed only if you host multiple sites
on separate IP addresses and you need separate IPs for these.

Next we need to configure port rules. Port rules determine which TCP/IP port is handled and how. Figure 3 shows the Port Rules dialog with two port rules defined for Port 80 (http) and 443 (SSL). The default port configuration set up by NLB handles all ports, but in this case that rule is too broad. Port rules can't overlap so if you create specific rules you either have to create them for each port specifically or create ranges that fit your specific ports. 

Figure 4

The Port Rules dialog shows all of the port rules defined for

 

Figure 4 The Port Rules dialog shows all of the port rules defined for
cluster. By default a rule for all ports 0 65365 is defined. Here I've

Created to specific port rules for port 80 and 443.