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

Configuring Windows Mobility Center and How to Turn it On and Off

1 952 1

Video transcription Steve Fullmer: In our Windows training courses, we often share information about the Windows 8.1 Mobility Center. Mobility Center was introduced for mobile and laptop devices in Windows 7. It’s present and somewhat enhanced in Windows 8. Since we don’t have mobile devices in our classrooms, I decided to take a little bit … Continue reading Configuring Windows Mobility Center and How to Turn it On and Off

How to clone a Windows Server 2012 or 2012 R2 Domain Controller

3 1481 3

One of the coolest new features in Window Server 2012 and Windows Server 2012 R2 is the ability to clone a Domain Controller. In the past, if we had virtualized Domain Controllers and we actually took a snapshot of it and then rolled back to that snapshot, it would break the logon service on that … Continue reading How to clone a Windows Server 2012 or 2012 R2 Domain Controller

Detailed Forensic Investigation of Malware Infections – April 21, 2015

4 608 5

How does an investigator hunt down and identify unknown malware? In this recording of our IT Security training webinar on April 21, 2015, Security expert Mike Danseglio (CISSP / CEH) performed several malware investigations on infected computers and identify symptoms, find root cause, and follow the leads to determine what’s happening. He demonstrated his preferred … Continue reading Detailed Forensic Investigation of Malware Infections – April 21, 2015

Write a Comment

See what people are saying...

  1. Avatar Deepak

    I am trying to install on NLB on server 2008R2. This is not working for me.Its showing an exception commandnotfound exception. I have tried both the commands Add-windowfeature and install-windowfeature in both the cases i am getting same exception

  2. Avatar Jamesey

    Excellent article, many thanks indeed.

    Really helped with my script to Drainstop, Patch & Reboot each host in our Cluster.

  3. Avatar Shawn MacArthur

    Just doing a google search to install the NLB via PowerShell and look what pops up. Good article Rick, see you in a couple of weeks.

  4. Avatar LS

    Nice article, helped me get started with my NLB configuration / thanks

Share your thoughts...

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