We will look at how to create two virtual machines (Web Servers) and configure it in an availability set also deploy a public facing load balancer and distribute the requests across the virtual machines in the availability set.
While doing this lab we will also look at the Network Security group in-bound rule creation to allow http traffic, probe creation on the load balancer, load balancing rules and also the Inbound NAT rule creation.
1. Let’s begin the process by creating a virtual machine ( Windows Server 2016)
2) Use the configuration as below or you can do it according to your requirement.
3. Select the VM type according to the requirement.
4. Create new availability set and make App01 VM part of it.
5. Use storage as the managed disk.
6. On the next screen a new VNet, Subnet etc..
7. Verify the summary and click on create to begin the virtual machine deployment.
8. Similarly, create the second VM as App02 and add it under the same availability set. (VM Spec should be identical to the App01)
9. VM Features will be as below. We will need to use the same VNet and same NSG (Network Security Group) configuration.
Followed by this this configurations, let’s complete the virtual machine deployment.
Now, let’s run below command from the Powershell and install the IIS instance on both the servers. You can also create a basic HTML page and mention the server name on each page to identity load balanced traffic.
Now let’s look at the NSG in bound rule configuration.
10. Create an inbound rule to allow http traffic to the web servers. Since the NSG configuration is common for both the VMs the App01-NSG rule can be updated as below.
Add a new inbound rule on the App01-NSG object as below.
You can verify the successful configuration by typing in the public IP of the App01/App02 virtual machine IP on the Web browser. If your configurations are correct you will get an IIS webpage that you had created earlier.
11. Deploy a new public load balancer by clicking on the blade>Load balancers and then click on Add
12. Give it a name and select the type of load balancer as public as we are configuring a public facing load balancer.
13. Click on the “Public IP Address” and click on “Create New” then give it a name and select Static IP assignment.
14. You can select the Resource group from the drop down selection and also choose appropriate location as well. Then click on Create to start the deployment process. it would take a while and once it is complete, we will look at load balancer configurations.
15. Once the load balancer is deployed go to the Overview and take a note of the Public IP Address.
16. Now under the Settings, click on “Backend Pools” then click on “Add” to add the Availability Set that we created earlier.
17. Select the Availability set association choose the relevant availability set that you created. Then add the VMs under the availability set to the “Target Virtual Machine” then select the preferred IP under the Network IP Configuration.
18. Next, you need to create a “Health Probe” for the load balancer so that it can act up on certain VM health condition. Create a probe as below by accepting the default values.
19. Now click on the “Load balancing rules” under the Settings and click Add to create a new rule.
20. Give a name to Load balancer rule and set the relevant ports for backend pool servers, Select the backend pool set, then select the relevant health probe that you want to tag with this rule. Finally, click OK to create the load balancing rule.
That’s all for the load balancer configuration. The verify the configuration you can type in the Public IP Address of the load balancer on the browser and it will will display the web page that you created. If you open the same IP from a different computer it will display the page from the second App server.
If you want an RDP access to a specific VM to any of the backend pool server then you need to create a NAT rule on the Load Balancer to allow this traffic.
We will see how it can be configured. We will create a NAT rule to RDP the App01 VM.
- Go to “Inbound NAT rules” under the settings of the load balancer and then click “Add” then give it a name for the rule. We will call it RDPtoApp01 here.
- Select the service you want to NAT here. I have selected the RDP. So the ports gets populated automatically.
- Now select the “Target Virtual machine” then select the App01 VM and select the Network IP Configuration. Click ok to create the NAT Rule and try RDP to Load balancer IP.
- If the configurations are correct then you will successfully be able to RDP the App01 server.