Load balancing refers to evenly distributing load (incoming network traffic) across a group of backend resources or servers.
Azure Load Balancer operates at layer 4 of the Open Systems Interconnection (OSI) model. It's the single point of contact for clients. Load balancer distributes inbound flows that arrive at the load balancer's front end to backend pool instances. These flows are according to configured load-balancing rules and health probes. The backend pool instances can be Azure Virtual Machines or instances in a virtual machine scale set.
A public load balancer can provide outbound connections for virtual machines (VMs) inside your virtual network. These connections are accomplished by translating their private IP addresses to public IP addresses. Public Load Balancers are used to load balance internet traffic to your VMs.
An internal (or private) load balancer is used where private IPs are needed at the frontend only. Internal load balancers are used to load balance traffic inside a virtual network. A load balancer frontend can be accessed from an on-premises network in a hybrid scenario.
Why use Azure Load
Balancer?
Key scenarios that you can accomplish using Azure Standard Load Balancer include:
Load balance internal and external traffic to Azure virtual machines.
Increase availability by distributing resources within and across zones.
Configure outbound connectivity for Azure virtual machines.
Use health probes to monitor load-balanced resources.
Employ port forwarding to access virtual machines in a virtual network by public IP address and port.
Enable support for load-balancing of IPv6.
Load balance TCP and UDP flow on all ports simultaneously.
Create the virtual
network
In this section, you'll create a virtual network and subnet.
In the search box at the top of the portal, enter Virtual network. Select Virtual Networks in the search results.
In Virtual networks, select + Create.
In Create virtual network, enter or select this information in the Basics tab:
Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.
In the IP Addresses tab, enter this information:
Under Subnet name, select the word default.
In Edit subnet, enter this information:
Select Save.
Select the Security tab.
Under BastionHost, select Enable. Enter this information:
Select the Review + create tab or select the Review + create button.
Select Create.
Create NAT gateway
Network Address Translation
In this section, you'll create a NAT gateway for outbound internet access for resources in the virtual network.
In the search box at the top of the portal, enter NAT gateway. Select NAT gateways in the search results.
In NAT gateways, select + Create.
In Create network address translation (NAT) gateway, enter or select the following information:
Select the Outbound IP tab or select the Next: Outbound IP button at the bottom of the page.
In Outbound IP, select Create a new public IP address next to Public IP addresses.
Enter myNATGatewayIP in Name in Add a public IP address.
Select OK.
Select the Subnet tab or select the Next: Subnet button at the bottom of the page.
In Virtual network in the Subnet tab, select myVNet.
Select myBackendSubnet under Subnet name.
Select the blue Review + create button at the bottom of the page, or select the Review + create tab.
Select Create.
Create load
balancer:
In this section, you'll create a zone redundant load balancer that load balances virtual machines. With zone-redundancy, one or more availability zones can fail and the data path survives as long as one zone in the region remains healthy.
During the creation of the load balancer, you'll configure:
- Frontend IP address
- Backend pool
- Inbound load-balancing rules
In the search box at the top of the portal, enter Load balancer. Select Load balancers in the search results.
In the Load balancer page, select Create.
In the Basics tab of the Create load balancer page, enter, or select the following information:
Select Next: Frontend IP configuration at the bottom of the page.
In Frontend IP configuration, select + Add a frontend IP.
Enter LoadBalancerFrontend in Name.
Select IPv4 or IPv6 for the IP version.
Select IP address for the IP type.
Select Create new in Public IP address.
In Add a public IP address, enter myPublicIP for Name.
Select Zone-redundant in Availability zone.
Leave the default of Microsoft Network for Routing preference.
Select OK.
Select Add.
Select Next: Backend pools at the bottom of the page.
In the Backend pools tab, select + Add a backend pool.
Enter myBackendPool for Name in Add backend pool.
Select myVNet in Virtual network.
Select NIC or IP Address for Backend Pool Configuration.
Select IPv4 or IPv6 for IP version.
Select Add.
Select the Next: Inbound rules button at the bottom of the page.
In Load balancing rule in the Inbound rules tab, select + Add a load balancing rule.
In Add load balancing rule, enter or select the following information:
Select Add.
Select the blue Review + create button at the bottom of the page.
Select Create.
Create virtual
machines:
In this section, you'll create three VMs (myVM1, myVM2 and myVM3) in three different zones (Zone 1, Zone 2, and Zone 3).
These VMs are added to the backend pool of the load balancer that was created earlier.
In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results.
In Virtual machines, select + Create > Virtual machine.
In Create a virtual machine, type or select the values in the Basics tab:
Select the Networking tab, or select Next: Disks, then Next: Networking.
In the Networking tab, select or enter:
Select Review + create.
Review the settings, and then select Create.
Follow the steps 1 through 7 to create two more VMs with the following values and all the other settings the same as myVM1:
Install IIS:
In the search box at the top of the portal, enter Virtual machine. Select Virtual machines in the search results.
Select myVM1.
On the Overview page, select Connect, then Bastion.
Select Use Bastion.
Enter the username and password entered during VM creation.
Select Connect.
On the server desktop, navigate to Windows Administrative Tools > Windows PowerShell.
In the PowerShell Window, run the following commands to:
- Install the IIS server
- Remove the default iisstart.htm file
- Add a new iisstart.htm file that displays the name of the VM: # Install IIS server role Install-WindowsFeature -name Web-Server -IncludeManagementTools # Remove default htm file Remove-Item C:\inetpub\wwwroot\iisstart.htm # Add a new htm file that displays server name Add-Content -Path "C:\inetpub\wwwroot\iisstart.htm" -Value $("Hello World from " + $env:computername)
Close the Bastion session with myVM1.
Repeat steps 1 to 8 to install IIS and the updated iisstart.htm file on myVM2 and myVM3.
Test the load
balancer:
In the search box at the top of the page, enter Load balancer. Select Load balancers in the search results.
Find the public IP address for the load balancer on the Overview page under Public IP address.
Copy the public IP address, and then paste it into the address bar of your browser. The custom VM page of the IIS Web server is displayed in the browser.
Comments
Post a Comment