12) Tutorial to create a NAT Gateway using the Azure portal and test the NAT service:

In this tutorial, we will create a NAT gateway to provide outbound connectivity for virtual machines in Azure. To test the NAT gateway, you deploy a source and destination virtual machine. You'll test the NAT gateway by making outbound connections to a public IP address from the source to the destination virtual machine. This tutorial deploys source and destination in two different virtual networks in the same resource group for simplicity only.

If you prefer, you can do these steps using the Azure CLI or Azure PowerShell instead of the portal.

In this section you can replace the following parameters in the steps with the information below:

Image

1. Sign in to Azure

Sign in to the Azure portal https://portal.azure.com/#home. Before you deploy a VM and can use your NAT gateway, we need to create the resource group and virtual network.

2. Create the virtual network

On the upper-left side of the screen, select Create a resource > Networking > Virtual network or search for Virtual network in the search box. In Create virtual network, enter or select this information in the Basics tab:

Image

Select the IP Addresses tab or select the Next: IP Addresses button at the bottom of the page.In the IP Addresses tab, enter this information:

Image

Select Save. Select the Review + create tab or select the Review + create button. Select Create.

3. Create a VM to use the NAT gateway

We'll now create a VM to use the NAT service. This VM has a public IP to use as an instance-level Public IP to allow you to access the VM. NAT service is flow direction aware and will replace the default Internet destination in your subnet. The VM's public IP address won't be used for outbound connections.

Image

Image

4. Create the NAT Gateway

Image

5. Create a NAT gateway resource

Image

Image

Image

6. Discover the IP address of the VM

7. Sign in to VM

Open an Azure Cloud Shell in your browser. Use the IP address retrieved in the previous step to SSH to the virtual machine. Azure CLI

ssh <username>@<ip-address-destination>

You're now ready to use the NAT service.