I’m going to start by saying that I totally missed that the setting of distribution mode on Azure’s Internal Load Balancer (ILB) service is possible. This is mostly because you don’t set the distribution mode at the ILB level – you set it at the Endpoint level (which in hindsight makes sense because that’s how you do it for the public load balancing too).
There is an excellent blog on the Azure site that covers distribution modes for public load balancing and the good news is that they also apply to internal load balancing as well. Let’s take a look.
In the example below we’ll use the following parameters:
- Cloud Service: apptier
containing - Two VMS: apptier01, apptier02
on - VNet subnet with name of ‘appsubnet’
adding a - load balancer with static IP address of 192.168.1.25
which - balances HTTP traffic based on Source and Destination IP.
Here’s the PowerShell to achieve this setup.
[code language=”PowerShell”]
# Assume you have setup PS subscription and user Account.
# Add Load Balancer to Cloud Service wrapping VMs
Add-AzureInternalLoadBalancer -ServiceName apptier `
-InternalLoadBalancerName apptierplb -SubnetName appsubnet `
-StaticVNetIPAddress 192.168.1.25
# Add Endpoints to VMs
# VM1
Get-AzureVM -ServiceName apptier -Name apptier01 | `
Add-AzureEndpoint -LBSetName ‘HttpIn’ -Name ‘HttpIn’ `
-DefaultProbe -InternalLoadBalancerName ‘apptierplb’ -Protocol tcp `
-PublicPort 80 -LocalPort 80 -LoadBalancerDistribution sourceIP | `
Update-AzureVM
# VM2
Get-AzureVM -ServiceName apptier -Name apptier02 | `
Add-AzureEndpoint -LBSetName ‘HttpIn’ -Name ‘HttpIn’ `
-DefaultProbe -InternalLoadBalancerName ‘apptierplb’ -Protocol tcp `
-PublicPort 80 -LocalPort 80 -LoadBalancerDistribution sourceIP | `
Update-AzureVM
# You can check what distribution mode is set
Get-AzureVM –ServiceName apptier –Name apptier01 | Get-AzureEndpoint
[/code]
HTH.
Reblogged this on siliconvalve.