Skip to content

Commit 84a25cd

Browse files
committed
freshness
format update edit update update
1 parent 8f6ac71 commit 84a25cd

17 files changed

+175
-188
lines changed

articles/virtual-wan/nat-rules-vpn-gateway-powershell.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: 'Configure VPN NAT rules for your gateway using PowerShell'
33
titleSuffix: Azure Virtual WAN
44
description: Learn how to configure NAT rules for your VWAN VPN gateway using PowerShell.
55
services: virtual-wan
6-
author: reasuquo
6+
author: cherylmc
77
ms.service: virtual-wan
88
ms.topic: how-to
9-
ms.date: 01/20/2022
10-
ms.author: reasuquo
9+
ms.date: 04/11/2022
10+
ms.author: cherylmc
1111

1212
---
1313

@@ -20,7 +20,7 @@ This configuration uses a flow table to route traffic from an external (host) IP
2020
## Prerequisites
2121

2222
* Verify that you have an Azure subscription. If you don't already have an Azure subscription, you can activate your [MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details) or sign up for a [free account](https://azure.microsoft.com/pricing/free-trial).
23-
* This tutorial will create a NAT rule on a VpnGateway which will be associated with a VpnSiteConnection, so this assumes you have an existing VpnGateway connection to two branches with overlapping address spaces.
23+
* This tutorial creates a NAT rule on a VPN gateway that will be associated with a VPN site connection. The steps assume that you have an existing Virtual WAN VPN gateway connection to two branches with overlapping address spaces.
2424

2525
### Azure PowerShell
2626

@@ -32,11 +32,11 @@ This configuration uses a flow table to route traffic from an external (host) IP
3232

3333
## <a name="rules"></a>Configure NAT rules
3434

35-
You can configure and view NAT rules on your VPN gateway settings at any time using Azure PowerShell
35+
You can configure and view NAT rules on your VPN gateway settings at any time using Azure PowerShell.
3636

3737
:::image type="content" source="./media/nat-rules-vpn-gateway/edit-rules.png" alt-text="Screenshot showing how to edit rules."lightbox="./media/nat-rules-vpn-gateway/edit-rules.png":::
3838

39-
1. Declare the variables for the existing resources
39+
1. Declare the variables for the existing resources.
4040

4141
```azurepowershell-interactive
4242
$resourceGroup = Get-AzResourceGroup -ResourceGroupName "testRG"
@@ -45,69 +45,69 @@ You can configure and view NAT rules on your VPN gateway settings at any time us
4545
$vpnGateway = Get-AzVpnGateway -ResourceGroupName "testRG" -Name "testvpngw"
4646
```
4747

48-
1. Create the new NAT rule to ensure the Site-to-site VPN gateway is able to distinguish between the two branches with overlapping address spaces.
48+
1. Create the new NAT rule to ensure the site-to-site VPN gateway is able to distinguish between the two branches with overlapping address spaces.
4949

5050
You can set the parameters for the following values:
5151

