Windows Server 2016 Network Load Balancing. You can use Network Load Balancing to manage two or more servers as a single virtual cluster. Network Load Balancing enhances the availability and scalability of Internet server applications such as those used on web, FTP, firewall, proxy, virtual private network (VPN), and other mission-critical servers.
New in Windows Server 2016 is it includes a new Azure-inspired Software Load Balancer (SLB) as a component of the Software Defined Networking (SDN) infrastructure. Use SLB instead of NLB if you are using SDN, are using non-Windows workloads, need outbound network address translation (NAT), or need Layer 3 (L3) or non-TCP based load balancing. You can continue to use NLB with Windows Server 2016 for non-SDN deployments.
So We got now two Load Balancing features :
Network Load Balancing (NLB) for non-SDN
Software Load Balancing (SLB) for SDN
Software Defined Networking (SDN) provides a method to centrally configure and manage physical and virtual network devices such as routers, switches, and gateways in your datacenter. Virtual network elements such as Hyper-V Virtual Switch, Hyper-V Network Virtualization, and Windows Server Gateway are designed to be integral elements of your software defined networking infrastructure. While you can still use your existing physical switches, routers, and other hardware devices, you can achieve deeper integration between the virtual network and the physical network if these devices are designed for compatibility with software defined networking.
Network Load Balancing (NLB) for non-SDN
For this demo I created a NLB script that can be found here Create a Windows Server 2016 NLB Network Load Balancing farm https://gallery.technet.microsoft.com/Create-a-Windows-Server-05a13f14
I use a couple of Windows Server 2016 server for the Load Balancing each node has two network adapters and runs IIS with a default website
Network Load Balancing is not nic teaming as nic teaming is on the same host and Network Load Balancing is combining all nodes to one VIP Virtual IP address.
First we install the NLB feature on each node.
Install-WindowsFeature NLB –IncludeManagementTools
To view a complete list of NLB CMDlets type the following CMDlet,
Get-command -module NetworkLoadBalancingClusters
To Create a New NLB Cluster you can do this in the GUI or in Powershell
First I rename the Network Adapter to get a better overview
Rename-NetAdapter -Name "Ethernet" -NewName "NLB"
New-NLBCluster –Interface “NLB” -OperationMode Unicast -ClusterPrimaryIP -ClusterName WS2016NLB –verbose
Showing the NLB cluster info
Get-NLBClusterNode | Format-List *
then I removed all the default rules why would you NLB all the ports ?
#Removing default port rule for the NLB Cluster
Write-Host "Removing default port rule…" -ForegroundColor yellow
Get-NlbClusterPortRule -HostName . | Remove-NlbClusterPortRule -Force
#Adding port rules 80
Write-Host "Added port rule for http (tcp 80)" -ForegroundColor yellow
Add-NlbClusterPortRule -Protocol Tcp -Mode Multiple -Affinity Single -StartPort 80 -EndPort 80 -InterfaceName $InterfaceName -IP $ClusterPrimaryIP| Out-Null
#Adding port rules 443
Write-Host "Added port rule for https (tcp 443)" -ForegroundColor yellow
Add-NlbClusterPortRule -Protocol Tcp -Mode Multiple -Affinity Single -StartPort 443 -EndPort 443 -InterfaceName $InterfaceName -IP $ClusterPrimaryIP| Out-Null
Now that Port 80 and 443 are in the NLB we can add some nodes
As I added the -Affinity Single option keep in mind that your application support this option. Running websites parts from different servers is sometimes a pain for the developer.
The Affinity parameter is applicable only for the Multiple hosts filtering mode.
- The None option specifies that multiple connections from the same client IP address can be handled by different cluster hosts (there is no client affinity). To allow Network Load Balancing to properly handle IP fragments, you should avoid using None when selecting UDP or Both for your protocol setting.
- The Single option specifies that NLB should direct multiple requests from the same client IP address to the same cluster host. This is the default setting for affinity. You can optionally modify the NLB client affinity to direct all client requests from a TCP/IP Class C address range (instead of a single IP address) to a single cluster host by enabling the Network option instead of the Single option. This feature ensures that clients that use multiple proxy servers to access the cluster can have their TCP connections directed to the same cluster host.
- The Network option specifies that NLB direct multiple requests from the same TCP/IP Class C address range to the same cluster host. Enabling Network affinity instead of Single affinity ensures that clients that use multiple proxy servers to access the cluster have their TCP connections directed to the same cluster host.
The use of multiple proxy servers at the client’s site causes requests from a single client to appear to originate from different computers. Assuming that all of the client’s proxy servers are located within the same address range, Network affinity ensures that client sessions are properly handled. If you do not need this capability, use Single affinity to maximize scaled performance.
adding a second node is easy in Powershell or do this in the GUI add node and follow the steps.
$InterfaceName = “NLB”
Get-NlbCluster -HostName $env:COMPUTERNAME | Add-NlbClusterNode -NewNodeName $Node2Fqdn -NewNodeInterface $InterfaceName –Verbose
and as you can see if you don’t rename all the nic adapters it looks a bit messy. If you ever need to troubleshoot then it is easy to get NLB traffic and or other network traffic.
Now that the NLB cluster is ready we can use it for say a webserver. make sure the DNS Record is created in the DNS and If you are using multiple Cluster Virtual IP’s make sure they are also in the DNS. I always use an IP for the cluster and for the websites I use separate IP’s and all sites running on different IP’s / NLB VIP If I need to change some thing on the webserver it has no impact on all the other servers. I also Added a few more NLB nodes. that has already a configured website.
Now to get this to work with IIS
That is right page not found. Check the DNS see if the record is created. and make sure the website IIS is running on this IP
Go to the IIS manager and check the website bindings, default it is listening on all IP but this is not the behavior that I want I want a NLB. So we need to set the website on the NLB IP configured earlier. When Having multiple IP on the NLB pick the right IP!
Remember this you need to do this on all the Webservers!
For creating a NLB farm you can use my script that is posted in the TechNet gallery.
Follow Me on Twitter @ClusterMVP
Follow My blog https://robertsmit.wordpress.com
Linkedin Profile Http://nl.linkedin.com/in/robertsmit
Google Me : https://www.google.nl
Bing Me : http://tinyurl.com/j6ny39w