Created
December 13, 2021 23:34
-
-
Save mttaggart/1fd5c6f36fed7a34cc4c76fb68d44f21 to your computer and use it in GitHub Desktop.
Hyper-V Port Forwarding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal | |
New-NetIPAddress -IPAddress 192.168.10.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)" | |
New-NetNAT -Name "NATNetwork" -InternalIPInterfaceAddressPrefix 192.168.10.0/24 | |
# Make sure target VM has an interfaces on the new switch | |
Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 22 -Protocol TCP -InternalIPAddress "192.168.10.2" -InternalPort 22 -NatName NATNetwork |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment