Remotely installing a simple network load balance on Server 2012 core using PowerShell
Remotely installing a simple network load balance on Server 2012 core using PowerShell
Recently in deploying a series of web servers I ran a across a situation where I needed a simple load balance between four servers effectively making a small web farm. In my case I wanted to perform the NLB installation and configuration using PowerShell so I could script it as part of an overall disaster recovery plan. The cmdlets for NLB have been available since the release of Server 2008 R2 I just hadn’t had a chance to try them out. Now was the time to put those cmdlets to the test.
The setup
(This content applies to Server 2008R2 and Server 2012)
My environment is very simple in this case, I have a management box running the new Windows 8 with the RSAT administration tools, but a Windows 7 box would work as well. You will need the RSAT tools for NLB so if you don’t have them jump out to Microsoft and download them.
I also have four Server 2012 core boxes already joined to the domain with IIS deployed. Before I provision the new websites I want to get the load balancing implemented and tested using the default website.
Implementing Microsoft NLB – remotely
The first step is to install the Network Load Balancing (NLB) feature on the servers. From the management station create a PowerShell remote session to the servers.
1 2 | PS> $session=New-PsSession –ComputerName web1,web2,web3,web4 PS> Invoke-Command –session $session {Import-Module ServerManager} |
* Note, the above module import is not required on Server 2012
1 | PS> Invoke-Command –session $session {Add-WindowsFeature NLB} |
After NLB is installed (no need to reboot) use the NLB cmdlets on your management client to create the load balance and add the additional nodes. In my situation I’m going to create the load balance on web1 with a cluster IP address of 10.211.55.150 and then add nodes web2, web3, and web4.
1 2 3 4 5 6 7 8 9 | PS> New-NlbCluster -HostName Web1 -InterfaceName Ethernet -ClusterName web -ClusterPrimaryIP 10.211.55.150 -OperationMode Multicast PS> Get-NlbCluster -HostName s1 | Add-NlbClusterNode -NewNodeName Web -NewNodeInterface Ethernet PS> Get-NlbCluster -HostName s1 | Add-NlbClusterNode -NewNodeName Web3 -NewNodeInterface Ethernet PS> Get-NlbCluster -HostName s1 | Add-NlbClusterNode -NewNodeName Web4 -NewNodeInterface Ethernet |
Add the new cluster IP address to your DNS and you’re good to go. I tested the load balance using the default website created during the IIS installation and failed some of the servers to make sure the load balance was performing correctly.
If you’re in need of a quick and simple load balancer, you have a free one built into windows server 2008R2 and 2012. Easy to install and configure using PowerShell.
Knowledge is PowerShell,
Jason is Director of PowerShell Technologies and an Instructor at Interface Technical Training in Phoenix, AZ.
Upcoming PowerShell classes taught by Jason:
- PPS300: PowerShell v2 and v3 Training for Administrators
- PS350AD: PowerShell v2 and v3 Training for Active Directory
- PPS350WMO: PowerShell v2 and v3 Training for Windows Management Instrumentation (WMI)
- PS400: PowerShell v2 and v3 Scripting and Tool Making Training
Attend in person or Online with RemoteLive. Also available in Video Training.
You May Also Like
Network load balance, NLB, Powershell, Remote deploy, Server 2012, web farm
A Simple Introduction to Cisco CML2
0 3703 0Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2
Cable Testers and How to Use them in Network Environments
0 668 1This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments
Configuring Windows Mobility Center and How to Turn it On and Off
1 1413 1Video 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
Pingback: How to deploy IIS websites to a web farm using PowerShell | Interface