Share via


Add-NetNatStaticMapping

Add-NetNatStaticMapping

Adds a static mapping to a NAT instance.

Sintassi

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>]

Descrizione dettagliata

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.

Parametri

-AsJob

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-CimSession<CimSession[]>

Esegue il cmdlet in una sessione remota o in un computer remoto. Immettere un nome di computer o un oggetto di sessione, ad esempio l'output del cmdlet New-CimSession o Get-CimSession. Il valore predefinito è la sessione corrente nel computer locale.

Alias

Session

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

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

Alias

nessuno

Obbligatorio?

true

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

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.

Alias

nessuno

Obbligatorio?

true

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-InternalIPAddress<String>

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

Alias

nessuno

Obbligatorio?

true

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

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.

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-InternalRoutingDomainId<String>

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

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-NatName<String>

Specifies the name of the NAT instance.

Alias

nessuno

Obbligatorio?

true

Posizione?

1

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-Protocol<Protocol>

Specifies the network protocol of the client computer in the internal network. I valori accettabili per questo parametro sono:

-- TCP
-- UDP

Alias

nessuno

Obbligatorio?

true

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-RemoteExternalIPAddressPrefix<String>

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

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-ThrottleLimit<Int32>

Specifica il numero massimo di operazioni simultanee che è possibile stabilire per eseguire il cmdlet. Se il parametro viene omesso o si specifica il valore 0, Windows PowerShell® calcola un valore limite ottimale per il cmdlet basato sul numero di cmdlet CIM in esecuzione nel computer. Questo valore limite si applica solo al cmdlet corrente, non alla sessione o al computer.

Alias

nessuno

Obbligatorio?

false

Posizione?

named

Valore predefinito

nessuno

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-Confirm

Richiede conferma prima di eseguire il cmdlet.

Obbligatorio?

false

Posizione?

named

Valore predefinito

False

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-WhatIf

Mostra gli effetti dell'esecuzione del cmdlet. Il cmdlet non viene eseguito.

Obbligatorio?

false

Posizione?

named

Valore predefinito

False

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

<CommonParameters>

Questo cmdlet supporta i parametri comuni: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer e -OutVariable. Per altre informazioni, vedere   about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Input

Il tipo di input è il tipo degli oggetti che è possibile reindirizzare al cmdlet.

  • None

Output

Il tipo di output corrisponde al tipo di oggetti generati dal cmdlet.

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

Esempi

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}" 

Argomenti correlati

Get-NetNatStaticMapping

Remove-NetNatStaticMapping