Configuring NAT for Hyper-V VMs

# Create new switch  
New-VMSwitch -SwitchName NAT -SwitchType Internal

# You can find the interface index by running: Get-NetAdapter

# Run the following to create the NAT Gateway:

New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceIndex 53

# Configure the NAT network

New-NetNat -Name NAT -InternalIPInterfaceAddressPrefix “”

# Add a static mapping to a NAT

A static mapping enables an incoming connection from an external network to access a host on an internal network through the NAT.

Add-NetNatStaticMapping -NatName NAT -Protocol TCP -ExternalIPAddress "" -ExternalPort 80 -InternalIPAddress "" -InternalPort 80

One thought on “Configuring NAT for Hyper-V VMs

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s