You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-network/nat-gateway/nat-gateway-resource.md
+19-17Lines changed: 19 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,27 +7,29 @@ ms.service: virtual-network
7
7
ms.subservice: nat
8
8
ms.topic: article
9
9
ms.workload: infrastructure-services
10
-
ms.custom: ignite-2022
11
-
ms.date: 02/25/2022
10
+
ms.custom: ignite-2022, FY23 content-maintenance
11
+
ms.date: 12/06/2022
12
12
ms.author: allensu
13
13
---
14
14
15
15
# Design virtual networks with NAT gateway
16
16
17
17
NAT gateway provides outbound internet connectivity for one or more subnets of a virtual network. Once NAT gateway is associated to a subnet, NAT provides source network address translation (SNAT) for that subnet. NAT gateway specifies which static IP addresses virtual machines use when creating outbound flows. Static IP addresses come from public IP addresses, public IP prefixes, or both. If a public IP prefix is used, all IP addresses of the entire public IP prefix are consumed by a NAT gateway. A NAT gateway can use up to 16 static IP addresses from either.
18
18
19
-
:::image type="content" source="./media/nat-overview/flow-direction1.png" alt-text="Diagram depicts a NAT gateway resource that consumes all IP addresses for a public IP prefix and directs traffic to and from two subnets of VMs and a virtual machine scale set.":::
19
+
:::image type="content" source="./media/nat-overview/flow-direction1.png" alt-text="Diagram of a NAT gateway resource with virtual machines and a Virtual Machine Scale Set.":::
20
20
21
21
*Figure: Virtual Network NAT for outbound to internet*
22
22
23
23
## How to deploy NAT
24
24
25
-
Configuring and using NAT gateway is intentionally made simple:
25
+
Deployments are intentionally made simple:
26
26
27
27
NAT gateway:
28
28
29
29
- Create a non-zonal or zonal NAT gateway.
30
+
30
31
- Assign a public IP address or public IP prefix.
32
+
31
33
- If necessary, modify TCP idle timeout (optional). Review [timers](#timers) before you change the default.
32
34
33
35
Virtual network:
@@ -52,13 +54,13 @@ NAT gateway is recommended for all production workloads where you need to connec
52
54
53
55
### Coexistence of outbound and inbound connectivity
54
56
55
-
NAT gateway, Load balancer and instance-level public IPs are flow direction aware. NAT gateway can coexist in the same virtual network as Load balancer and IL PIPs to provide outbound and inbound connectivity seamlessly. Inbound traffic through Load balancer or IL PIPs is translated separately from outbound traffic through NAT gateway.
57
+
NAT gateway, load balancer and instance-level public IPs are flow direction aware. NAT gateway can coexist in the same virtual network as a load balancer and instance-level public IPs to provide outbound and inbound connectivity seamlessly. Inbound traffic through a load balancer or instance-level public IPs is translated separately from outbound traffic through NAT gateway.
56
58
57
-
The following scenarios are examples of how to ensure coexistence of Load balancer or instancelevel public IPs for inbound with NAT gateway for outbound.
59
+
The following examples demonstrate co-existence of a load balancer or instance-level public IPs with a NAT gateway. Inbound traffic traverses the load balancer or public IP. Outbound traffic traverses the NAT gateway.
58
60
59
61
#### NAT and VM with an instance-level public IP
60
62
61
-
:::image type="content" source="./media/nat-overview/flow-direction2.png" alt-text="Diagram that depicts a NAT gateway resource that consumes all IP addresses for a public IP prefix and directs that traffic to and from two subnets that contain VMs and a virtual machine scale set.":::
63
+
:::image type="content" source="./media/nat-overview/flow-direction2.png" alt-text="Diagram of a NAT gateway resource that consumes all IP addresses for a public IP prefix. The NAT gateway directs traffic for two subnets of VMs and a Virtual Machine Scale Set.":::
62
64
63
65
*Figure: Virtual Network NAT and VM with an instance level public IP*
64
66
@@ -84,7 +86,7 @@ Any outbound configuration from a load-balancing rule or outbound rules is super
84
86
85
87
#### NAT and VM with an instance-level public IP and a standard public load balancer
86
88
87
-
:::image type="content" source="./media/nat-overview/flow-direction4.png" alt-text="Diagram that depicts a NAT gateway that supports outbound traffic to the internet from a virtual network and inbound traffic with an instance-level public I P and a public load balancer.":::
89
+
:::image type="content" source="./media/nat-overview/flow-direction4.png" alt-text="Diagram of a NAT gateway that supports outbound traffic to the internet from a virtual network. Inbound traffic is depicted with an instance-level public IP and a public load balancer.":::
88
90
89
91
*Figure: Virtual Network NAT and VM with an instance-level public IP and a standard public load balancer*
90
92
@@ -136,21 +138,21 @@ NAT gateway interacts with IP and IP transport headers of UDP and TCP flows. NAT
136
138
137
139
Source Network Address Translation (SNAT) rewrites the source of a flow to originate from a different IP address and/or port. Typically, SNAT is used when a private network needs to connect to a public host over the internet. SNAT allows multiple VM instances within the private VNet to use the same single Public IP address or set of IP addresses (prefix) to connect to the internet.
138
140
139
-
NAT gateway SNATs the private IP address and port of a virtual machine to a static public IP address and SNAT port before going outbound to the internet from a virtual network. Each new connection to the same destination endpoint uses a different SNAT port so that connections can be distinguished from one another. SNAT port exhaustion occurs when a source endpoint has run out of available SNAT ports to differentiate between new connections.
141
+
NAT gateway uses SNAT to translate the private IP address and port of a virtual machine to a static public IP address and port. Traffic is translated before leaving the virtual network for the Internet. Each new connection to the same destination endpoint uses a different SNAT port so that connections can be distinguished from one another. SNAT port exhaustion occurs when a source endpoint has run out of available SNAT ports to differentiate between new connections.
140
142
141
143
### Example SNAT flows for NAT gateway
142
144
143
145
The following example flows explain the basic concept of SNAT and how it works with NAT gateway.
144
146
145
-
In the table below the VM makes connections to destination IP 65.52.0.1 from the following source tuples (IPs and ports):
147
+
In the following table, the VM makes connections to destination IP 65.52.0.1 from the following source tuples (IPs and ports):
146
148
147
149
| Flow | Source tuple | Destination tuple |
148
150
|:---:|:---:|:---:|
149
151
| 1 | 192.168.0.16:4283 | 65.52.0.1:80 |
150
152
| 2 | 192.168.0.16:4284 | 65.52.0.1:80 |
151
153
| 3 | 192.168.0.17.5768 | 65.52.0.1:80 |
152
154
153
-
When NAT gateway is configured with public IP address 65.52.1.1, the source IPs are SNAT'd into NAT gateway's public IP address and a SNAT port as shown below:
155
+
When NAT gateway is configured with public IP address 65.52.1.1, the source IPs are translated into NAT gateway's public IP address and a SNAT port:
@@ -170,21 +172,21 @@ NAT gateway dynamically allocates SNAT ports across a subnet's private resources
170
172
171
173
Pre-allocation of SNAT ports to each virtual machine isn't required, which means SNAT ports aren't left unused by VMs not actively needing them.
172
174
173
-
:::image type="content" source="./media/nat-overview/exhaustion-threshold.png" alt-text="Diagram that depicts the inventory of all available SNAT ports used by any VM on subnets configured with NAT with an exhaustion threshold.":::
175
+
:::image type="content" source="./media/nat-overview/exhaustion-threshold.png" alt-text="Diagram of all available SNAT ports used by virtual machines on subnets configured with NAT and an exhaustion threshold.":::
174
176
175
177
*Figure: Differences in exhaustion scenarios*
176
178
177
179
After a SNAT port is released, it's available for use by any VM on subnets configured with NAT. On-demand allocation allows dynamic and divergent workloads on subnets to use SNAT ports as needed. As long as SNAT ports are available, SNAT flows will succeed.
178
180
179
181
### Source (SNAT) port reuse
180
182
181
-
NAT gateway selects a port at random out of the available inventory of ports to make new outbound connections. If NAT gateway doesn't find any available SNAT ports, then it will reuse a SNAT port. A SNAT port can be reused when connecting to a different destination IP and port as shown below with this extra flow.
183
+
NAT gateway selects a port at random out of the available inventory of ports to make new outbound connections. If NAT gateway doesn't find any available SNAT ports, then it will reuse a SNAT port. A SNAT port can be reused when connecting to a different destination IP and port as shown in the following table with this extra flow.
182
184
183
185
| Flow | Source tuple | Destination tuple |
184
186
|:---:|:---:|:---:|
185
187
| 4 | 192.168.0.16:4285 | 65.52.0.2:80 |
186
188
187
-
A NAT gateway will translate flow 4 to a SNAT port that may already be in use for other destinations as well (see flow 1 from table above). See [Scale NAT gateway](#scalability) for more discussion on correctly sizing your IP address provisioning.
189
+
A NAT gateway will translate flow 4 to a SNAT port that may already be in use for other destinations as well (see flow 1 from previous table). See [Scale NAT gateway](#scalability) for more discussion on correctly sizing your IP address provisioning.
@@ -226,15 +228,15 @@ Design recommendations for configuring timers:
226
228
227
229
- TCP keepalives can be used to provide a pattern of refreshing long idle connections and endpoint liveness detection. TCP keepalives appear as duplicate ACKs to the endpoints, are low overhead, and invisible to the application layer.
228
230
229
-
-Because UDP idle timeout timers aren't configurable, UDP keepalives should be used to ensure that the idle timeout value isn't reached, and that the connection is maintained. Unlike TCP connections, a UDP keepalive enabled on one side of the connection only applies to traffic flow in one direction. UDP keepalives must be enabled on both sides of the traffic flow in order to keep the traffic flow alive.
231
+
- UDP idle timeout timers aren't configurable, UDP keepalives should be used to ensure that the idle timeout value isn't reached, and that the connection is maintained. Unlike TCP connections, a UDP keepalive enabled on one side of the connection only applies to traffic flow in one direction. UDP keepalives must be enabled on both sides of the traffic flow in order to keep the traffic flow alive.
230
232
231
233
## Limitations
232
234
233
235
- Basic load balancers and basic public IP addresses aren't compatible with NAT. Use standard SKU load balancers and public IPs instead.
234
236
235
-
- To upgrade a basic load balancer to standard, see [Upgrade Azure Public Load Balancer](../../load-balancer/upgrade-basic-standard.md)
237
+
- To upgrade a load balancer from basic to standard, see [Upgrade Azure Public Load Balancer](../../load-balancer/upgrade-basic-standard.md)
236
238
237
-
- To upgrade a basic public IP address to standard, see [Upgrade a public IP address](../ip-services/public-ip-upgrade-portal.md)
239
+
- To upgrade a public IP address from basic to standard, see [Upgrade a public IP address](../ip-services/public-ip-upgrade-portal.md)
0 commit comments