You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Customer intent: As an administrator, I want to deploy and configure Azure Firewall DNAT so that I can control inbound Internet access to resources located in a subnet.
12
12
---
13
13
14
14
# Filter inbound Internet or intranet traffic with Azure Firewall DNAT using the Azure portal
15
15
16
-
You can configure Azure Firewall Destination Network Address Translation (DNAT) to translate and filter inbound Internet traffic to your subnets or intranet traffic between private networks (preview). 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 or private IP address and port to a private IP address and port. DNAT rules implicitly add a corresponding network rule to allow the translated traffic. For security reasons, the recommended approach is to add a specific source to allow DNAT access to the network and avoid using wildcards. To learn more about Azure Firewall rule processing logic, see [Azure Firewall rule processing logic](rule-processing.md).
16
+
You can configure Azure Firewall Destination Network Address Translation (DNAT) to translate and filter inbound Internet traffic to your subnets or intranet traffic between private networks (preview). 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's public or private IP address and port to a private IP address and port. DNAT rules implicitly add a corresponding network rule to allow the translated traffic. For security reasons, it's recommended to add a specific source to allow DNAT access to the network and avoid using wildcards. To learn more about Azure Firewall rule processing logic, see [Azure Firewall rule processing logic](rule-processing.md).
17
17
18
18
> [!NOTE]
19
-
> This article uses classic Firewall rules to manage the firewall. The preferred method is to use [Firewall Policy](../firewall-manager/policy-overview.md). To complete this procedure using Firewall Policy, see [Tutorial: Filter inbound Internet traffic with Azure Firewall policy DNAT using the Azure portal](tutorial-firewall-dnat-policy.md)
19
+
> This article uses classic Firewall rules to manage the firewall. The preferred method is to use [Firewall Policy](../firewall-manager/policy-overview.md). To complete this procedure using Firewall Policy, see [Tutorial: Filter inbound Internet traffic with Azure Firewall policy DNAT using the Azure portal](tutorial-firewall-dnat-policy.md).
20
20
21
21
## Prerequisites
22
22
23
23
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
24
24
25
-
26
-
27
25
## Create a resource group
28
26
29
27
1. Sign in to the [Azure portal](https://portal.azure.com).
30
28
2. On the Azure portal home page, select **Resource groups**, then select **Create**.
31
-
4. For **Subscription**, select your subscription.
32
-
1. For **Resource group**, type **RG-DNAT-Test**.
29
+
3. For **Subscription**, select your subscription.
30
+
4. For **Resource group**, type **RG-DNAT-Test**.
33
31
5. For **Region**, select a region. All other resources that you create must be in the same region.
34
32
6. Select **Review + create**.
35
-
1. Select **Create**.
33
+
7. Select **Create**.
36
34
37
35
## Set up the network environment
38
36
39
-
For this article, you create a two peered VNets:
37
+
For this article, you create two peered VNets:
40
38
41
-
-**VN-Hub** - the firewall is in this VNet.
42
-
-**VN-Spoke** - the workload server is in this VNet.
39
+
-**VN-Hub** - the firewall is in this virtual network.
40
+
-**VN-Spoke** - the workload server is in this virtual network.
43
41
44
42
First, create the VNets and then peer them.
45
43
46
-
### Create the Hub VNet
44
+
### Create the Hub virtual network
47
45
48
46
1. From the Azure portal home page, select **All services**.
49
47
2. Under **Networking**, select **Virtual networks**.
50
48
3. Select **Create**.
51
-
7. For **Resource group**, select **RG-DNAT-Test**.
52
-
1. For **Name**, type **VN-Hub**.
53
-
1. For **Region**, select the same region that you used before.
54
-
1. Select **Next**.
55
-
1. On the **Security** tab, select **Next**.
56
-
1. For **IPv4 Address space**, accept the default **10.0.0.0/16**.
57
-
1. Under **Subnets**, select **default**.
58
-
1. For **Subnet template**, select**Azure Firewall**.
49
+
4. For **Resource group**, select **RG-DNAT-Test**.
50
+
5. For **Name**, type **VN-Hub**.
51
+
6. For **Region**, select the same region that you used before.
52
+
7. Select **Next**.
53
+
8. On the **Security** tab, select **Next**.
54
+
9. For **IPv4 Address space**, accept the default **10.0.0.0/16**.
55
+
10. Under **Subnets**, select **default**.
56
+
11. For **Subnet template**, select **Azure Firewall**.
59
57
60
-
The firewall will be in this subnet, and the subnet name **must** be AzureFirewallSubnet.
61
-
> [!NOTE]
62
-
> The size of the AzureFirewallSubnet subnet is /26. For more information about the subnet size, see [Azure Firewall FAQ](firewall-faq.yml#why-does-azure-firewall-need-a--26-subnet-size).
58
+
The firewall is in this subnet, and the subnet name **must** be AzureFirewallSubnet.
59
+
> [!NOTE]
60
+
> The size of the AzureFirewallSubnet subnet is /26. For more information about the subnet size, see [Azure Firewall FAQ](firewall-faq.yml#why-does-azure-firewall-need-a--26-subnet-size).
63
61
64
-
11. Select **Save**.
65
-
1. Select **Review + create**.
66
-
1. Select **Create**.
62
+
12. Select **Save**.
63
+
13. Select **Review + create**.
64
+
14. Select **Create**.
67
65
68
-
### Create a spoke VNet
66
+
### Create a spoke virtual network
69
67
70
68
1. From the Azure portal home page, select **All services**.
71
69
2. Under **Networking**, select **Virtual networks**.
72
70
3. Select **Create**.
73
-
1. For **Resource group**, select **RG-DNAT-Test**.
74
-
1. For **Name**, type **VN-Spoke**.
75
-
1. For **Region**, select the same region that you used before.
76
-
1. Select **Next**.
77
-
1. On the **Security** tab, select **Next**.
78
-
1. For **IPv4 Address space**, edit the default and type **192.168.0.0/16**.
79
-
1. Under **Subnets**, select **default**.
80
-
1. For the subnet **Name** type **SN-Workload**.
81
-
1. For **Starting address**, type **192.168.1.0**.
82
-
1. For **Subnet size**, select **/24**.
83
-
1. Select **Save**.
84
-
1. Select **Review + create**.
85
-
1. Select **Create**.
71
+
4. For **Resource group**, select **RG-DNAT-Test**.
72
+
5. For **Name**, type **VN-Spoke**.
73
+
6. For **Region**, select the same region that you used before.
74
+
7. Select **Next**.
75
+
8. On the **Security** tab, select **Next**.
76
+
9. For **IPv4 Address space**, edit the default and type **192.168.0.0/16**.
77
+
10. Under **Subnets**, select **default**.
78
+
11. For the subnet **Name**, type **SN-Workload**.
79
+
12. For **Starting address**, type **192.168.1.0**.
80
+
13. For **Subnet size**, select **/24**.
81
+
14. Select **Save**.
82
+
15. Select **Review + create**.
83
+
16. Select **Create**.
86
84
87
85
### Peer the VNets
88
86
@@ -92,9 +90,9 @@ Now peer the two VNets.
92
90
2. Under **Settings**, select **Peerings**.
93
91
3. Select **Add**.
94
92
4. Under **This virtual network**, for the **Peering link name**, type **Peer-HubSpoke**.
95
-
5. Under **Remote virtual network**, for **Peering link name**, type **Peer-SpokeHub**.
96
-
1. Select **VN-Spoke** for the virtual network.
97
-
1. Accept all the other defaults, and then select **Add**.
93
+
5. Under **Remote virtual network**, for **Peering link name**, type **Peer-SpokeHub**.
94
+
6. Select **VN-Spoke** for the virtual network.
95
+
7. Accept all the other defaults, and then select **Add**.
98
96
99
97
## Create a virtual machine
100
98
@@ -106,22 +104,23 @@ Create a workload virtual machine, and place it in the **SN-Workload** subnet.
106
104
**Basics**
107
105
108
106
1. For **Subscription**, select your subscription.
109
-
1. For **Resource group**, select **RG-DNAT-Test**.
110
-
1. For **Virtual machine name**, type **Srv-Workload**.
111
-
1. For **Region**, select the same location that you used previously.
112
-
1. Type a username and password.
113
-
1. Select **Next: Disks**.
107
+
2. For **Resource group**, select **RG-DNAT-Test**.
108
+
3. For **Virtual machine name**, type **Srv-Workload**.
109
+
4. For **Region**, select the same location that you used previously.
110
+
5. Type a username and password.
111
+
6. Select **Next: Disks**.
114
112
115
113
**Disks**
114
+
116
115
1. Select **Next: Networking**.
117
116
118
117
**Networking**
119
118
120
119
1. For **Virtual network**, select **VN-Spoke**.
121
120
2. For **Subnet**, select **SN-Workload**.
122
121
3. For **Public IP**, select **None**.
123
-
4. For **Public inbound ports**, select **None**.
124
-
2. Leave the other default settings and select **Next: Management**.
122
+
4. For **Public inbound ports**, select **None**.
123
+
5. Leave the other default settings and select **Next: Management**.
125
124
126
125
**Management**
127
126
@@ -130,94 +129,94 @@ Create a workload virtual machine, and place it in the **SN-Workload** subnet.
130
129
**Monitoring**
131
130
132
131
1. For **Boot diagnostics**, select **Disable**.
133
-
1. Select **Review + Create**.
132
+
2. Select **Review + Create**.
134
133
135
134
**Review + Create**
136
135
137
-
Review the summary, and then select **Create**. This takes a few minutes to complete.
136
+
Review the summary, and then select **Create**. This process takes a few minutes to complete.
138
137
139
-
After deployment finishes, note the private IP address for the virtual machine. It is used later when you configure the firewall. Select the virtual machine name. Select **Overview**, and under **Networking** note the private IP address.
138
+
After the deployment finishes, note the private IP address of the virtual machine. You need this IP address later when configuring the firewall. Select the virtual machine name, go to **Overview**, and under **Networking**, note the private IP address.
|Region |Select the same location used previously|
155
+
|Firewall SKU|**Standard**|
156
+
|Firewall management|**Use Firewall rules (classic) to manage this firewall**|
157
+
|Choose a virtual network |**Use existing**: VN-Hub|
158
+
|Public IP address |**Add new**, Name: **fw-pip**|
160
159
161
160
5. Accept the other defaults, and then select **Review + create**.
162
-
6. Review the summary, and then select **Create** to create the firewall.
161
+
6. Review the summary, and then select **Create** to deploy the firewall.
163
162
164
-
This takes a few minutes to deploy.
165
-
7. After deployment completes, go to the **RG-DNAT-Test** resource group, and select the **FW-DNAT-test** firewall.
166
-
8. Note the firewall's private and public IP addresses. You'll use them later when you create the default route and NAT rule.
163
+
This process takes a few minutes to complete.
164
+
7. After deployment completes, go to the **RG-DNAT-Test** resource group and select the **FW-DNAT-test** firewall.
165
+
8. Note the firewall's private and public IP addresses. You use them later when creating the default route and NAT rule.
167
166
168
167
## Create a default route
169
168
170
-
For the **SN-Workload** subnet, you configure the outbound default route to go through the firewall.
169
+
For the **SN-Workload** subnet, configure the outbound default route to go through the firewall.
171
170
172
171
> [!IMPORTANT]
173
-
> You do not need to configure an explicit route back to the firewall at the destination subnet. Azure Firewall is a stateful service and handles the packets and sessions automatically. If you create this route, you'll create an asymmetrical routing environment that interrupts the stateful session logic and results in dropped packets and connections.
172
+
> You don't need to configure an explicit route back to the firewall at the destination subnet. Azure Firewall is a stateful service and handles the packets and sessions automatically. Creating this route would result in an asymmetrical routing environment, interrupting the stateful session logic and causing dropped packets and connections.
174
173
175
174
1. From the Azure portal home page, select **Create a resource**.
176
175
2. Search for **Route table** and select it.
177
176
3. Select **Create**.
178
-
5. For **Subscription**, select your subscription.
179
-
1. For **Resource group**, select **RG-DNAT-Test**.
180
-
1. For **Region**, select the same region that you used previously.
181
-
1. For **Name**, type **RT-FWroute**.
182
-
1. Select **Review + create**.
183
-
1. Select **Create**.
184
-
1. Select **Go to resource**.
185
-
1. Select **Subnets**, and then select **Associate**.
186
-
1. For **Virtual network**, select **VN-Spoke**.
187
-
1. For **Subnet**, select **SN-Workload**.
188
-
1. Select **OK**.
189
-
1. Select **Routes**, and then select **Add**.
190
-
1. For **Route name**, type **FW-DG**.
191
-
1. For **Destination type**, select **IP Addresses**.
192
-
1. For **Destination IP addresses/CIDR ranges**, type **0.0.0.0/0**.
193
-
1. For **Next hop type**, select **Virtual appliance**.
194
-
195
-
Azure Firewall is actually a managed service, but virtual appliance works in this situation.
196
-
18. For **Next hop address**, type the private IP address for the firewall that you noted previously.
197
-
19. Select **Add**.
177
+
4. For **Subscription**, select your subscription.
178
+
5. For **Resource group**, select **RG-DNAT-Test**.
179
+
6. For **Region**, select the same region used previously.
180
+
7. For **Name**, type **RT-FWroute**.
181
+
8. Select **Review + create**.
182
+
9. Select **Create**.
183
+
10. Select **Go to resource**.
184
+
11. Select **Subnets**, and then select **Associate**.
185
+
12. For **Virtual network**, select **VN-Spoke**.
186
+
13. For **Subnet**, select **SN-Workload**.
187
+
14. Select **OK**.
188
+
15. Select **Routes**, and then select **Add**.
189
+
16. For **Route name**, type **FW-DG**.
190
+
17. For **Destination type**, select **IP Addresses**.
191
+
18. For **Destination IP addresses/CIDR ranges**, type **0.0.0.0/0**.
192
+
19. For **Next hop type**, select **Virtual appliance**.
193
+
194
+
Azure Firewall is a managed service, but selecting virtual appliance works in this situation.
195
+
20. For **Next hop address**, type the private IP address of the firewall noted previously.
196
+
21. Select **Add**.
198
197
199
198
## Configure a NAT rule
200
199
201
-
1. Open the **RG-DNAT-Test** resource group, and select the **FW-DNAT-test** firewall.
202
-
2. On the **FW-DNAT-test** page, under **Settings**, select **Rules (classic)**.
203
-
3. Select **Add NAT rule collection**.
204
-
4. For **Name**, type **RC-DNAT-01**.
205
-
5. For **Priority**, type **200**.
200
+
1. Open the **RG-DNAT-Test** resource group, and select the **FW-DNAT-test** firewall.
201
+
2. On the **FW-DNAT-test** page, under **Settings**, select **Rules (classic)**.
202
+
3. Select **Add NAT rule collection**.
203
+
4. For **Name**, type **RC-DNAT-01**.
204
+
5. For **Priority**, type **200**.
206
205
6. Under **Rules**, for **Name**, type **RL-01**.
207
206
7. For **Protocol**, select **TCP**.
208
-
1. For **Source type**, select **IP address**.
209
-
1. For **Source**, type *.
210
-
1. For **Destination Addresses**, type the firewall's public or private IP address.
211
-
1. For **Destination ports**, type **3389**.
212
-
1. For **Translated Address** type the private IP address for the Srv-Workload virtual machine.
213
-
1. For **Translated port**, type **3389**.
214
-
1. Select **Add**.
207
+
8. For **Source type**, select **IP address**.
208
+
9. For **Source**, type *.
209
+
10. For **Destination Addresses**, type the firewall's public or private IP address.
210
+
11. For **Destination ports**, type **3389**.
211
+
12. For **Translated Address**, type the private IP address of the Srv-Workload virtual machine.
212
+
13. For **Translated port**, type **3389**.
213
+
14. Select **Add**.
215
214
216
-
This takes a few minutes to complete.
215
+
This process takes a few minutes to complete.
217
216
218
217
## Test the firewall
219
218
220
-
1. Connect a remote desktop to firewall public IP address. You should be connected to the **Srv-Workload** virtual machine.
219
+
1. Connect a remote desktop to the firewall's public IP address. You should be connected to the **Srv-Workload** virtual machine.
0 commit comments