How to Implement Network Load Balancing in Unicast mode

Introduction

Ezra Undag
Tech Jobs Academy
7 min readSep 9, 2016

--

Windows Network Load Balancing (NLB) is a feature that distributes network traffic among multiple servers or virtual machines within a cluster to avoid overloading any one host and improve performance.

Figure 1. Basic NLB Cluster (From VMWare Knowledge Base)

Network Load Balancing distributes IP traffic to multiple copies (or instances) of a TCP/IP service, such as a Web server, each running on a host within the cluster. Network Load Balancing transparently partitions the client requests among the hosts and lets the clients access the cluster using one or more “virtual” IP addresses. From the client’s point of view, the cluster appears to be a single server that answers these client requests. As enterprise traffic increases, network administrators can simply plug another server into the cluster. Similarly, if traffic decreases, servers can be taken offline and the feature will balance traffic among the remaining hosts.

Scenario

We configure nodes installed with two network interface cards operating in unicast mode in order to separate handling of traffic as indicated below:

  1. Network Interface Card 1 (Subnet 192.168.0.x)
    - Bound to network load balancing
    - Handles incoming client requests, heartbeat messages and remote control traffic
    -Mapped to the virtual IP address (Microsoft refers to this as the Cluster IP, and real IP address (Microsoft refers to this as the Dedicated IP)
  2. Network Interface Card 2(Subnet 172.16.0.x)
    - Handles communication between cluster hosts
    - Handles individual node traffic caused by management tasks such as using Remote Powershell to remove roles and features
    - Can be used to access backend-file and database servers

Prerequisites

  • Hyper-V
  • 4 virtual machines running Windows Server 2012 R2
    Consist of: 1 Root Domain Controller and 3 member servers running as Cluster Nodes
  • 1 virtual machine running Windows 8.1
  • AD Domain: Contoso
  • 2 Virtual Networks to allow two separate subnets as each server has two network interface cards

Components

1. Cluster Nodes : NYC-SRV1, NYC-SRV2, NYC-SRV3
2. Domain Controller — NYC-ROOTDC (important roles: DNS and NAT)
3. Virtual Networks: CContoso, ClusterSubnet
4. Sample website: support.contoso.com
5. Windows 8.1 Client

Figure 2. Demonstration Setup

Steps to setup a Network Load Balancing cluster

  1. Review if each cluster node has two network adapters. One adapter connected to local private subnet and the other one connected to cluster subnet (MAC Address spoofing should be enabled for this one for Unicast mode to work)
Figure 3. Virtual Machine Setting for NYC-SRV1 on Hyper-V

2. Login to NYC-ROOTDC, NYC-SRV1, NYC-SRV2, NYC-SRV3

3. On NYC-SRV1, open Windows PowerShell and run the following command. This installs the Network Load Balancing feature on NYC-SRV1, NYC-SRV2 and NYC-SRV3.

Invoke-Command -Computername NYC-SVR1,NYC-SVR2,NYC-SRV3 -command {Install-WindowsFeature NLB,RSAT-NLB}

4. On NYC-SRV1, create an NLB cluster running on Unicast mode by executing the following command.

New-NlbCluster -InterfaceName "Ethernet 3" -OperationMode Unicast-ClusterPrimaryIP 192.168.0.101 -ClusterName NYC-NLB

This command binds network load balancing to network adapter “Ethernet 3”. Please modify according to the assigned Ethernet Adapter name.

192.168.0.101 — is the Cluster IP or the virtual IP Address. It is the IP address that is shared among the hosts of a Network Load Balancing cluster and used by clients to address the cluster as a whole.

192.168.0.11- is the host’s Dedicated IP. It is the cluster host’s unique IP address used for network traffic not associated with the cluster (for example, Telnet access to a specific host within the cluster).

Figure 4. ipconfig /all results on NYC-SRV1

5. On NYC-SRV1, add NYC-SRV2 and NYC-SRV3 to cluster by running the following commands:

Add-NlbClusterNode -InterfaceName "Ethernet 3" -NewNodeName "NYC-SVR2" -NewNodeInterface "Ethernet 5"

Ethernet 5 — is the network adapter name on NYC-SRV2 bound to the cluster

Figure 5. ipconfig on NYC-SRV2 after adding to the cluster
Add-NlbClusterNode -InterfaceName "Ethernet 3" -NewNodeName "NYC-SVR3" -NewNodeInterface "Ethernet 6"

Ethernet 6 — is the network adapter name on NYC-SRV3 bound to the cluster

Figure 6. ipconfig on NYC-SRV3 after adding to the cluster

6. On NYC-SRV1, validate the NLB Cluster in Network Load Balancing Manager console. Nodes NYC-SRV1, NYC-SRV2, and NYC-SRV3 should display with the status of “Converged”.

When a host is added to the cluster, it invokes a process called “convergence”. Convergence is a process in which the hosts exchange heartbeat messages to determine a new, consistent state of the cluster.

Figure 7. Network Load Balancing Manager console

Test the Network Load Balancing Cluster

  1. Install Web Server on the cluster hosts by running the command below on each host.
Import-Module ServerManager
Add-WindowsFeature Web-Server -IncludeAllSubfeature

2. Create a static basic website on each cluster host that is accessible at http://support.contoso.com. Detailed steps on how to set up a website on IIS is accessible at atlantic.net community site.

Figure 8. Internet Information Services (IIS) Manager

Index page on this website contains the following basic html.

<!DOCTYPE html>
<html>
<title>Contoso Support</title>
<body>
<h1>Welcome to Contoso Support</h1>
<p>Hello world!</p>
<em>This page is generated from NYC-SRV1 node.</em>
</body>
</html>

The text inside the <em> block is added to determine which node the web page will be fetched from. Modify the text inside the <em> block according to the cluster host name.

3. On NYC-SRV1, add a type A resource record to the DNS zone “contoso” in order to resolve support.contoso.com lookups.

Invoke-Command -Computername NYC-ROOTDC -command {Add-DNSServerResourceRecordA –zonename contoso.com –name support –Ipv4Address 192.168.0.101}

4. Install NAT on NYC-ROOTDC to allow routing of http requests to the NLB cluster. A detailed instruction on how to install NAT is available at Dell’s Knowledge Base site.

NAT or Network Address Translation allows a single device, such as a router, to act as an agent between the Internet (or public network) and a local network (or private network), which means that only a single unique IP address is required to represent an entire group of computers to anything outside their network.

This step is specific only to this demonstration. We use NYC-ROOTDC as our Domain Controller, DNS server and Router server. NYC-ROOTDC has two network adapters. One adapter connected to the 192.168.0.x subnet and the other connected to the 172.16.0.x subnet.

5. Turn on and login to Windows 8.1 client computer (connected to the 172.16.0.x subnet). Open Internet Explorer and load http://support.contoso.com. Web page is fetched from the NYC-SRV3 node as shown below.

Figure 9. Web page is fetched from the NYC-SRV3 node.

6. On NYC-SRV1, stop NYC-SRV3 node in the Network Load Balancing console as shown below.

Figure 10. Stopping NYC-SRV3 on Network Load Balancing Manager Console

7. On Windows 8.1 client computer, reload http://support.contoso.com. Web page is fetched from NYC-SRV2 node as shown below.

Figure 11. Web page is fetched from the NYC-SRV2 node.

Network Load Balancing cluster servers emit a heartbeat message to other hosts in the cluster, and listen for the heartbeat of other hosts. If a server in a cluster fails, the remaining hosts adjust and redistribute the workload while maintaining continuous service to their clients.

Conclusion

In this demonstration, we show that Network Load Balancing provides the following benefits:

  • Distributes client requests or network load efficiently across multiple servers
  • Ensures high availability and reliability by sending requests only to servers that are online
  • Provides the flexibility to add or subtract servers as demand dictates

On each cluster host, we installed two NICs operating on Unicast mode. This configuration not only allows cluster nodes to communicate with each other, it increases performance by diverting all cluster-related communications to a dedicated NIC. In addition, this configuration operates in unicast mode, so there are no router compatibility problems.

References

1. “Network Load Balancing”, TechTarget, http://searchservervirtualization.techtarget.com/definition/Network-Load-Balancing-NLB

2. “Network Load Balancing Technical Review”, Microsoft Developer Network, https://msdn.microsoft.com/en-us/library/bb742455.aspx

3. “Sample Configuration — Network Load Balancing (NLB) Configuration”, VMWare Knowledge Base, https://kb.vmware.com/selfservice/search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=1006778

4. “Build A Static Website On IIS Using Windows Server 2012”, Atlantic.net Community, https://www.atlantic.net/community/howto/build-static-website-on-iis/

5. “Network Address Translation FAQ”, Cisco. http://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/26704-nat-faq-00.html

6. “Configuring Windows Server 2012 R2 as a Router”, Dell Knowledge, http://www.dell.com/support/article/us/en/19/HOW10169/EN

7. “What is Load Balancing?”, Nginx, https://www.nginx.com/resources/glossary/load-balancing/

8. “Network Load Balancing cluster modes: advantages and disadvantages”, Search Windows Server TechTarget, http://searchwindowsserver.techtarget.com/tip/Network-Load-Balancing-cluster-modes-advantages-and-disadvantages

--

--