Skip to content

Commit 072bc75

Browse files
authored
Merge pull request #302092 from sujamiya/feature/fwconfigurednat.md
Feature/fwconfigurednat.md
2 parents d3f2bbe + a6c4dd7 commit 072bc75

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: How to set up and monitor Azure Firewall DNAT rules for secure traffic management
3+
description: Learn how to configure and monitor Azure Firewall DNAT rules to securely manage incoming traffic by translating destination IP addresses and ports, including support for FQDN filtering for dynamic backend configurations.
4+
services: firewall
5+
author: sujamiya
6+
ms.service: azure-firewall
7+
ms.topic: concept-article
8+
ms.date: 4/29/2025
9+
ms.author: sujamiya
10+
ms.custom: ai-usage
11+
---
12+
13+
# How to set up and monitor Azure Firewall DNAT rules for secure traffic management
14+
15+
Azure Firewall DNAT (Destination Network Address Translation) rules are used to filter and rout inbound traffic. They allow you to translate the public-facing destination IP address and port of incoming traffic to a private IP address and port within your network. This is useful when you want to expose a service running on a private IP (such as a web server or SSH endpoint) to the internet or another network.
16+
17+
A DNAT rule specifies:
18+
- **Source**: The source IP address or IP group from which the traffic originates.
19+
- **Destination**: The destination IP address of the Azure Firewall instance.
20+
- **Protocol**: The protocol used for the traffic (TCP or UDP).
21+
- **Destination port**: The port on the Azure Firewall instance that receives the traffic.
22+
- **Translated address**: The private IP address or FQDN to which the traffic should be routed.
23+
- **Translated port**: The port on the translated address to which the traffic should be directed.
24+
25+
When a packet matches the DNAT rule, Azure Firewall modifies the packet's destination IP address and port according to the rule before forwarding it to the specified backend server.
26+
27+
Azure Firewall supports *FQDN filtering* in DNAT rules, allowing you to specify a fully qualified domain name (FQDN) as the target for translation instead of a static IP address. This enables dynamic backend configurations and simplifies management in scenarios where the backend server's IP address can change frequently.
28+
29+
## Prerequisites
30+
31+
- An Azure subscription. If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
32+
- An Azure Firewall instance.
33+
- An Azure Firewall policy.
34+
35+
## Create a DNAT rule
36+
37+
1. In the Azure portal, navigate to your Azure Firewall instance.
38+
39+
1. In the left pane, select **Rules**.
40+
41+
1. Select **DNAT rules**.
42+
43+
1. Select **+ Add DNAT rule collection**.
44+
45+
1. In the **Add a rule collection** pane, provide the following information:
46+
47+
- **Name**: Enter a name for the DNAT rule collection.
48+
- **Priority**: Specify a priority for the rule collection. Lower numbers indicate higher priority. The range is 100-65000.
49+
- **Action**: Destination Network Address Translation (DNAT) (default).
50+
- **Rule collection group**: This is the name of the rule collection group that contains the DNAT rule collection. You can select a default group or one you created earlier.
51+
- **Rules**:
52+
- **Name**: Enter a name for the DNAT rule.
53+
- **Source type**: Select **IP Address** or [**IP Group**](create-ip-group.md).
54+
- **Source**: Enter the source IP address or select an IP group.
55+
- **Protocol**: Select the protocol (TCP or UDP).
56+
- **Destination Ports**: Enter the destination port or port range (For example: single port 80, port range 80-100, or multiple ports 80,443).
57+
- **Destination (Firewall IP address)**: Enter the destination IP address of the Azure Firewall instance.
58+
- **Translated type**: Select **IP Address** or **FQDN**.
59+
- **Translated address or FQDN**: Enter the translated IP address or FQDN.
60+
- **Translated port**: Enter the translated port.
61+
62+
1. Repeat step 5 for extra rules as needed.
63+
64+
1. Select **Add** to create the DNAT rule collection.
65+
66+
## Monitor and validate DNAT rules
67+
68+
Once you've created DNAT rules, you can monitor and troubleshoot them using the **AZFWNatRule** log. This log provides detailed insights into the DNAT rules applied to incoming traffic, including:
69+
70+
- **Timestamp**: The exact time the traffic flow occurred.
71+
- **Protocol**: The protocol used for communication (For example, TCP or UDP).
72+
- **Source IP and port**: Information about the originating traffic source.
73+
- **Destination IP and port**: The original destination details before translation.
74+
- **Translated IP and port**: The resolved IP address (if using FQDN) and the target port after translation.
75+
76+
It's important to note the following when you're analyzing the **AZFWNatRule** log:
77+
78+
- **Translated field**: For DNAT rules using FQDN filtering, the logs display the resolved IP address in the translated field instead of the FQDN.
79+
- **Private DNS zones**: Supported only within virtual networks (VNets). This feature isn't available for virtual WAN SKUs.
80+
- **Multiple IPs in DNS resolution**: If an FQDN resolves to multiple IP addresses in a private DNS zone or custom DNS servers, Azure Firewall's DNS proxy selects the first IP address from the list. This behavior is by design.
81+
- **FQDN resolution failures**:
82+
- If Azure Firewall can't resolve an FQDN, the DNAT rule doesn't match, so the traffic isn't processed.
83+
- These failures are logged in **AZFWInternalFQDNResolutionFailure** logs only if DNS proxy is enabled.
84+
- Without DNS proxy enabled, resolution failures aren't logged.
85+
86+
### Key considerations
87+
88+
The following considerations are important when using DNAT rules with FQDN filtering:
89+
90+
- **Private DNS zones**: Only supported within the virtual network and not with Azure Virtual WAN.
91+
- **Multiple IPs in DNS resolution**: Azure Firewall's DNS proxy always selects the first IP address from the resolved list (Private DNS zone or custom DNS server). This is an expected behavior.
92+
93+
Analyzing these logs can help diagnose connectivity issues and ensure traffic is routed correctly to the intended backend.
94+
95+
## Next steps
96+
97+
- Learn how to monitor Azure Firewall logs and metrics using [Azure Monitor](monitor-firewall.md).
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Azure Firewall FQDN filtering
3+
description: Learn about Azure Firewall FQDN filtering and how it works with DNAT rules, network rules, and application rules.
4+
services: firewall
5+
author: sujamiya
6+
ms.service: azure-firewall
7+
ms.topic: concept-article
8+
ms.date: 7/01/2025
9+
ms.author: sujamiya
10+
ms.custom: ai-usage
11+
---
12+
13+
# Azure Firewall FQDN filtering
14+
15+
A fully qualified domain name (FQDN) is the complete domain name of a host on the internet, such as www.microsoft.com. In Azure Firewall and Firewall policy, FQDNs can be used to filter traffic in DNAT, network, and application rules, depending on the type and direction of traffic being inspected.
16+
17+
18+
## How it works
19+
20+
Azure Firewall handles FQDN-based filtering depending on the rule type:
21+
22+
- **Application rules** use FQDNs to filter HTTP/S and MSSQL traffic. They rely on an application-level transparent proxy and the Server Name Indication (SNI) header to differentiate between FQDNs that resolve to the same IP address. In other words, FQDNs are matched and filtered against the original domain requested by the client, not based on the resolved IP address.
23+
- **Network and DNAT rules** filter traffic based on the resolved IP addresses of the FQDNs, using Azure DNS or a custom DNS server. Azure Firewall dynamically maintains and updates the list of associated IP addresses for the FQDNs, ensuring that traffic is routed correctly even if the underlying IP addresses change.
24+
25+
When DNS resolution is used, Azure Firewall:
26+
27+
- Resolves the FQDN to its corresponding IP address.
28+
- Uses the resolved IP address to apply the appropriate rule type (DNAT or network)
29+
- Refreshes FQDN-to-IP mappings every 15 seconds.
30+
- Removes IP addresses that are no longer resolved or utilized after 15 minutes.
31+
32+
## Differences between FQDN filtering in DNAT rules, and network rules, and application rules
33+
34+
### DNAT rules
35+
36+
DNAT (Destination Network Address Translation) rules are used to route inbound traffic to backend servers. These rules allow you to specify an IP address or FQDN as the target for translation. Using FQDNs in DNAT rules enables you to specify a fully qualified domain name for the backend server, which is particularly useful in dynamic environments where the backend server's IP address may change frequently.
37+
38+
**Key characteristics:**
39+
40+
- Enable inbound traffic routing to backend servers.
41+
- Support FQDN-based targeting for dynamic environments.
42+
- Useful for scenarios requiring flexible backend server configurations.
43+
44+
45+
### Network rules
46+
47+
Network rules are used for filtering traffic based on any TCP or UDP protocol, such as Network Time Protocol (NTP), Secure Shell (SSH), and Remote Desktop Protocol (RDP). Unlike application rules, network rules don't depend on an application-level proxy or the SNI header.
48+
49+
> [!NOTE]
50+
> Network rules with FQDN filtering don't support the use of wildcard characters. This limitation is intentional by design.
51+
52+
**Key characteristics:**
53+
54+
- Applicable to all TCP and UDP protocols.
55+
- Ideal for non-HTTP/S or MSSQL traffic.
56+
- Operate at the network layer without protocol-specific inspection.
57+
58+
### Application rules
59+
60+
Application rules are designed for filtering HTTP/S and MSSQL traffic. They rely on an application-level transparent proxy and the Server Name Indication (SNI) header to differentiate between FQDNs that resolve to the same IP address. These rules are ideal for scenarios where you need to control access to web services or databases.
61+
62+
**Key characteristics:**
63+
64+
- Best suited for HTTP/S and MSSQL protocols.
65+
- Use FQDN tags for Azure services like Azure Backup and HDInsight.
66+
- Provide finer granularity for supported protocols.
67+
68+
By understanding the differences between these rule types, you can effectively configure Azure Firewall to meet your organization's security and traffic management needs.
69+
70+
## Next steps
71+
72+
- Learn how Azure Firewall policy rule sets are structured [Azure Firewall Policy rule sets](policy-rule-sets.md).

articles/firewall/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ items:
2424
href: policy-rule-sets.md
2525
- name: Policy Analytics
2626
href: policy-analytics.md
27+
- name: FQDN filtering
28+
href: domain-filtering-overview.md
2729
- name: Infrastructure FQDNs
2830
href: infrastructure-fqdns.md
2931
- name: IDPS signature rule categories
@@ -151,6 +153,8 @@ items:
151153
items:
152154
- name: Add or modify rules using PowerShell
153155
href: deploy-rules-powershell.md
156+
- name: DNAT rule for filtering inbound traffic
157+
href: destination-nat-rules.md
154158
- name: DNS proxy
155159
items:
156160
- name: Overview

0 commit comments

Comments
 (0)