Inbound NAT rules

An inbound NAT rule is used to forward traffic from a load balancer frontend to one or more instances in the backend pool.

Why use an inbound NAT rule?

An inbound NAT rule is used for port forwarding. Port forwarding lets you connect to virtual machines by using the load balancer frontend IP address and port number. The load balancer receives the traffic on a port, and based on the inbound NAT rule, forwards the traffic to a designated virtual machine on a specific backend port.

Types of inbound NAT rules

There are two types of inbound NAT rule available for Azure Load Balancer, single virtual machine and multiple virtual machines.

Single virtual machine

A single virtual machine inbound NAT rule is defined for a single target virtual machine. The load balancer's frontend IP address and the selected frontend port are used for connections to the virtual machine.

Diagram of a single virtual machine inbound NAT rule.

Multiple virtual machines and virtual machine scale sets

A multiple virtual machines inbound NAT rule references the entire backend pool in the rule. A range of frontend ports are preallocated based on the rule settings of Frontend port range start and Maximum number of machines in the backend pool.

Screenshot of a multiple virtual machines inbound NAT rule.

During inbound port rule creation, port mappings are made to the backend pool from the preallocated range that's defined in the rule.

When the backend pool is scaled down, existing port mappings for the remaining virtual machines persist. When the backend pool is scaled up, new port mappings are created automatically for the new virtual machines added to the backend pool. An update to the inbound NAT rule settings isn't required.

Diagram of a multiple virtual machine inbound NAT rule.

Note

If the pre-defined frontend port range doesn't have a sufficient number of frontend ports available, scaling up the backend pool will be blocked. This blockage could result in a lack of network connectivity for the new instances.

Port mapping retrieval

You can use the portal to retrieve the port mappings for virtual machines in the backend pool. For more information, see Manage inbound NAT rules.

Next steps

For more information about Azure Load Balancer inbound NAT rules, see: