Give a private subnet internet access
- Get vm-app reaching updates.example.org through nat-gw
vm-app sits in subnet-app, a private subnet, and can't reach updates.example.org on 443 to download updates. It must not get a public IP of its own. Give subnet-app a NAT gateway.
Connect to vm-app.
ssh vm-appWhat's this?
Opens a shell on vm-app, so the next commands run on that VM. In this lab it's a shortcut. In real Azure you'd connect through something like Azure Bastion, or SSH to an address you can reach.
Try the site. It fails. Type exit when done.
curl -sI https://updates.example.orgWhat's this?
Fetches a web address and shows the reply. Tells you whether the web service itself answers, not just the port.
-squiet: no progress bar-Iask only for the headers, not the whole page
Create a Standard public IP.
az network public-ip create -g rg-lab --name pip-nat --sku StandardWhat's this?
Creates a public IP address that you can attach to things like Azure Bastion or a NAT gateway.
-gthe resource group the resources live in--namethe name of the thing to look at or change
Create the NAT gateway with it.
az network nat gateway create -g rg-lab --name nat-gw --public-ip-addresses pip-nat --idle-timeout 10What's this?
A NAT gateway gives a subnet explicit outbound internet access through the gateway's public IP.
-gthe resource group the resources live in--namethe name of the thing to look at or change
Associate it with subnet-app.
az network vnet subnet update -g rg-lab --vnet-name vnet-app --name subnet-app --nat-gateway nat-gwWhat's this?
Changes a subnet's settings, such as which NSG or route table is attached to it.
-gthe resource group the resources live in--vnet-namethe virtual network--namethe name of the thing to look at or change
Answer the question below.
Sources on Microsoft Learn (3)
?
- Resource group, the outer dashed frame
- Virtual network, with its address space top right
- Subnet, with range and usable IPs (5 reserved)
- Network security group. A small shield on a VM's NIC means the NIC has one too
- Route table on the subnet
- VM Appliance Private endpoint
- Peering Connected Initiated or access off
- Goal working Goal broken, X marks where it stops
- Private DNS zone, dotted lines go to linked VNets
- Orange pulse: what your last command changed. Drag to pan, Ctrl and scroll to zoom.