In this post, I will show you how to use the Azure Load Balancer to easily setup port forwarding to Azure Resource Manager (ARM) Virtual Machines (VM).
This blog post is part of a two-part series on the topic of “Port forwarding in Azure Resource Manager Virtual Machines with Azure Load Balancer”:
I really hope you enjoy this two-part series and feel free to post your comments.
I can think of at least two reasons why you want to use port forwarding to ARM Virtual Machines:
The trick is to use the Azure Load Balancer as part of the following setup:
The diagram below shows an overview of a setup where an external Microsoft Remote Desktop (RDP) client connects to a VM on port 8088 and 8089, but the receiving VMs wants to stay compatible with the standard RDP port (3389) internally:
Step :
A client tries to access an Azure VM based on IP 50.1.2.3 and port 8088 using the RDP (remote desktop) protocol.
Step :
The client hits the Azure Load Balancer through its public IP (PIP) and the NAT rule engine selects an inbound NAT rule.
Step :
Based on the port number (8088) requested by the client the corresponding NAT rule is selected.
This NAT rule then redirects the traffic into the VM0s internal IP (10.0.1.1) on port 3389. The NAT rule is configured specifically to redirect to VM0 and Custom Port Mapping ensures that port 8088 is translated into port 3389.
Step :
VM0 receives RDP traffic on port 3389 (the standard port for RDP) and never needs to do any tricks to support the non-standard port 8088; hence staying compatible with other clients that rely on port 3389 for RDP access.
Step , and :
These steps are basically the same is step 1-4, but in this case, the client requests port 8089. The NAT rule (in step 6) is now redirecting to VM1 because port 8089 activates the NAT rule which redirects traffic to VM1 (IP 10.0.1.2) on port 3389.
Do you want to see a real-life example of how you can implement this yourself using the Azure Portal?
If the answer is yes then follow on to Part 2!
15Azure API Management news at Ignite 2021: Event Grid, GraphQL and WebSockets
AZURE NEWS: What’s new with .NET on Azure Functions – June 2021
AZURE NEWS: Azure API Management Premium tier price reduction for incremental purchased units
BUILD 2021 NEWS: “Native support for WebSocket APIs in Azure API Management”
AZURE NEWS: Enable azure site recovery (ASR) while Azure Virtual Machines are created