5252
* **Name:** A unique name for your NAT rule.
5353
* **Type:** Static or Dynamic. Static one-to-one NAT establishes a one-to-one relationship between an internal address and an external address. The subnet size for both internal and external mapping must be the same for static.
5454
* **Mode:** IngressSnat or EgressSnat.
55-
* IngressSnat mode (also known as Ingress Source NAT) is applicable to traffic entering the Azure hub’s Site-to-site VPN gateway.
56-
* EgressSnat mode (also known as Egress Source NAT) is applicable to traffic leaving the Azure hub’s Site-to-site VPN gateway.
57-
* **InternalMapping:** An address prefix range of source IPs on the inside network that will be mapped to a set of external IPs. In other words, your pre-NAT address prefix range.
58-
* **ExternalMapping:** An address prefix range of destination IPs on the outside network that source IPs will be mapped to. In other words, your post-NAT address prefix range.
59-
* **Link Connection:** Connection resource that virtually connects a VPN site to the Azure Virtual WAN Hub's Site-to-site VPN gateway.
60-
61-
### Syntax
62-
63-
```
64-
New-AzVpnGatewayNatRule
65-
-ResourceGroupName <String>
66-
-ParentResourceName <String>
67-
-Name <String>
68-
[-Type <String>]
69-
[-Mode <String>]
70-
-InternalMapping <String[]>
71-
-ExternalMapping <String[]>
72-
[-InternalPortRange <String[]>]
73-
[-ExternalPortRange <String[]>]
74-
[-IpConfigurationId <String>]
75-
[-AsJob]
76-
[-DefaultProfile <IAzureContextContainer>]
77-
[-WhatIf]
78-
[-Confirm] [<CommonParameters>]
79-
```
80-
81-
```azurepowershell-interactive
55+
* IngressSnat mode (also known as Ingress Source NAT) is applicable to traffic entering the Azure hub’s site-to-site VPN gateway.
56+
* EgressSnat mode (also known as Egress Source NAT) is applicable to traffic leaving the Azure hub’s site-to-site VPN gateway.
57+
* **Internal Mapping:** An address prefix range of source IPs on the inside network that will be mapped to a set of external IPs. In other words, your pre-NAT address prefix range.
58+
* **External Mapping:** An address prefix range of destination IPs on the outside network that source IPs will be mapped to. In other words, your post-NAT address prefix range.
59+
* **Link Connection:** Connection resource that virtually connects a VPN site to the Azure Virtual WAN hub's site-to-site VPN gateway.
60+
61+
**Syntax**
62+
63+
```
64+
New-AzVpnGatewayNatRule
65+
-ResourceGroupName <String>
66+
-ParentResourceName <String>
67+
-Name <String>
68+
[-Type <String>]
69+
[-Mode <String>]
70+
-InternalMapping <String[]>
71+
-ExternalMapping <String[]>
72+
[-InternalPortRange <String[]>]
73+
[-ExternalPortRange <String[]>]
74+
[-IpConfigurationId <String>]
75+
[-AsJob]
76+
[-DefaultProfile <IAzureContextContainer>]
77+
[-WhatIf]
78+
[-Confirm] [<CommonParameters>]
79+
```
80+
81+
```azurepowershell-interactive
8282
$natrule = New-AzVpnGatewayNatRule -ResourceGroupName "testRG" -ParentResourceName "testvpngw" -Name "testNatRule" -InternalMapping "10.0.0.0/24" -ExternalMapping "1.2.3.4/32" -IpConfigurationId "Instance0" -Type Dynamic -Mode EgressSnat
8383
```
8484

85-
1. Declare the variable to create a new object for the new NAT rule
85+
1. Declare the variable to create a new object for the new NAT rule.
8686

8787
```azurepowershell-interactive
8888
$newruleobject = New-Object Microsoft.Azure.Commands.Network.Models.PSResourceId
8989
$newruleobject.Id = $natrule.Id
9090
```
9191

92-
1. Declare the variable to get the existing VPN connection
92+
1. Declare the variable to get the existing VPN connection.
9393

9494
```azurepowershell-interactive
9595
$conn = Get-AzVpnConnection -Name "Connection-VPNsite1" -ResourceGroupName "testRG" -ParentResourceName "testvpngw"
9696
```
9797

98-
1. Set the appropriate index for the NAT rule in the VPN connection
98+
1. Set the appropriate index for the NAT rule in the VPN connection.
9999

100100
```azurepowershell-interactive
101101
$conn.VpnLinkConnections
102102
$conn.VpnLinkConnections[0].EgressNatRules = $newruleobject
103103
```
104104

105-
1. Finally, update the existing VPN connection with the new NAT rule
105+
1. Update the existing VPN connection with the new NAT rule.
106106

107107
```azurepowershell-interactive
108108
Update-AzVpnConnection -Name "Connection-VPNsite1" -ResourceGroupName "testRG" -ParentResourceName "testvpngw" -VpnSiteLinkConnection $conn.VpnLinkConnections
109109
```
110110

111111
## Next steps
112112

113-
For more information about Site-to-site configurations, see [Configure a Virtual WAN Site-to-site connection](virtual-wan-site-to-site-portal.md).
113+
For more information about site-to-site configurations, see [Configure a Virtual WAN site-to-site connection](virtual-wan-site-to-site-portal.md).

0 commit comments

Comments
 (0)