Network Load Balancing

Network Load Balancing used to be included in the Advanced (now named Enterprise) and Datacenter versions of Windows. With Windows Server 2003, NLB is available in all editions.


NLB is also available in Microsoft Application Center 2000. The version of NLB included in Application Center is different from the one in Windows Server 2003, and that version is managed very differently.

NLB Concepts

In NLB, each cluster member is a separate, individual computer connected to the other cluster members only by a network. Cluster members don't share storage space as in a Cluster Service cluster.

User requests are sent to one or more IP addresses that are shared by all cluster members. All cluster members receive all requests sent to the cluster, but only one cluster member responds to each request. NLB determines which member will respond based on a set of internal rules and request affinity. The NLB service on each cluster member constantly communicates with the NLB services on the other cluster members, exchanging information about how busy each cluster member is from moment to moment. That workload information factors into NLB's decision about which member will handle incoming requests. NLB uses the following rules to make that decision:

  • Any members that are offline or haven't recently responded to other cluster members are removed from consideration.

  • If the request has been received by a known client and affinity is enabled, the server with affinity for the client handles it.

  • If the request is from a new client or affinity is disabled, the least-busy member with the highest priority handles the request.

You configure many of these properties, including priority and affinity, when you set up a new cluster.


For details on how NLB operates and distributes requests between cluster members, visit and enter this book's ISBN number (no hyphens or parenthesis) in the Search field; then click the book cover image to access the book details page. Click the Web Resources link in the More Information section, and locate article ID# A011202.

Creating a New NLB Cluster

To create a new NLB cluster, open the Network Load Balancing Manager console. Then follow these steps:

  1. From the Cluster menu, select New.

  2. As shown in Figure 12.5, enter an IP address, a subnet mask, and a name for the new cluster. You can also choose to enable or disable remote control for the cluster and configure the cluster for Unicast or Multicast mode.

    Figure 12.5. Configure the cluster's basic properties and IP address.



    Remote control is disabled by default and doesn't prevent you from managing remote cluster members by using NLB Manager. NLB's remote control feature is a serious security risk and should generally be left disabled.


    For more information on Unicast and Multicast modes, visit and enter this book's ISBN number (no hyphens or parenthesis) in the Search field; then click the book cover image to access the book details page. Click the Web Resources link in the More Information section, and locate article ID# A011203.

  3. If the cluster will use any additional IP addresses, enter them as shown in Figure 12.6. Web servers with multiple Web sites, for example, often use multiple IP addresses that you'll need to identify here.

    Figure 12.6. All IP addresses must be static; NLB doesn't use DHCP to acquire addresses.


  4. Specify port rules and affinity modes. By default, NLB enables itself for all TCP and UDB ports and sets Single Client affinity mode. Figure 12.7 shows the defaults, and we'll discuss changing them in the next section.

    Figure 12.7. Web servers typically use these default settings.


  5. Select the network interface NLB will use. In servers with multiple network adapters, NLB typically runs on only one adapter.

  6. Wait as NLB configures itself on the new cluster member. Be sure to check the log messages, shown in Figure 12.8, for any errors that might occur.

    Figure 12.8. NLB displays a running status of its progress as it configures the new member and cluster.


You're done, and you're ready to add new members to your new cluster. Simply right-click the cluster itself and select Add Host to Cluster from the pop-up menu.

Configuring NLB Port Rules and Affinity

You can decide to which TCP and UDP ports NLB will respond. This enables your cluster members to run a clustered application, such as a Web server on TCP port 80, and to run nonclustered applications that NLB ignores. You can also configure each port range with a different affinity setting.

To control a cluster's ports, right-click the cluster and select Control Ports from the pop-up menu. For each configured port range, you can do the following:

  • Enable or disable the range by clicking the appropriate buttons. Disabled ranges are ignored by NLB.

  • Drain the range by clicking the Drain button. Draining instructs NLB to refuse new connections but to allow cluster members to finish any work for connections they've already accepted. This is a great way to take a cluster offline.

You can also edit the port settings. To do so, right-click the cluster and select Properties from the pop-up menu. Then, select the Port Rules tab. Click the appropriate button to add, edit, or remove any existing port ranges. When you add or edit a range, you'll see a dialog box similar to the one in Figure 12.9.

Figure 12.9. Each cluster can support multiple port ranges, as long as they don't overlap.


Port ranges have the following properties:

  • Affinity setting? This controls how NLB load balances incoming requests to this port range. Available options are

    • None? In this mode, all incoming requests are load balanced across the cluster. This is appropriate when cluster members aren't maintaining any information between user requests or when the information is being maintained in a back-end database server accessible to all cluster members.

    • Single? In this mode, requests from new IP addresses are load balanced normally. From then on, the same server handles all requests from a given IP address. If servers are maintaining state information locally, this is a good setting for an intranet. However, Internet clients might seem to be coming from multiple IP addresses because of their service providers' network address translations, so this affinity mode won't work.

    • Class C? In this mode, each range of 253 IP addresses in a Class C range is handled by a single cluster member. This mode largely defeats load balancing, but it ensures that Internet users will always connect to the server that's maintaining their state information locally.

  • A port range? This is expressed as a starting port number and an ending port number. Port numbers in this range are handled by NLB and use the affinity mode designated.

  • A protocol? This can be TCP, UDP, or both. It specifies to which IP protocol the port range applies.


For best performance, use no affinity in your port ranges. If your application developers inform you that the application running under NLB stores state information locally, select Single affinity mode for an intranet or Class C for Internet applications.

Using NLB Manager

NLB Manager enables you to configure and control your NLB clusters. Most importantly, it allows you to set the status of your cluster members, taking them offline for maintenance if necessary.

A valuable option in NLB Manager is the capability to specify alternative login credentials. Normally, the console uses your regular login credentials to attempt to connect to NLB clusters for management. However, your workstation login credentials might not have administrative privileges on the NLB cluster members, which results in NLB Manager being incapable of connecting. To specify alternative credentials, select Credentials from the Options menu. Then, provide the correct domain, username, and password that NLB Manager should use to connect to NLB clusters.