Skip to main content

Azure Load balancer

Important Terms:

Azure load balancer overview
Load balancing provides a higher level of availability by spreading incoming requests across multiple virtual machines.
An Azure load balancer is a Layer-4 (TCP, UDP) load balancer that provides high availability by distributing incoming traffic among healthy VMs. A load balancer health probe monitors a given port on each VM and only distributes traffic to an operational VM.
You define a front-end IP configuration that contains one or more public IP addresses. This front-end IP configuration allows your load balancer and applications to be accessible over the Internet.
Virtual machines connect to a load balancer using their virtual network interface card (NIC). To distribute traffic to the VMs, a back-end address pool contains the IP addresses of the virtual (NICs) connected to the load balancer.
To control the flow of traffic, you define load balancer rules for specific ports and protocols that map to your VMs.



Configuring Load Balancer on Azure

Creating the Load Balancer:


  1. Sign in to Azure Portal.
  2. Select Create a resource > Networking > Load Balancer on the top left of the screen.

3. In the Create load balancer select the details, for resource select the one which you have created in the last session.

4. Under instance details give a name for your choice and select the region South India.

5. Under public IP address select create new and give the IP address name for your choice and click on Review + Create.




6. Once your validation gets paused then select Create.


Creating a Backend Address Pool:


To distribute traffic to the VMs, the load balancer uses a back-end address pool. The backend address pool contains the IP addresses of the virtual network interfaces (NICs) that are connected to the load balancer.
To create a back-end address pool that includes VM1 and VM2:
  1. Open the load balancer that you have created.
  2. Under Settings, select Backend pools, and then select Add. 


3. On the Add a backend pool page, type or select the following values:

  • Name: Type BackEndPool.
  • Associated to: Drop down and select Availability set.
  • Availability set: Select AVSetSouthIndia
  • 4.Select Add a target network IP configuration.
  • Add each virtual machine (MyVM1 and MyVM2) that you created to the back-end pool.
  • After you add each machine, drop down and select its Network IP configuration. 5.Select OK. 


6. On the Backend pools page, expand MyBackendPool and make sure both VM1 and VM2 are listed. 


Creating a Health Probe:


To allow the load balancer to monitor VM status, you use a health probe. The health probe dynamically adds or removes VMs from the load balancer rotation based on their response to health checks.
To create a health probe to monitor the health of the VMs:
  1. Under Settings of load balancer, select Health probes, and then select Add.

2. On the Add a health probe page, type or select the following values:


  • Name: Type HealthProbe.
  • Protocol: Drop down and select HTTP.
  • Port: Type 80.
  • Path: Accept / for the default URL. You can replace this value with any other URL.
  • Interval: Type 5. Interval is the number of seconds between probe attempts.
  • Unhealthy threshold: Type 2. This value is the number of consecutive probe failures that occur before a VM is considered unhealthy. 

  • 5. Select OK.


Creating a NAT Rule:


To create NAT rule:
  1. Under Settings of Load Balancer, select Inbound NAT Rules, and then select Add.

2 . Give a name for the rule and select the load balancer IP. Select the protocol as HTTP. For Port give the value as 3441 and select Target Virtual Machine as VM2 and then select its Network IP configuration. Choose Custom for port mapping and give target port value as 3389


3. You can now find a rule. Again, click on Add button to add rule for VM2.


4. Give a name for the rule and select the load balancer IP. Select the protocol as HTTP. For Port give the value as 3442 and select Target Virtual Machine as VM2 and then select its Network IP configuration. Choose Custom for port mapping and give target port value as 3389.   


5. These two rules will help for sharing load between VM1 and VM2 by network address translating incoming user request. 


Creating a load balancer rule:


A load balancer rule defines how traffic is distributed to the VMs. The rule defines the front-end IP configuration for incoming traffic, the back-end IP pool to receive the traffic, and the required source and destination ports.
The load balancer rule named LBRule listens to port 80 in the frontend LoadBalancerFrontEnd. The rule sends network traffic to the back-end address pool BackEndPool, also on port 80.
To create the load balancer rule:
  1. Select All resources on the left menu, and then select SouthIndia_LB from the resource list.
  2. Under Settings, select Load balancing rules, and then select Add. 
3. On the Add load balancing rule page, type or select the following values:
  • Name: Type LBRule.
  • Frontend IP address: Select SouthIndia_LBIP.
  • Protocol: Select TCP.
  • Port: Type 80.
  • Backend port: Type 80.
  • Backend pool: Select SouthIndiaBackendPool.
  • Health probe: Select HealthProbe.
  • 4 .Select OK.  

5. You can find the rule that was added now.


6. Go to the overview page at the Load Balancer menu and copy the IP address and ping it in the browser. Now you can see that the load is balancing for both VM1 and VM2. While refreshing you can see the change. 


Now, you are all set with load balancer configured for VM1 and VM2 in South Indian datacentre. Now the incoming user requests will be equally sent to VM1 and VM2.

Below is the output.




Thank you for visiting our blog.

For Azure, AWS and GCP Training classes in Pune, Mumbai, Thane, click here

Below are some awesome books, you must buy.

Comments

Popular posts from this blog

How to create and configure Azure Storage Account

Azure Storage Account A Storage Account in Azure is a logical (Virtual) division of the storage hardware at Azure Datacenters, where we are provided with the explicit access to that particular account and storage via different medium such as (Azure Portal or Storage Explorer or any other tool) to store our data which are secured with different layers of security. Microsoft allow to create a storage account at the subscription level in a resource group. Later we can link this storage account with a Virtual Network and its subnet if we want it to be used by internal users only. Further, under storage account we can use different types of storages as per our need. There are four type of storage under each storage account: Blob Storage File Storage / File Share Table Storage Queue Storage Blob Storage Blob is a type of storage where you can upload any type of file or folder with any extension. There are multiple ways to access blob storage but the most

Implementing and Managing Azure Network

Important Terms Virtual Network (VNET) An Azure Virtual Network (VNet) is a representation of your own network in the cloud. It is a logical isolation of the Azure cloud dedicated to your subscription. Subnet A subnetwork or subnet is a logical subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting. Computers that belong to a subnet are addressed with an identical most-significant bit-group in their IP addresses. Private IP Address A private IP address is a non-Internet facing IP address on an internal network. Private IP addresses are provided by network devices, such as routers, using network address translation (NAT). Public IP Address A public IP address is an IP address that can be accessed over the Internet. Like postal address used to deliver a postal mail to your home, a public IP address is the globally unique IP address assigned to a computing device. Your public IP address can be fou

How to create Azure Virtual Machine

Hi, Welcome to Our Blog. Before Creating Azure Virtual Machine, Lets understand few important terms. Azure Virtual Machine: Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized hardware, software, or a combination. Azure Virtual Machines gives you the flexibility of virtualisation for a wide range of computing solutions—development and testing, running applications and extending your datacenter. It is the freedom of open-source software configured the way you need it. It is as if it was another rack in your datacenter, giving you the power to deploy an application in seconds instead of weeks. Azure Virtual Network: Azure Virtual Network enables many types of Azure resources, such as Azure Virtual Machines (VM), to securely communicate with each other, the internet, and on-premises networks. A virtual network is scoped to a single region; however, multiple virtual networ