NAT gateway
A fixed, shared public address for VMs that need to reach the internet.
VMs without public IP addresses often still need to reach the internet, for updates or to call other services. A NAT gateway gives a whole subnet one (or a few) fixed public IP addresses for outgoing traffic. Nobody can start a connection inwards through it.
Azure has been removing the old hidden "default outbound access" for new networks, so a NAT gateway is now the usual way to give private VMs internet access.
Cost. About 0.045 USD an hour (roughly 25 GBP a month) plus a charge per GB of data, plus its public IP. Left as reading.
Use it when
- VMs in a private subnet need to download updates or call internet services.
- a partner only accepts traffic from addresses on its allow list, so your outgoing address must stay the same.
- many VMs make lots of outgoing connections and you want to avoid running out of ports.
How it works
- Attach to a subnet
- You associate the NAT gateway with one or more subnets in the same network.
- Public IP or prefix
- Give it one or more Standard public IP addresses, or a range (prefix).
- Outbound only
- Replies come back through it, but new connections from the internet can't.
Options
- Standard
- The usual NAT gateway, placed in one zone or none.
- StandardV2
- A newer version that can span zones for more resilience.
Example. Larkfield Group's data subnet has no public IPs. A NAT gateway with one fixed address lets its VMs fetch updates, and that address is the one Larkfield's bank has on its allow list.
Don't confuse it with
- Public IP on a VM
- Gives one VM its own address, in and out. NAT is shared and outbound only.
- Load balancer outbound rules
- Another way to share outgoing addresses, more work to set up.
- Azure Firewall
- Can also be the way out, while inspecting and filtering the traffic, for a much higher price.
Words to know
- NAT
- Network address translation: swapping private addresses for a public one on the way out.
- SNAT port
- A slot used for each outgoing connection. NAT gateways have plenty.
- Default outbound access
- The old hidden internet access Azure gave VMs with no other way out.
Where to look
- Home
- NAT gateways
- + Create
Practise it
Read it in the guide, next to the tasks and labs.
Open in Azure Portal, Hands On