Static IPs with NAT on Hyper-V

The goal is to have networking with static ip addresses for virtual machines on Hyper-V. The machine must also be able to access the internet. The easiest way is to start a Powershell session with elevated rights. Then use the follwing three commands. Feel free to change any names and ip address ranges. Create a new switch New-VMSwitch -SwitchName "NAT Switch 192.168.40.x" -SwitchType Internal Assign and IP address New-NetIPAddress -IPAddress 192.168.40.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NAT Switch 192.168.40.x)" Enable NAT New-NetNAT -Name "NATNetwork" -InternalIPInterfaceAddressPrefix 192.168.40.0/24 This will result in: ...

18 February 2020 · 1 min · Jos Hendriks