title | description | services | author | ms.service | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|
Filter inbound Internet traffic with Azure Firewall DNAT using the portal |
In this tutorial, you learn how to deploy and configure Azure Firewall DNAT using the Azure portal. |
firewall |
vhorne |
firewall |
tutorial |
03/02/2020 |
victorh |
mvc |
You can configure Azure Firewall Destination Network Address Translation (DNAT) to translate and filter inbound Internet traffic to your subnets. When you configure DNAT, the NAT rule collection action is set to Dnat. Each rule in the NAT rule collection can then be used to translate your firewall public IP and port to a private IP and port. DNAT rules implicitly add a corresponding network rule to allow the translated traffic. You can override this behavior by explicitly adding a network rule collection with deny rules that match the translated traffic. To learn more about Azure Firewall rule processing logic, see Azure Firewall rule processing logic.
In this tutorial, you learn how to:
[!div class="checklist"]
- Set up a test network environment
- Deploy a firewall
- Create a default route
- Configure a DNAT rule
- Test the firewall
If you don't have an Azure subscription, create a free account before you begin.
For this tutorial, you create a two peered VNets:
- VN-Hub - the firewall is in this VNet.
- VN-Spoke - the workload server is in this VNet.
- Sign in to the Azure portal at https://portal.azure.com.
- On the Azure portal home page, select Resource groups, then select Add.
- For Resource group name, type RG-DNAT-Test.
- For Subscription, select your subscription.
- For Resource group location, select a location. All subsequent resources that you create must be in the same location.
- Select Create.
First, create the VNets and then peer them.
-
From the Azure portal home page, select All services.
-
Under Networking, select Virtual networks.
-
Select Add.
-
For Name, type VN-Hub.
-
For Address space, type 10.0.0.0/16.
-
For Subscription, select your subscription.
-
For Resource group, select Use existing, and then select RG-DNAT-Test.
-
For Location, select the same location that you used previously.
-
Under Subnet, for Name type AzureFirewallSubnet.
The firewall will be in this subnet, and the subnet name must be AzureFirewallSubnet.
[!NOTE] The size of the AzureFirewallSubnet subnet is /26. For more information about the subnet size, see Azure Firewall FAQ.
-
For Address range, type 10.0.1.0/26.
-
Use the other default settings, and then select Create.
-
From the Azure portal home page, select All services.
-
Under Networking, select Virtual networks.
-
Select Add.
-
For Name, type VN-Spoke.
-
For Address space, type 192.168.0.0/16.
-
For Subscription, select your subscription.
-
For Resource group, select Use existing, and then select RG-DNAT-Test.
-
For Location, select the same location that you used previously.
-
Under Subnet, for Name type SN-Workload.
The server will be in this subnet.
-
For Address range, type 192.168.1.0/24.
-
Use the other default settings, and then select Create.
Now peer the two VNets.
- Select the VN-Hub virtual network.
- Under Settings, select Peerings.
- Select Add.
- Type Peer-HubSpoke for the Name of the peering from VN-Hub to VN-Spoke.
- Select VN-Spoke for the virtual network.
- Type Peer-SpokeHub for Name of peering from VN-Spoke to VN-Hub.
- For Allow forwarded traffic from VN-Spoke to VN-Hub select Enabled.
- Select OK.
Create a workload virtual machine, and place it in the SN-Workload subnet.
- From the Azure portal menu, select Create a resource.
- Under Popular, select Windows Server 2016 Datacenter.
Basics
- For Subscription, select your subscription.
- For Resource group, select Use existing, and then select RG-DNAT-Test.
- For Virtual machine name, type Srv-Workload.
- For Region, select the same location that you used previously.
- Type a username and password.
- Select Next: Disks.
Disks
- Select Next: Networking.
Networking
- For Virtual network, select VN-Spoke.
- For Subnet, select SN-Workload.
- For Public IP address select None.
- For Public inbound ports, select None.
- Leave the other default settings and select Next : Management.
Management
- For Boot diagnostics, select Off.
- Select Review + Create.
Review + Create
Review the summary, and then select Create. This will take a few minutes to complete.
After deployment finishes, note the private IP address for the virtual machine. It will be used later when you configure the firewall. Select the virtual machine name, and under Settings, select Networking to find the private IP address.
-
From the portal home page, select Create a resource.
-
Select Networking, and after Featured, select See all.
-
Select Firewall, and then select Create.
-
On the Create a Firewall page, use the following table to configure the firewall:
Setting Value Name FW-DNAT-test Subscription <your subscription> Resource group Use existing: RG-DNAT-Test Location Select the same location that you used previously Choose a virtual network Use existing: VN-Hub Public IP address Create new. The Public IP address must be the Standard SKU type. -
Select Review + create.
-
Review the summary, and then select Create to create the firewall.
This will take a few minutes to deploy.
-
After deployment completes, go to the RG-DNAT-Test resource group, and select the FW-DNAT-test firewall.
-
Note the private IP address. You'll use it later when you create the default route.
For the SN-Workload subnet, you configure the outbound default route to go through the firewall.
-
From the Azure portal home page, select All services.
-
Under Networking, select Route tables.
-
Select Add.
-
For Name, type RT-FWroute.
-
For Subscription, select your subscription.
-
For Resource group, select Use existing, and select RG-DNAT-Test.
-
For Location, select the same location that you used previously.
-
Select Create.
-
Select Refresh, and then select the RT-FWroute route table.
-
Select Subnets, and then select Associate.
-
Select Virtual network, and then select VN-Spoke.
-
For Subnet, select SN-Workload.
-
Select OK.
-
Select Routes, and then select Add.
-
For Route name, type FW-DG.
-
For Address prefix, type 0.0.0.0/0.
-
For Next hop type, select Virtual appliance.
Azure Firewall is actually a managed service, but virtual appliance works in this situation.
-
For Next hop address, type the private IP address for the firewall that you noted previously.
-
Select OK.
- Open the RG-DNAT-Test, and select the FW-DNAT-test firewall.
- On the FW-DNAT-test page, under Settings, select Rules.
- Select Add NAT rule collection.
- For Name, type RC-DNAT-01.
- For Priority, type 200.
- Under Rules, for Name, type RL-01.
- For Protocol, select TCP.
- For Source Addresses, type *.
- For Destination Addresses type the firewall's public IP address.
- For Destination ports, type 3389.
- For Translated Address type the private IP address for the Srv-Workload virtual machine.
- For Translated port, type 3389.
- Select Add.
- Connect a remote desktop to firewall public IP address. You should be connected to the Srv-Workload virtual machine.
- Close the remote desktop.
You can keep your firewall resources for the next tutorial, or if no longer needed, delete the RG-DNAT-Test resource group to delete all firewall-related resources.
In this tutorial, you learned how to:
[!div class="checklist"]
- Set up a test network environment
- Deploy a firewall
- Create a default route
- Configure a DNAT rule
- Test the firewall
Next, you can monitor the Azure Firewall logs.
[!div class="nextstepaction"] Tutorial: Monitor Azure Firewall logs