< Back

New-NsxEdgeNatRule

Sat Jan 18, 2020 9:15 pm

NAME New-NsxEdgeNatRule



SYNOPSIS

Creates a new NAT rule and adds it to the specified ESGs NAT configuration.





SYNTAX

New-NsxEdgeNatRule [-EdgeNat] <XmlElement> [-Vnic <Int32>] -OriginalAddress <String> -TranslatedAddress <String>

-action <String> [-Protocol <String>] [-Description <String>] [-LoggingEnabled] [-Enabled] [-OriginalPort

<String>] [-TranslatedPort <String>] [-IcmpType <String>] [-dnatMatchSourceAddress <String>]

[-snatMatchDestinationAddress <String>] [-dnatMatchSourcePort <String>] [-snatMatchDestinationPort <String>]

[-AboveRuleId <Int32>] [-Connection <PSObject>] [<CommonParameters>]





DESCRIPTION

An NSX Edge Service Gateway provides all NSX Edge services such as firewall,

NAT, DHCP, VPN, load balancing, and high availability. Each NSX Edge virtual

appliance can have a total of ten uplink and internal network interfaces and

up to 200 subinterfaces. Multiple external IP addresses can be configured

for load balancer, site???????????????to???????????????site VPN, and NAT services.



NSX Edge provides network address translation (NAT) service to protect the

IP addresses of internal (private) networks from the public network.



The New-NsxEdgeNatRule cmdlet creates a new NAT rule in the nat

configuration specified.





PARAMETERS

-EdgeNat <XmlElement>



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Vnic <Int32>



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-OriginalAddress <String>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TranslatedAddress <String>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-action <String>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Protocol <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LoggingEnabled [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Enabled [<SwitchParameter>]



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-OriginalPort <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TranslatedPort <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IcmpType <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-dnatMatchSourceAddress <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-snatMatchDestinationAddress <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-dnatMatchSourcePort <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-snatMatchDestinationPort <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AboveRuleId <Int32>



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Connection <PSObject>

PowerNSX Connection object



Required? false

Position? named

Default value $defaultNSXConnection

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action snat -OriginalAddress 192.168.44.0/24

-TranslatedAddress 198.51.100.1



Add Source NAT from Original Address 192.168.44.0/24 with Translated Address 198.51.100.1









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action snat -OriginalAddress 192.168.23.0/24

-TranslatedAddress 198.51.100.2 -vnic 0 -LoggingEnabled -Enabled



Add Source NAT from Original Address 192.168.23.0/24 with Translated Address 198.51.100.2 on vnic 0 with Logging









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action dnat -OriginalAddress 198.51.100.1

-TranslatedAddress 192.168.44.1



Add Destination NAT from Original Address 198.51.100.1 with Translated Address 192.168.44.1 (All ports)









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action dnat -OriginalAddress 198.51.100.2

-TranslatedAddress 192.168.23.1 -Protocol tcp -OriginalPort 22



Add Destination NAT from Original Address 198.51.100.2 with Translated Address 192.168.23.1 with tcp port 22









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action dnat -OriginalAddress 198.51.100.3

-TranslatedAddress 192.168.23.2 -Protocol tcp -OriginalPort 2222 -TranslatedPort 22



Add Destination NAT from Original Address 198.51.100.3 with Translated Address 192.168.23.2 with tcp port 2222 to

translated Port 22









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action dnat -OriginalAddress 198.51.100.4

-TranslatedAddress 192.168.23.4 -Protocol icmp -icmptype 8 -description "dnat with only icmptype 8"



Add Destination NAT from Original Address 198.51.100.4 with Translated Address 192.168.23.4 with protocol icmp and

icmp type 8 (icmp request) with a description









-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | New-NsxEdgeNatRule -action snat -OriginalAddress 192.168.44.0/24

-TranslatedAddress 198.51.100.1 -protocol tcp -snatMatchDestinationAddress 192.168.23.0/24

-snatMatchDestinationPort 22



Add Source NAT from Original Address 192.168.44.0/24 with Translated Address 198.51.100.1 and Match Destination

Address 192.168.23.0/24 on Match Destination Port 22

Need NSX >= 6.3.0









-------------------------- EXAMPLE 8 --------------------------



PS C:\\>Get-NsxEdge Edge01 | Get-NsxEdgeNat | new-nsxedgenatrule -action dnat -OriginalAddress 198.51.100.1

-TranslatedAddress 192.168.23.1 -protocol tcp -dnatMatchSourceAddress 192.168.44.0/24 -dnatMatchSourcePort 1024



Add Destination NAT from Original Address 198.51.100.1 with Translated Address 192.168.23.1 and Match Source

Address 192.168.44.0/24 on Match Source Port 1024

Need NSX >= 6.3.0











RELATED LINKS