NAT Forwarding switch in Windows 10 and Windows Server 2016

Use the new NAT Forwarding virtual switch in Windows 10 and Windows Server 2016

John Savill

June 29, 2016

1 Min Read
NAT Forwarding switch in Windows 10 and Windows Server 2016

Q. How do I create a NAT forwarding switch with Hyper-V in Windows 10 and Windows Server 2016?

A. Windows 10 and Windows Server 2016 adds the native ability for a NAT forwarding Hyper-V switch which is a requirement for containers that need NAT. In the RTM of Windows 10 and early Windows Server 2016 builds the switch was created using a SwitchType of NAT however this has changed in the latest builds. The PowerShell below creates a new NAT switch using subnet 192.168.1.0/24.

New-VMSwitch -SwitchName "NATSwitch" -SwitchType InternalNew-NetIPAddress –IPAddress 192.168.1.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"New-NetNat –Name NATnetwork -InternalIPInterfaceAddressPrefix 192.168.1.0/24

It's also possible to create NAT static forwarding rules which enables traffic to the host to be sent to the VM.

#Map the host IP to port 80 on VM 192.168.1.10 through switchAdd-NetNatStaticMapping -NatName NATnetwork -Protocol TCP -ExternalIPAddress 0.0.0.0 `    -InternalIPAddress 192.168.1.10 -InternalPort 81 -ExternalPort 81

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like