Add-NetNatStaticMapping

Add-NetNatStaticMapping

Adds a static mapping to a NAT instance.

Syntax

Parameter Set: cim:CreateInstance0
Add-NetNatStaticMapping [-NatName] <String> -ExternalIPAddress <String> -ExternalPort <UInt16> -InternalIPAddress <String> -Protocol <Protocol> [-AsJob] [-CimSession <CimSession[]> ] [-InternalPort <UInt16> ] [-InternalRoutingDomainId <String> ] [-RemoteExternalIPAddressPrefix <String> ] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-NetNatStaticMapping cmdlet adds a static mapping to a network address translation (NAT) instance. A static mapping enables an incoming connection from an external network to access a host on an internal network through the NAT.

You can use NAT to share a connection to the public Internet through a single interface with a single public IP address. The computers on the private network use private, non-routable addresses. NAT maps the private addresses to the public address.

Parameters

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

Session

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExternalIPAddress<String>

Specifies the external IP address to which an incoming connection is addressed. This parameter specifies the destination IP address in the incoming packet

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ExternalPort<UInt16>

Specifies the external port to which an incoming connection is sent. This parameter specifies the destination port in the incoming TCP or UDP packets.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InternalIPAddress<String>

Specifies the IP address to which the packets from a remote machine in the external network are addressed.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InternalPort<UInt16>

Specifies the internal port to which the packets from a remote machine in the external network are sent. If you do not specify this parameter, NAT uses the port that you specify for the ExternalPort parameter for the internal port.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InternalRoutingDomainId<String>

Specifies the GUID of the routing domain of the internal interface.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NatName<String>

Specifies the name of the NAT instance.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Protocol<Protocol>

Specifies the network protocol of the client computer in the internal network. The acceptable values for this parameter are:

-- TCP
-- UDP

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RemoteExternalIPAddressPrefix<String>

Specifies the IP address prefix of the remote computer on the external network.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatStaticMapping

Examples

Example 1: Add a static mapping to a NAT instance

This command adds a static mapping to a NAT instance. The command specifies that NAT maps the external IP address to the internal IP address 192.0.02.179. The command specifies that the NAT maps the destination port 80 of the Internet resource to the source application port 8080. The command specifies that the tenant compartment that has the ID TSQATenant contains the internal address and internal port. This example uses the placeholder a.b.c.0/24 to represent a public Internet address prefix.

PS C:\> Add-NetNatStaticMapping -ExternalIPAddress "a.b.c.0/24" -ExternalPort 80 -InternalIPAddress "192.0.02.179" -InternalPort 8080 -InternalRoutingDomainId "{12345678-0000-0000-0000-123456789012}" 

Get-NetNatStaticMapping

Remove-NetNatStaticMapping