Skip to content

Commit ff33830

Browse files
authored
Merge pull request #50199 from christiankuhtz/patch-171
udp cone nat
2 parents ed9bf89 + 4161a18 commit ff33830

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

articles/load-balancer/load-balancer-outbound-connections.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,31 @@ When using [Standard Load Balancer with Availability Zones](load-balancer-standa
118118

119119
When a public Load Balancer resource is associated with VM instances, each outbound connection source is rewritten. The source is rewritten from the virtual network private IP address space to the frontend Public IP address of the load balancer. In the public IP address space, the 5-tuple of the flow (source IP address, source port, IP transport protocol, destination IP address, destination port) must be unique. Port masquerading SNAT can be used with either TCP or UDP IP protocols.
120120

121-
Ephemeral ports (SNAT ports) are used to achieve this after rewriting the private source IP address, because multiple flows originate from a single public IP address.
121+
Ephemeral ports (SNAT ports) are used to achieve this after rewriting the private source IP address, because multiple flows originate from a single public IP address. The port masquerading SNAT algorithm allocates SNAT ports differently for UDP versus TCP.
122122

123-
One SNAT port is consumed per flow to a single destination IP address, port, and protocol. For multiple flows to the same destination IP address, port, and protocol, each flow consumes a single SNAT port. This ensures that the flows are unique when they originate from the same public IP address and go to the same destination IP address, port, and protocol.
123+
#### TCP
124+
125+
One SNAT port is consumed per flow to a single destination IP address, port. For multiple TCP flows to the same destination IP address, port, and protocol, each TCP flow consumes a single SNAT port. This ensures that the flows are unique when they originate from the same public IP address and go to the same destination IP address, port, and protocol.
124126

125127
Multiple flows, each to a different destination IP address, port, and protocol, share a single SNAT port. The destination IP address, port, and protocol make flows unique without the need for additional source ports to distinguish flows in the public IP address space.
126128

129+
#### UDP
130+
131+
UDP SNAT ports are managed by a different algorithm than TCP SNAT ports. Load Balancer uses an algorithm known as "port-restricted cone NAT" for UDP. One SNAT port is consumed for each flow, irrespective of destination IP address, port.
132+
133+
#### Exhaustion
134+
127135
When SNAT port resources are exhausted, outbound flows fail until existing flows release SNAT ports. Load Balancer reclaims SNAT ports when the flow closes and uses a [4-minute idle timeout](#idletimeout) for reclaiming SNAT ports from idle flows.
128136

137+
UDP SNAT ports generally exhaust much faster than TCP SNAT ports due to the difference in algorithm. You must design and scale test with this difference in mind.
138+
129139
For patterns to mitigate conditions that commonly lead to SNAT port exhaustion, review the [Managing SNAT](#snatexhaust) section.
130140

131141
### <a name="preallocatedports"></a>Ephemeral port preallocation for port masquerading SNAT (PAT)
132142

133143
Azure uses an algorithm to determine the number of preallocated SNAT ports available based on the size of the backend pool when using port masquerading SNAT ([PAT](#pat)). SNAT ports are ephemeral ports available for a particular public IP source address.
134144

135-
The same number of SNAT ports are preallocated for UDP and TCP respectively and consumed independently per IP transport protocol.
145+
The same number of SNAT ports are preallocated for UDP and TCP respectively and consumed independently per IP transport protocol. However, the SNAT port usage is different depending on whether the flow is UDP or TCP.
136146

137147
>[!IMPORTANT]
138148
>Standard SKU SNAT programming is per IP transport protocol and derived from the load balancing rule. If only a TCP load balancing rule exists, SNAT is only available for TCP. If you have only a TCP load balancing rule and need outbound SNAT for UDP, create a UDP load balancing rule from the same frontend to the same backend pool. This will trigger SNAT programming for UDP. A working rule or health probe is not required. Basic SKU SNAT always programs SNAT for both IP transport protocol, irrespective of the transport protocol specified in the load balancing rule.

0 commit comments

Comments
 (0)