Windows Network Load Balancing in Server 2012

By | February 20, 2014

Some need to know details about Network Load Balancing (NLB) in Server 2012:

  • Each Windows cluster can contain anywhere from 2-32 nodes.
  • It can only be used for stateless (HTTP) protocols, not stateful (file server, DB)
  • NLB can detect when a node is down.  It uses heartbeat/health-checks, priority settings, and port rules.  Port rules allow you to specify which ports (both TCP/UDP) can be load balanced.  These will primarily be 80/443 based on the stateful packet limitations
  • NLB lets you get away with not using F5 or Cisco Load Balancers but it only operates at the network layer, it can not work with the application layer.  However, it is free with Windows Server 2012.
  • NLB in Windows Server 2012 is the robust PowerShell support.  It uses the NetworkLoadBalancingClusters module.

Windows NLB vs DNS Round Robin differences:

  • DNS round robin in Windows returns the client resolver with a list of matching A records, however it has no fault tolerance and can’t ensure the client actually uses the appropriate record in the list order.
  • It is ideal to use NLB for each cluster you have, then use DNS Round Robin to point to different clusters for the same applications in different sites.

Network Load Balancing Requirements

  • All cluster nodes need to be on the same subnet, IPv4 or IPv6.
  • Convergence requires less than 250ms of latency.  Any higher can cause heart beats to be missed.
  • You can combine different editions of Win 2012 in a cluster.  You will still need identical configurations on them however.
  • Operation Modes are Unicast, Multicast, or IGMP Multicast.  In unicast a virtual is MAC is used for each member and they need a second NIC to talk to each other.    In multicast each node maintains its own MAC and communicate on a single NIC.  Lastly, in IGMP multicast it works the same however it prevents the switch from port flooding.  It prevents too many broadcasts from going through unneeded switchports.

Port Rules:

  • You can load balance certain Port IDs (i.e. 80/443) across nodes.
  • You can use two filtering modes, multi or single host.  Node weight is automatically determines and it increases scalability/availability with muti host.  In single host, node weights are assigned manually.  The lower the weight, the higher the priority.
  • The client affinity is either None, Single, or Class 3.  When set to None, it is stateless and any node can response.  Single uses stateful apps – one node works with 1 client (sticky).   This is not an ideal configuration for an application.  Lastly, Class C client affinity means you are load balancing public/internet facing apps and will look at the incoming IP and assign the whole class C to be served from a specific node.

Deploying NLB in Hyper-V:

  • Redundancy is the rule  – combining with Hyper-V can give you better results.
  • Place node VMs on separate Hyper-V hosts ideally.
  • Put VM virtual disks on separate physical platters.
  • Specify unicast mode and use private virtual switch for inter-node communications (heartbeats between servers).  Especially since secondary NICs can be added very easily.

For configuration information, I recommend starting here:

Important Powershell cmdlets:

Invoke-command -ComputerName web1, web2 -command {Install-WindowsFeaturee NLB, RSAT-NLB} – lets you run the command remotely to install NLB features.

New-NLBCluster -InterfaceName “Ethernet” -OperationMode Multicast -ClusterPrimaryIP -ClusterName web   – This configured the NLB Cluster with the mode, members, primary IP, etc.

Invoke-command {Add-DNSServerResourceRecordA -zonename -name web -IPv4Address} – Create the DNS record pointing to the cluster primary IP (aka VIP) with the appropriate hostname.

Add-NLBClusterNode -Interfacename “Ethernet” -NewNodeName “nug3” -NewNodeInterface “Ethernet” – Add an additional node member to the cluster

The old fashioned way:

wlbs command – cluster.exe has been removed from Windows Server 2012.  The command wlbs /display will give you all available options.

Important Note:  If you need to take a node offline, stopping it will drop all connections immediately.  If you do a drainstop, it will wait for their session to close before taking the server offline.  Also, the difference between Suspend and Stop is that suspending halts the NLB and NLB Cluster commands; stopping halts the NLB but allows cluster commands to be issued against the stopped host.