Windows Server 2008 and 2012 Network Load Balancing (NLB) Cluster using PowerShell

Home > Blogs > Windows Server > Windows Server 2008 and 2012 Network Load Balancing (NLB) Cluster using PowerShell

Windows Server 2008 and 2012 Network Load Balancing (NLB) Cluster using PowerShell

Like This Blog 4 Rick Trader
Added by July 3, 2013

One of the major improvements to NLB in Windows Server 2008R2 and Windows Server 2012 is the addition of a NetworkLoadBalancingClusters module to PowerShell.  When the NLB-RSAT are installed 35 new NLB related CMDlets are available.  In this blog we will be exploring some of the new CMDlets.

Installing Network Load Balancing Cluster.

To install the NLB feature and NLB-RSAT tool set type the following, Install-windowsfeature NLB,RSAT-NLB

001-Windows-Server-Network-Load-Balancing-NLB-Cluster-using-PowerShell

Note: In Windows Server 2008R2 the CMDlet to install a windows feature is add-windowsfeature.

To view a complete list of NLB CMDlets type the following CMDlet, Get-command -module NetworkLoadBalancingClusters

002-Get-command module-NetworkLoadBalancingClusters-NLB-using-PowerShell

Note: On Windows Server 2008R2 the NLB Manifest must be imported first before viewing a list of CMDlets.  To import the Manifest type Import-Module NetworkLoadBalancingClusters.

To get help on and individual CMDlet use the built in help system of PowerShell, ie Get-help New-NLBCluster   Use the -Full, -Detailed, -Online or -Examples for more information.

003-Get-help-New-NLBCluster-using-PowerShell

Scenario:

A network load balancing cluster needs to be configured using USSHQSVR1 and USSHQSVR2.  The cluster name will be USSHQNLB.

Creating the NLB Cluster, use the following steps to configure:

  1. To create a new NLB cluster the New-NLBCluster CMDlet will be used.  On Server1 launch PowerShell to configure NLB on the first server, type the following CMDlet,  New-NLBCluster -Interface “Ethernet” -OperationMode Multicast -ClusterPrimaryIP 172.16.10.101 -ClusterName USSHQNLB

004-ClusterName-Get-help-New-NLBCluster-using-PowerShell

  • Interface – is the user friendly name displayed for the desired interface in the Network and Sharing Center.  In my example my interface name was Ethernet.  The default name may be Local Area Connection.
  • OperationMode
    • Unicast – All cluster hosts use the same unicast MAC address.  Suitable for NLB Clusters with a single network card.
    • Multicast – Each cluster host keeps it original MAC address, but is assigned an additional NLB Cluster MAC address.   Suitable for NLB Clusters with multiple network card.
    • Igmpmulticast – Special mode to prevent the switch from being flooded.
    • ClusterPrimaryIP – Configures the primary IP address of the NLB Cluster.
    • ClusterName – [Optional] Specifies the name of the NLB Cluster.

2. Port Rules are used to control how traffic is routed to the NLB Cluster nodes depending on port.  If desired after creating the NLB cluster you may want to modify the NLB Port Rules.  PowerShell provides a set of CMDlets to manage the NLB Port Rules.  This should be accomplished prior to adding additional nodes to the NLB environment.  The primary CMDlet for accomplishing this task is Set-NLBClusterPortRule.

  • Set-NLBClusterPortRule
    • NewStartPort – Specifies the new start port for the cluster port rule. The acceptable range is between 0 and 65535.
    • NewEndPort – Specifies the new end port for the cluster port rule. The acceptable range is between 0 and 65535.
    • NewAffinity – Specifies the new affinity for the cluster port rule. There are three possible values for port rule affinity: none, single, and network.
    • Add- NLBClusterPortRule.
      • Used to add a new port rule.
    • Disable- NLBClusterPortRule.
      • Used to disable a new port rule.
    • Enable- NLBClusterPortRule.
      • Used to enable a new port rule.
    • Remove- NLBClusterPortRule.
      • Used to remove a new port rule.

Adding Nodes to the NLB Cluster.

1. The additional node can be configured either locally or remotely.  In this demo I will be configuring it remotely. Using PowerShell type Invoke-Command -Computername  USSHQSVR2 -Command {Install-Windowsfeature NLB,RSAT-NLB}  to install the NLB feature on USSHQSVR2.

005-Install-Windowsfeature-ClusterName-NLBCluster-using-PowerShell

2. To add the USSHQSVR2 to the NLB Cluster type the following, Add-NlbClusterNode -InterfaceName “Ethernet” -NewNodeName “USSHQSVR2” -NewNodeInterface “Ethernet”

006-cluster-type-NLB-Cluster-using-PowerShell

3. A 2 node NLB Cluster is now configured, to view the NLB Cluster type Get-NLBClusterNode | Format-List * (See figure 7).   To verify the NLB Cluster IIS could be installed, using the default website make an obvious change to the landing page on one server.  Create and entry in DNS for the NLB Cluster IP Address and connect to the Website for a client.  Disconnect or disable the NIC on the sever you connected to and refresh the screen.  You should see the landing page on the other server.

007-cluster-type-format-list-NLB-Cluster-using-PowerShell

Your Network Load Balancing Cluster is now all configured and tested.  Until next time Ride Safe!

Rick Trader
Windows Server Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Using Navigation Controls in a Collaboration Site in SharePoint

0 350 1

In this SharePoint training video, I want to talk about the Navigation Controls in SharePoint. They tend to fall into two kind of different categories; one with the navigation controls in a typical Collaboration Site such as a Team Site or a Project Site. These are Sites that are based on the Team Site Template … Continue reading Using Navigation Controls in a Collaboration Site in SharePoint

Windows 10 Managing, Deploying and Configuring – December 2, 2015

0 459 1

In this recorded Windows 10 training webinar from December 2, 2015, Windows Server instructor Rick Trader presents the deployment and management of Windows 10 Enterprise and the new Provisioning capability in Windows 10. Learn how to manage Windows 10 deployments using System Center Configuration Manager, Mobile Device Management and Intune. Also included in his presentation … Continue reading Windows 10 Managing, Deploying and Configuring – December 2, 2015

Windows 10 Features and Navigation – December 1, 2015

0 129 1

In this recorded Windows 10 webinar from December 1,2015, Windows Instructor Steve Fullmer presents the navigation and some of the new features associated with Windows 10 including Sysinternals Tools for Windows Client, Windows core concepts, exploring Process Explorer as well as some of the features that are not yet ready for prime time but will … Continue reading Windows 10 Features and Navigation – December 1, 2015

Write a Comment

See what people are saying...

    Share your thoughts...

    Please fill out the comment form below to post a reply.