Friday, January 22, 2010

Network Load Balance and Layer 3 Switch



TO load balance servers in your network you have few options as follows

1- Buy a hardware load balancer like the one sold by http://www.coyotepoint.com/
2- Use software load balancer and here you have two options
a) Use Windows 2003 NLB (Network Load Balance) which is free but very old technology.
b) Use a third party software like Linux Virtual Server (LVS) http://www.linuxvirtualserver.org/ or any third party software
3- Write your own load balance component
4- Use DNS Round robin. Please do not use DNS round robin because of the drawback mentioned in this link http://en.wikipedia.org/wiki/Round_robin_DNS

In this post I am going to hilight few issues related to NLB. First of all it is an old technology and if you are doing load balancing in a professional environment you should really use a hardware appliance like the one mentioned in point 1 above. Hardware appliances offer load balancing algorithms and they check for server and application availability as well. However, if you are experimenting with load balancing or doing it at home and don't want to spend a penny then you can use NLB.

NLB basically tries to broadcast the request to all the servers in the cluster and one of the servers says I got it. and that's it. Before you even try NLB make sure the switch you have is a layer 2 switch. if your switch is a layer 3 switch your cluster will never work. to work around this issue you need to create a Layer 2 VLAN in your Layer 3 switch.

The other issue you need to examine is your network interface on your machine. open your registry on both machines and check the interface illustrated below. every machine should have a different GUID for the interface. sometimes different machines will have the same GUID because often times the operating system is installed from the same copy and every thing ends up being the same even the network interface GUID. in this case you need to uninstall your network adapter and install it again.



To create an NLB cluster
  1. To open Network Load Balancing Manager, click Start, click Administrative Tools, and then click Network Load Balancing Manager. You can also open Network Load Balancing Manager by typing Nlbmgr from a command prompt.

  2. Right-click Network Load Balancing Clusters, and then click New Cluster.

  3. Connect to the host that is to be a part of the new cluster. In Host, enter the name of the host, and then click Connect.

  4. Select the interface that you want to use with the cluster, and then click Next. (The interface hosts the virtual IP address and receives the client traffic to load balance.)

  5. In Host Parameters, select a value in Priority (Unique host identifier). This parameter specifies a unique ID for each host. The host with the lowest numerical priority among the current members of the cluster handles all of the cluster's network traffic that is not covered by a port rule. You can override these priorities or provide load balancing for specific ranges of ports by specifying rules on the Port rules tab of the Network Load Balancing Properties dialog box. ClickNext to continue.

  6. In Cluster IP Addresses, click Add to enter the cluster IP address that is shared by every host in the cluster. NLB adds this IP address to the TCP/IP stack on the selected interface of all hosts chosen to be part of the cluster. NLB doesn't support Dynamic Host Configuration Protocol (DHCP). NLB disables DHCP on each interface it configures, so the IP addresses must be static. Click Next to continue.

  7. In Cluster Parameters, type values in IP Address and Subnet mask (for IPv6 addresses, subnet mask is not needed). A full Internet name is not needed when using NLB with Terminal Services.

  8. In Cluster operation mode, click Unicast to specify that a unicast media access control (MAC) address should be used for cluster operations. In unicast mode, the MAC address of the cluster is assigned to the network adapter of the computer, and the built-in MAC address of the network adapter is not used. It is recommended that you accept the unicast default settings. Click Next to continue.

  9. In Port Rules, click Edit to modify the default port rules. Configure the rules as follows:

    In Port Range, specify a range of 3389 to 3389 so that the new rule applies only to RDP traffic.

    In Protocols, select TCP as the specific TCP/IP protocol that a port rule should cover. Only the network traffic for the specified protocol is affected by the rule. Traffic not affected by the port rule is handled by the default host.

    In Filtering mode, select Multiple host, which specifies that multiple hosts in the cluster handle network traffic for this port rule.

    In Affinity (which applies only for the Multiple host filtering mode), select None if you are planning to use TS Session Broker. Select Single if you are not planning to use TS Session Broker.

  10. Click Finish to create the cluster.

    To add more hosts to the cluster, right-click the new cluster, and then click Add Host to Cluster. Configure the host parameters (including host priority and dedicated IP addresses) for the additional hosts by following the same instructions that you used to configure the initial host. Since you are adding hosts to an already configured cluster, all the cluster-wide parameters remain the same.

    Those steps were copied from http://technet.microsoft.com/en-us/library/cc771300(WS.10).aspx



    http://www.west-wind.com/presentations/loadbalancing/networkloadbalancingwindows2003.asp