Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Firewall private IP DNAT (Destination Network Address Translation) enables you to translate and filter inbound traffic using the firewall's private IP address instead of its public IP address. This capability is useful for scenarios involving overlapped networks or nonroutable network access where traditional public IP DNAT isn't suitable.
Private IP DNAT addresses two key scenarios:
- Overlapped networks: When multiple networks share the same IP address space
- Non-routable networks: When you need to access resources through networks that aren't directly routable
In this tutorial, you learn how to:
- Understand private IP DNAT use cases
- Deploy Azure Firewall with private IP DNAT capability
- Configure DNAT rules for overlapped network scenarios
- Configure DNAT rules for non-routable network access
- Test private IP DNAT functionality
- Validate traffic flow and rule processing
Prerequisites
- An Azure subscription. If you don't have one, create a free account before you begin.
- Azure Firewall Standard or Premium (private IP DNAT isn't supported in Basic SKU)
- Familiarity with Azure networking concepts
- Understanding of Azure Firewall rule processing logic
Important
Private IP DNAT is available only in Azure Firewall Standard and Premium SKUs. The Basic SKU doesn't support this feature.
Scenario overview
This tutorial demonstrates two common private IP DNAT scenarios:
Scenario 1: Overlapped networks
You have multiple virtual networks that use the same IP address space (for example, 10.0.0.0/16) and need to access resources across these networks without IP conflicts.
Scenario 2: Nonroutable network access
You need to provide access to resources in networks that aren't directly routable from the source, such as accessing on-premises resources through Azure Firewall.
Deploy the environment
Use the provided ARM template to create the test environment with all necessary components.
Download the deployment template
Download the ARM template from the Azure Network Security GitHub repository.
Save the
PrivateIpDnatArmTemplateV2.jsonfile to your local machine.
Deploy using Azure portal
Sign in to the Azure portal.
Select Create a resource > Template deployment (deploy using custom templates).
Select Build your own template in the editor.
Delete the existing content and paste the content of the downloaded ARM template.
Select Save.
Provide the following information:
- Subscription: Select your Azure subscription
- Resource group: Create a new resource group or select an existing one
- Region: Select your preferred Azure region
- Location: This parameter is autopopulated based on the selected region
Review the template parameters and modify as needed.
Select Review + create, then Create to deploy the template.
The deployment creates the following resources:
- Virtual networks for overlapped and nonroutable scenarios
- Azure Firewall with private IP DNAT configuration
- Virtual machines for testing connectivity
- Network security groups and route tables
- All necessary networking components
Note
The ARM template includes preconfigured DNAT rules for testing both scenarios. You can examine these rules after deployment or modify them as needed for your specific requirements.
Verify private IP DNAT rules
After the deployment completes, verify that the DNAT rules were created correctly for both scenarios.
Verify rules for overlapped networks
In the Azure portal, navigate to your Azure Firewall resource (
azfw-hub-vnet-1).Under Settings, select Firewall Policy.
Select the firewall policy (
fp-azfw-hub-vnet-1).Under Settings, select Rule collection groups.
Select
DefaultDnatRuleCollectionGroupto view the preconfigured rules.
You should see the following DNAT rules:
- ToVM2-Http: Translates
10.10.0.4:80→10.10.2.4:80(access hub-vnet-2 firewall from spoke-vnet-1) - ToVM2-Rdp: Translates
10.10.0.4:53388→10.10.2.4:3389(RDP access) - ToVM3-Http: Translates
10.10.0.4:8080→172.16.0.4:80(access branch-vnet-1 from spoke-vnet-1) - ToVM3-Rdp: Translates
10.10.0.4:53389→172.16.0.4:3389(RDP access)
Verify rules for nonroutable networks
Navigate to the second Azure Firewall resource (
azfw-hub-vnet-2).Under Settings, select Firewall Policy.
Select the firewall policy (
fp-azfw-hub-vnet-2).Under Settings, select Rule collection groups.
Select
DefaultDnatRuleCollectionGroupto view the rules for the second scenario.
You should see the following DNAT rules:
- ToVM2-Http: Translates
10.10.2.4:80→192.168.0.4:80(access spoke-vnet-2 from hub-vnet-1 firewall subnet) - ToVM2-Rdp: Translates
10.10.2.4:3389→192.168.0.4:3389(RDP access to spoke-vnet-2)
These rules demonstrate the overlapped network scenario where both spoke networks use the same IP space (192.168.0.0/24).
Set up virtual machines
Complete the VM configuration by running the provided PowerShell scripts.
Configure VM in scenario 1 (Overlapped network)
Connect to the virtual machine
win-vm-2using Azure Bastion or RDP.Open PowerShell as Administrator.
Download and run the configuration script:
# Download the script from GitHub repository Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Azure/Azure-Network-Security/master/Azure%20Firewall/Template%20-%20Private%20IP%20Dnat%20with%202%20Scenarios%20-%20Overlapped%20Network%20and%20Non-Routable%20Network/win-vm-2.ps1" -OutFile "C:\win-vm-2.ps1" # Execute the script .\win-vm-2.ps1
Configure VM in scenario 2 (Nonroutable network)
Connect to the virtual machine
win-vm-3using Azure Bastion or RDP.Open PowerShell as Administrator.
Download and run the configuration script:
# Download the script from GitHub repository Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Azure/Azure-Network-Security/master/Azure%20Firewall/Template%20-%20Private%20IP%20Dnat%20with%202%20Scenarios%20-%20Overlapped%20Network%20and%20Non-Routable%20Network/win-vm-3.ps1" -OutFile "C:\win-vm-3.ps1" # Execute the script .\win-vm-3.ps1
Test private IP DNAT functionality
Verify that the private IP DNAT configuration works correctly for both scenarios.
Test overlapped network scenario
From a client machine in the source network, attempt to connect to the Azure Firewall private IP address using the configured port.
Verify that the connection is successfully translated to the target VM in the overlapped network.
Check Azure Firewall logs to confirm rule hits and successful translation.
Test nonroutable network scenario
From the appropriate source network, connect to the Azure Firewall private IP address.
Verify access to resources in the nonroutable network through the firewall.
To ensure proper rule processing and traffic flow, monitor the firewall logs.
Monitor and troubleshoot
To monitor private IP DNAT performance, use Azure Firewall diagnostic logs and metrics.
Enable diagnostic logging
In the Azure portal, navigate to your Azure Firewall resource.
Select Diagnostic settings > + Add diagnostic setting.
Configure logging for:
- Azure Firewall Application Rule Log
- Azure Firewall Network Rule Log
- Azure Firewall NAT Rule Log
Choose your preferred destination (Log Analytics workspace, Storage account, or Event Hubs).
Key metrics to monitor
To ensure optimal performance, monitor these metrics:
- Data processed: Total amount of data processed by the firewall
- Network rule hit count: Number of network rules matched
- NAT rule hit count: Number of DNAT rules matched
- Throughput: Firewall throughput performance
Best practices
Follow these best practices when implementing private IP DNAT:
- Rule ordering: To ensure correct processing order, place more specific rules with lower priority numbers
- Source specification: Use specific source IP ranges instead of wildcards for better security
- Network segmentation: To isolate overlapped networks, implement proper network segmentation
- Monitoring: To identify performance issues, regularly monitor firewall logs and metrics
- Testing: To ensure reliability in production, thoroughly test all DNAT rules before implementing
Clean up resources
When you no longer need the test environment, delete the resource group to remove all resources created in this tutorial.
In the Azure portal, navigate to your resource group.
Select Delete resource group.
Type the resource group name to confirm deletion.
Select Delete to remove all resources.
Next steps
In this tutorial, you learned how to deploy and configure Azure Firewall private IP DNAT for overlapped and nonroutable network scenarios. You deployed the test environment, configured DNAT rules, and validated functionality.
To learn more about Azure Firewall DNAT capabilities: