Configuring an ILB – Configuring Load Balancing


Configuring an ILB

In this demonstration, we are going to create and configure a load balancer from the Azure portal. We are going to route internal traffic with a basic load balancer to spread incoming requests to multiple VMs. For this demonstration, we are going to create a load balancer, backend servers, and network resources at the Basic pricing tier.

Creating the VNet

First, we are going to create the VNet, backend servers, and a test VM. To do this, take the following steps:

  1. Navigate to the Azure portal by opening https://portal.azure.com.
  2. Create a new resource group for this exercise named AZ104-InternalLoadBalancer. Open the resource group once created, click Overview on the left menu, then clickCreate.
  3. Type virtual network in the search bar and click Virtual network:

Figure 16.3 – Creating a virtual network

  1. Click Create.
  2. Enter the following values for the Basics tab, then click Next : IP Addresses >:

‚ Subscription: Select a subscription

‚ Resource group: AZ104-InternalLoadBalancer

‚ Name: PacktLBVnet

‚ Region: A region of your choice (choose the same region for all subsequent resources in this chapter)

  1. Enter the following values for the IP Addresses tab, and click Next : Security >. Set IPv4 address space to 172.16.0.0/16, set Subnet name to
    PacktLBBackendSubnet, and set Subnet address range to 172.16.0.0/24. You can leave the default configuration for NAT GATEWAY and Services. Click Add.
  2. Set the following options:

‚ Bastion Host: Disable

‚ DDOS Protection Standard: Disable

‚ Firewall: Disable

  1. Click Review + create. Click Create.

Now that the VNet is in place, you will now work on creating the VMs.

Creating the VMs

Please ensure that the AZ module is installed as per the Technical requirements section at the beginning of the chapter.

In the next demonstration, we are going to create three Windows Server VMs from PowerShell and place them in an Availability Set. To do so, you will perform the following steps:

Note: Change the parameters to suit your requirements.

#First connect your Azure account using your credentials Connect-AzAccount

#Parameters

$ResourceGroup = “AZ104-InternalLoadBalancer”

$Location = “WestEurope”

$SubscriptionId = “xxxxxxx”

$AvailabilitySetName = “PacktLBAvailabilitySet”

$VirtualNetworkName = “PacktLBVnet”

$SubnetName = “PacktLBBackendSubnet”

$VMUserName = “Packtadmin”

$VMPassword = “P@55w0rd()”

#If necessary, select the right subscription as follows Select-AzSubscription -SubscriptionId $SubscriptionId

#Create an Availability Set for the VMs

New-AzAvailabilitySet -Location “$Location” -Name

“$AvailabilitySetName” -ResourceGroupName “$ResourceGroup” -Sku aligned -PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 2

#Set up Your VM Admin Credentials

[securestring]$secStringPassword = ConvertTo-SecureString $VMPassword -AsPlainText -Force

[pscredential]$cred = New-Object System.Management.Automation. PSCredential ($VMUserName, $secStringPassword)

#Deploy two VMs Inside the Availability Set for ($vmNum=1; $vmNum -le 3; $vmNum++){

if ($vmNum -eq 3){$vmName = “PacktLBVMTest”} # Test VM

else{$vmName = “PacktLBVM$vmNum”}

New-AzVm -ResourceGroupName “$ResourceGroup” -Name

“$vmName” -Location “$Location” -VirtualNetworkName

“$VirtualNetworkName” -SubnetName “$SubnetName”

-SecurityGroupName “PacktNetworkSecurityGroup”

-PublicIpAddressName “$($vmName)PublicIpAddress”

-AvailabilitySetName “$AvailabilitySetName” -Credential $cred

-OpenPorts 3389 -Size “Standard_DS1_v2”

}

Now that your VMs are deployed, we will work on the load balancer next.

Leave a Reply

Your email address will not be published. Required fields are marked *