What is Azure Load Balancer?
Azure Load Balancer lets you balance inbound and outbound connections and service level traffic among virtual machines in your resource group. This solution improves your services by offering high availability and network performance to your applications.
There are two types of load balancer that Azure provides – Internal and Public.
- Internal Load Balancer (ILB): This distributes traffic inside a private network. ILB is beneficial in multi-tier applications where some application tiers are not in direct contact with end users.
- Public Load Balancer: This allocates inbound and outbound flow of internet traffic on your resources. It’s helpful when you want to expose your application to internet traffic.
Configuring an Internal Load Balancer
Here are the steps to configure an internal load balancer in Azure:
- Create a new Virtual Network (VNet).
- Create three new VMs within this network to serve as back-end servers.
- Now, create a new load balancer. Set its type to ‘Internal’ and assign it a private IP address.
- Under the backend pool configuration, add the three VMs created so that the traffic would be distributed among them.
- Create a health probe. It informs the load balancer about the availability of the servers in the backend pool.
- Finally, you need to configure load balancing rules where you specify the port for incoming traffic and port number which would be used for redirection.
You might want to attach a Network Security Group (NSG) to the subnet where the load balancer and VMs reside to streamline the traffic further.
Configuring a Public Load Balancer
The steps needed for setting up a public load balancer are as follows:
- First, create a new Virtual Network (VNet).
- Create two VMs within this network.
- Now create a new public load balancer. Assign it a public IP address.
- You then need to add the two VMs to the backend pool configuration of the load balancer.
- Set up a health probe as with the internal load balancer to monitor the availability of those VMs.
- Lastly, you need to create a load balancing rule. This rule dictates how the traffic is distributed among the VMs.
To expose your VMs to Internet traffic, you need to create a Network Interface with a public IP and associate it with the Virtual Machine.
Comparing Internal and Public Load Balancer
Internal Load Balancer | Public Load Balancer | |
---|---|---|
Network type | Private | Public |
Traffic | Only within VNet | Allows Internet traffic |
Use case | Multi-tier applications | Single-layer applications |
In conclusion, whether you opt to use an internal or public load balancer purely depends on the requirements of your application. Multi-layered applications that do not require external interaction often benefit from an internal load balancer. On the other hand, public load balancers are great for applications that need to interact with external users over the internet.
Practice Test
True or False: Azure Load Balancer can support both inbound and outbound scenarios.
- True
- False
Answer: True
Explanation: Azure Load Balancer supports inbound and outbound scenarios, providing low latency and high throughput, and scaling up to millions of flows for all TCP and UDP applications.
What type of Azure Load Balancer should you use to scale your applications across multiple regions?
- A. Internal Load Balancer
- B. Public Load Balancer
Answer: B. Public Load Balancer
Explanation: You should use Microsoft Azure’s Public Load Balancer to scale your applications and create high availability across multiple regions.
Azure Load Balancer supports which of the following distribution modes?
- A. Source IP
- B. Source IP and protocol
- C. Source IP, source port, destination IP, destination port, and protocol
- D. All of the above
Answer: D. All of the above
Explanation: Azure Load Balancer supports three types of distribution modes: Source IP, Source IP and protocol, as well as a tuple of source IP, source port, destination IP, destination port, and protocol.
True or False: Public Load Balancer supports only IPv4 addresses.
- True
- False
Answer: False
Explanation: Public Load Balancer supports both IPv4 and IPv6 addresses.
The Azure Load Balancer does not support which type of probe?
- A. TCP probes
- B. ICMP probes
- C. HTTP probes
Answer: B. ICMP probes
Explanation: Azure Load Balancer supports two types of health probes: TCP and HTTP. ICMP probes are not supported.
Azure Load Balancer can be configured to provide high availability across _____.
- A. Zones
- B. Clusters
- C. Both A and B
- D. None of the above
Answer: C. Both A and B
Explanation: You can configure Azure Load Balancer to provide high availability across zones and clusters.
True or False: You can’t use an Azure Load Balancer with a VPN.
- True
- False
Answer: False
Explanation: Azure Load Balancer can work with a VPN to balance internal applications across multiple Azure Virtual Networks.
Azure Load Balancer supports which types of algorithm for traffic distribution?
- A. Round-robin
- B. Session persistence
- C. Both A and B
- D. None of the above
Answer: C. Both A and B
Explanation: Azure Load Balancer supports the round-robin algorithm for traffic distribution, and session persistence to keep a client session on the same server.
What is the primary purpose of Azure’s internal load balancer?
- A. It provides inbound access to applications running within a virtual network.
- B. It distributes out-bound traffic across multiple VMs.
- C. Both A and B
- D. None of the above
Answer: A. It provides inbound access to applications running within a virtual network.
Explanation: The primary purpose of Azure’s internal load balancer is to provide inbound access to applications running within a virtual network.
True or False: Azure Load Balancer uses SNAT to provide outbound connectivity.
- True
- False
Answer: True
Explanation: Azure Load Balancer uses source network address translation (SNAT) for outbound connections from virtual machines in the backend pool.
Interview Questions
In Azure, how is traffic distributed when using a load balancer?
When using a load balancer in Azure, traffic is distributed across multiple VMs or other resources, enabling higher levels of fault tolerance and network traffic management.
How do you create an internal load balancer in Azure?
To create an Internal Load Balancer (ILB) in Azure, you would need to go to the Azure portal, select “create a resource,” select “Networking,” and then “Load Balancer”. You specify it should be an ‘Internal’ load balancer in the configuration process.
What is the purpose of a health probe in Azure load balancer?
Health probes in Azure load balancer are used to detect the health status of the instances that are associated with the load balancer. If the health probe fails, the load balancer stops sending traffic to the unhealthy instance.
What are the types of load balancers in Azure?
The two types of load balancers in Azure are Public Load Balancer and Internal Load Balancer. Public load balancer is used to manage internet traffic to your VMs. Internal load balancer is used to manage traffic between VMs in a virtual network.
Does Azure load balancer support IPv6 addresses?
Yes, Azure Load Balancer supports both IPv4 and IPv6 addresses.
What is Azure Load Balancer SKU?
Azure Load Balancer SKU is a model in Azure that defines the capability and capacity of the load balancer that you wish to use. It includes both the Standard and the Basic SKU.
What is the difference between Azure’s Basic and Standard Load Balancer?
Basic Load Balancer is free and provides simple load balancing for small-scale applications. Standard Load Balancer offers more advanced features like Availability Zones, Inbound NAT rules, and is ideal for bigger and more complex applications.
How many front-end IPs can you have with Azure load balancers?
With Azure Standard Load Balancers, you can have as many as 600 front-end IPs, while Basic Load Balancers only support up to 150.
What is the function of a backend pool in Azure load balancer?
The backend pool contains network interfaces (NICs) for the virtual machines to receive network traffic from the load balancer.
Can I use Azure PowerShell to configure a load balancer?
Yes, Azure PowerShell is one of the methods that can be used to configure a load balancer in Azure.
What protocol does Azure Load Balancer support for health probes?
Azure Load Balancer supports HTTP, HTTPS, and TCP protocols for health probes.
What happens if a VM in Azure load balancer’s backend pool fails more than two consecutive health probes?
If a VM in the backend pool fails more than two consecutive health probes, Azure Load Balancer will stop sending new connections to the unhealthy VM.
Can you assign an Azure load balancer to a specific subnet?
Yes, specific subnets can be assigned to a load balancer by using the backend pool settings.
Can a public load balancer in Azure also manage internal traffic?
No, for managing internal network traffic, you would need to use an Internal Load Balancer (ILB). A public load balancer in Azure only manages inbound and outbound internet traffic.
What does Azure Availability Zone do in the context of Azure Load Balancer?
Azure Load Balancer can take advantage of Azure Availability Zones to provide zone-redundant load balancing and withstand datacenter failures, improving resilience and application availability.